How to install Go(lang) and Hugo on Ubuntu.

Install Go


Replace the https://… download URL below with the latest Linux AMD64 version listed at

For an upgrade install, only the first 5 lines below are required.

sudo rm -rf /usr/local/go
cd $HOME
curl -OL
sudo tar -C /usr/local -xzf $HOME/go1.9.4.linux-amd64.tar.gz
rm $HOME/go1.9.4.linux-amd64.tar.gz
mkdir $HOME/go/bin -p
mkdir $HOME/go/pkg
mkdir $HOME/go/src
echo "PATH=\$PATH:/usr/local/go/bin" >> .profile
echo "PATH=\$PATH:\$HOME/go/bin" >> .profile
echo "GOPATH=\$HOME/go" >> .profile
source .profile

Install Hugo


The first three lines below creates a shell script which will download the latest version of Hugo, compile it with Go, and then install it in the Go bin directory.

The subsequent commands will mark the created script file as executable and then finally run that script.

echo "go get" >
echo "go get -u -d" >>
echo "cd \$HOME/go/src/" >>
echo "mage vendor" >>
echo "mage install" >>
chmod +x

To test that all is installed as expected, run the following commands and check that they don’t report a file not found error.

go version
hugo version