How to Install Go 1.6.2 on Ubuntu 16.04

To Install Go 1.6.2 on Ubuntu 16.04

Go is an open source programming language developed by a team at Google. It provides easy to build simple, reliable, and efficient software. This language is designed for writing servers, that’ s why it is using widely these days. Go has released latest version 1.9. It is so simple to install Go 1.6.2, and this tutorial will help you to install Go 1.9 on your Ubuntu 16.04 machine.

 

Installing Go

Before you begin with the installation process, you need to update the system by making use of the following command.

root@linuxhelp:/home/user# apt-get update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease   
Hit:2 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease   
.
.
Hit:6 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease    
Reading package lists... Done

 

 

You can now proceed with the installation of the Go language, which you can do in two ways. You can use the apt-get install in the following manner. 

root@linuxhelp:/home/user/Downloads# apt-get install golang
Reading package lists... Done

.
.
bingwallpaper
Reading package lists... Done

 

Or else, you can simply go to your downloads directory which has the downloaded 

root@linuxhelp:/home/user# ls Downloads/
go1.9.2.linux-amd64.tar.gz
root@linuxhelp:/home/user# cd Downloads/

 

And then you need to extract the package by making use of the following command.

root@linuxhelp:/home/user/Downloads# tar -zxvf go1.9.2.linux-amd64.tar.gz 
go/
go/AUTHORS
.
.
go/test/writebarrier.go
go/test/zerodivide.go

 

And then list out the extraction files by making use of the following command. 

root@linuxhelp:/home/user/Downloads# ls
go  go1.9.2.linux-amd64.tar.gz

 

And then, move the install file on customize path by making use of the following command. 

root@linuxhelp:/home/user/Downloads# mv go /usr/local

 

 

And after that, you need to setup the Go environment, and for that make use of the following command. 

root@linuxhelp:/home/user/Downloads# export GOROOT=/usr/local/go
root@linuxhelp:/home/user/Downloads# export GOPATH=$home/Projects/proj1
root@linuxhelp:/home/user/Downloads# mkdir -p /home/Projects/proj1
root@linuxhelp:/home/user/Downloads# export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

 

Once it done, you need to verify the installation by making use of the following command. 

root@linuxhelp:/home/user/Downloads# go version
go version go1.6.2 linux/amd64

 

Also, later, you need to verify all configured environment variables by making use of the following command. 

root@linuxhelp:/home/user/Downloads# go env
GOARCH=" amd64" 
GOBIN=" " 
GOEXE=" " 
.
.
CGO_LDFLAGS=" -g -O2" 
PKG_CONFIG=" pkg-config" 

 

With this, the installation of Go 1.6.2 on Ubuntu 16.04 comes to an end. 

FAQ
Q
which command to verify all configured environment variables?
A
You can also verify all configured environment variables using the following command.
# go env
Q
How to check the version of GO in centos?
A
You can use the the following command to check Go version
# go version
Q
What is main terms of Go?
A
Go is an open source programming language developed by a team at Google.
It provides easy to build simple, reliable, and efficient software.
This language is designed for writing servers, to process management, and some say even systems.
Q
What for GOROOT is used?
A
In order to add them in enviornment variable, The GOROOT is used
Q
How to add GO path towards the env?
A
run as the command on terminal to add in ENV
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH