How to Install the Latest Go Language on Ubuntu

Ready to dive into the world of Go programming on your Ubuntu system? Go, also called Golang, is loved for its simplicity and efficiency. In this guide, I’ll show you how to install the latest version of Go language on your Ubuntu, so you can have a smooth and updated setup for your coding adventures.

I will primarily focus on the Ubuntu server, but the process is nearly identical for desktops and other similar distributions.

The first thing we will do is remove any Go installations installed via the package manager.

apt remove golang

To view the downloads and releases, you can check out this page. We will install Go 1.20.x.

Let’s download the tar archive and then move it to /usr/local.

cd ~
wget https://go.dev/dl/go1.20.12.linux-amd64.tar.gz

tar -C /usr/local -xzf go1.20.12.linux-amd64.tar.gz

Next, we will add it to the path in the .profile file located in the home directory.

vim ~/.profile

Add the following at the end of the file.

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

Save and run the following command.

source ~/.profile

If you have done everything correctly up to this point, go ahead and check its version.

go version

You will see something similar to the following output.

go version go1.20.12 linux/amd64

Go is now available on your system and you can deploy your Go apps.