Traffic signal showing a green man in a hat walking. There is a blue sky in the background

Going, going... gone. How to easily install Golang on Linux 

Go is a programming language designed by Google engineers, that runs under the hood of a lot of the software you probably use on a regular basis. Want to install Go on your Linux system? This is how.

Why install Go on Linux?

If you're a coder, you probably want to install Go on Linux because you want a high-level programming language that's powerful and not too difficult to learn and use. It can help you to get a job within the IT field, pivot to a new direction, or you can use it to create hobby projects to either showcase your skills or just for giggles.

But we suspect (we have no proof of this), that most people would need to install Go on Linux in order to install and use some of the awesome open-source projects, tools, and games that are created with Go, and require Go to run.

If this is you, read on...

Installing Go on Linux is easy.

Go - or Golang as it's present in most of the major repositories, which means that you can install it using your package manager in the usual way.

If you're on Ubuntu, for instance, you would open a terminal and enter:

sudo apt install golang-go

For systems with snap, enter:

sudo snap install go --classic

Go is also available in the Arch User Repository.

But repositories have an unfortunate tendency to lag far behind the latest release of any software package, and Go is no exception. If you want the most up-to-date version of go, you're better off installing it yourself - although this does mean that Go won't update when you update the rest of your system

using wget to download the golang tarball

To grab the latest version of Go, visit https://go.dev/dl/ and look for your OS and architecture in the list. Your OS is, obviously, Linux, and if you're running it on a modern PC the architecture should be x86-64. If you're installing on a machine with an ARM processor, such as a Raspberry Pi, a repurposed modern mac, or similar, you need ARM64. Sorry, 32-bit Pi users, you appear to be out of luck.

Right-click on the tarball name and copy the address to your clipboard, then open a terminal and use wget to download the package to your current directory. For instance:

wget https://go.dev/dl/go1.22.3.linux-amd64.tar.gz

When the download has completed, extract it to /usr/local/ with the following command:

sudo tar -C /usr/local -xvf go1.22.3.linux-amd64.tar.gz

Make sure you change the filename to match the version you downloaded.

Go is now installed in /usr/local/go/bin, but your system won't know where to find it if you type the command go into your terminal, and you'll see a "command not found" message. To fix this enter the following lines:

echo "export PATH=$PATH:/usr/local/go/bin" >> .profile

...and refresh your profile:

source ~/.profile 

That's it Go is now installed on your Linux server or PC. Have fun!