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:
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:
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:
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:
You should see displayed the version you just installed, in my case:
go version go1.16.3 linux/amd64