Computersnyou

How to Install latest GOLANG in ubuntu [ Quick Tip ]

Posted on  3/6/2015
go ubuntu
go ubuntu

Ubuntu repositories doesn’t contains latest golang builds and I was unable to find any good PPA with latest golang So I’m Writing this Quick tutorial about how to install , latest go language compiler in ubuntu .

Steps

1 . Go to https://golang.org/dl/
2 . Copy the download link
3 . Download and install manually

$ wget -c https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz 
$ tar -xvzf go1.4.2.linux-amd64.tar.gz 
$ sudo mv go /usr/local/

Now lets add that in /etc/profile to make it available system-wide .

$ sudo nano /etc/profile 

Now add

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

You can check your installation

$ go env 

sample output

GOARCH="amd64"
GOBIN="/home/alok/code/gocode/bin"
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/alok/code/gocode"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"
go in ubuntu
go in ubuntu

There are many cons of this method , one of that is you have to check manually for updated go versions , you wont get updates via system package manager .

Hope it was helpful for you,
happy coding


  • Home
  • About