Installing Go 1.10.3 on Ubuntu 16.04 LTS

By | August 6, 2018

Golang is an open source programming language developed by a team at Goole. Recently Google has released latest version 1.10.3. This short tutorial will guide you how to manually install Go version 1.10.3 on your machine. We assume you run Ubuntu 16.04 LTS operating system.

Update Your Ubuntu System

Login to your machine running Ubuntu system, update and upgrade to apply latest updates.

$ sudo apt-get update
$ sudo apt-get upgrade

Now we are ready to download the Go binary (tar archive).

Download the Go Binary

To download different version go to official Google download page. Let’s download latest version – 1.10.3:

$ wget

Extract downloaded tar archive and install it to the directory of your choice. We will install the binary to /usr/local dir.

Install Go Language

Delete old installation of the Go language

$ sudo rm -rf /usr/local/go

Untar and move the go dir to /usr/local/

$ sudo tar -xvf go1.10.3.linux-amd64.tar.gz
$ sudo mv go /usr/local

Setup Golang Environment

Once Go is installed, we need to set up Go environment variables. As a minimum, we need GOROOTGOPATH and PATH.

Setup $GOROOT:

$GOROOT is the location where Go is installed on the system.

$ export GOROOT=/usr/local/go

Setup $GOPATH:

$GOPATH is the location of the working directory on the system. Go will setup the working directory to $HOME/go as a default location.

$ export GOPATH=$HOME/workgo

Setup $PATH:

Now we need to set up the $PATH var to be able to access Go binary from any place in the system.

$ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

All three variables are set for the current session only. To make them permanent add the above commands to ~/.profile or ~/.bash_profile file.

Verify Installation

The last step is to verify if Go is successfully installed and configured on your system.

$ go version
go version go1.10.3 linux/amd64

As the last step we need to verify if all configured environment variables are set.

$ go env

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.