Setting up Go on Ubuntu

This is a quick guide to getting started with Golang on Ubuntu 20.04 with the bash shell.


From the Golang website, download the latest version of Go for Linux to your Downloads folder, as of this writing it is:



Open a bash terminal (CTRL+ALT+T) and make sure you are in your home folder:

cd ~/

If you already have a version of Go installed, remove it:

sudo rm -rf /usr/local/go

Uncompress your downloaded file to the /usr/local folder:

sudo tar -C /usr/local/ -xzf Downloads/go1.16.3.linux-amd64.tar.gz


Open .bashrc with your favourite editor, I am using vim here:

vim ~/.bashrc

And add the following to the end of the file:

export GOPATH=$HOME/go

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

Save and close the modified file, and then create the go folder to store packages:

mkdir ~/go

Close the terminal by entering exit, or clicking the close window button.


Reopen the terminal, and type the following to confirm go is correctly installed:

go version

You should see displayed the version you just installed, in my case:

go version go1.16.3 linux/amd64

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s