How to Install Go v1.10.3 on Ubuntu 16.04 LTS

Golang is an open-source programming language developed by a team at Goole. Recently Google has released the latest version, 1.10.3. This short tutorial will guide you on how to install Go version 1.10.3 on your machine manually. 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.

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:

Extract the 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

Untar and move the go dir to /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.

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.

Setup $PATH:

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

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.

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

Leave a reply:

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