Last Updated: February 25, 2016
·
2.109K
· fern4lvarez

Install/upgrade #golang on #Ubuntu manually

When it comes of installing or upgrading Go on Ubuntu, I always do it manually. It might sound harder than just using some PPA, but it's not. Actually, I have not good experiences with Go PPAs on Ubuntu, they are outdated or new versions just come too late.

Follow these steps and you will be done (it also applies for other GNU/Linux distributions and FreeBSD OS)

  • In case you are upgrading a version of Go, delete the existing version:

sudo rm -rf /usr/local/go

  • Go to the official releases index and grab your architecture release.

  • Extract the content of the release on the right place:

sudo tar -C /usr/local -xzf ~/LOCATION/OF/YOUR_RELEASE.tar.gz

  • Make sure your PATH points to the bin directory:

export PATH=$PATH:/usr/local/go/bin

  • You should be done:
$ go version

<SHINY NEW VERSION MESSAGE>

In case you didn't, don't forget to set a GOPATH variable for your workspace and add GOPATH/bin to your PATH.

Enjoy!