How To Install Go 1.6 On Ubuntu 16.04


What Is Go?

Go is a newer modern programming language developed by Google. The popularity of the language has been increasing in recent times as companies have adopted the language for having a robust set of libraries, in addition to it being easy to build simple, reliable and efficient software.

Installing Go

While you may be able to find Go in default Ubuntu repos, it is oftentimes not the most up-to-date version.

First you will need to navigate to the Go website’s download page to find the official download, for the most up-to-date version. Copy the URL to your clipboard and then download it using wget.

At the time of this writing the link below is the latest version for Ubuntu:

cd ~

Once it finishes downloading, we will need to extract the archive.

tar -xvf go1.6.2.linux-amd64.tar.gz
  • x: Tells tar that we want to extract the archive
  • v: Tells tar that we want the command to be verbose. This means we want to see a listing of the files it extracts
  • f: Tells tar that we will specify the name of the file to extract

Once it is completed you will see a folder called “go”

Now that the file has been extracted, we need to change the ownership of the files and move the directory to the correct location

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

Once the directory is moved Go has been installed, but we are not quite done.

Set Paths

While Go has been installed, we now need to tell your system where Go is so it can be used. To do this we will be editing your user’s profile file.

nano ~/.profile

Go to the bottom of the file and put these two lines

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

Now we need to make some directories to have the full structure required

mkdir $HOME/work
mkdir $HOME/work/src
mkdir $HOME/work/bin


Now that you have created the directories, it is time to test that everything is working. Create a file in the src folder named hello.go and then paste in this code.

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")

Save the file and close it with the buttons: ctrl+ o and then ctrl + x.

Now we need to compile it before we can run the file. Run the command:

go install hello

Once this has been completed run the command:


If you see the output “hello world”, you have successfully installed Go and it is working.


By following this guide you will have the latest version of Go 1.6 on your Ubuntu 16.04 system and have an environment ready to develop programs in Go.


CC BY 4.0 This work is licensed under a Creative Commons Attribution 4.0 International License.

Alex Wacker has written 16 articles

I am the founder and owner of Subnet Labs LLC. Impact VPS is one of our VPS brands. Linux, virtualizaton and the internet amaze me and I enjoy learning new things every day about them.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>