Golang Code

How to Install Go in Ubuntu 16.04

· 104 words · 1 minute read #16.04 #bash #command #go #golang #install #local #path #profile #ubuntu #vim #wget

Download the latest version of Go. Ubuntu does come with a version of go in it’s apt listings but it won’t be as up-to-date as downloading it directly. Once downloaded we extract it into a folder we can work with.

wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz

tar xvf go1.8.1.linux-amd64.tar.gz

Once downloaded and extracted, move to the folder to /usr/local so we have it globally.

sudo chown -R root:root ./go
sudo mv go /usr/local

We then need to add some bash variables so Go knows where our directory is located. GOPATH should point to the folder where you’ll be working in.

vim ~/.profile

export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

source ~/.profile

See something which isn't right? You can contribute to this page on GitHub or just let us know in the comments below. Thanks for reading!