How to install Go on Ubuntu 22.04

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install Go on Ubuntu 22.04.

Go is an open source language created by Google.

If you have never heard about Go, Go is actually used on a lot of popular apps that you may be using daily.

When it comes to coding, Go is a language like python, meaning you can install it on your machine and use it to code in Go.

Installing Go is a very simple thing to do. In this tutorial, we'll be installing Go on Ubuntu 22.04 via the official Go source.

Install Go on Ubuntu 22.04

Step 1 - Download Go

Go can be easily downloaded from the official website of Go language. However, in this tutorial, we'll be using curl to download Go via the terminal as the installation process is done also via the terminal only.

curl -O

Step 2 - Install Go

After downloading Go source on your machine, verify that the download was completed without errors. The file that you need to look for is called go1.21.3.linux-amd64.tar.gz

To verify that Go source was downloaded without errors, you can check the file size via the command below

ls -lh -h

Go source takes 64MB, so in output of the command above you should see 64M

Once verified, proceed to install Go on your machine. To install Go, simply run the command below

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

The command above, will extract Go source into your /usr/local directory

Step 3 - Add Go to your Path

Once Go is installed on your machine, to use it, first you need to add Go path on your shell configuration file ~/.bashrc This is done so you can be able to use and call go from your terminal without having to manually execute /usr/local/go

To do this, simply run the export command below

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

Now to make changes permanent, make sure to source your shell configuration file

source ~/.bashrc

Step 5 - Check Go Installation

Now Go should be installed and added on your shell configuration file, meaning you can now launch go from your terminal by simply calling


Alternatively, you can also check go version

go version

Uninstall Go on Ubuntu 22.04

All Go files are located in the /usr/local/go directory, so to uninstall Go from your Ubuntu 22.04 machine, you can easily do so by removing this directory completely.

sudo rm -rf /usr/local/go


In this tutorial, you learned how to install and uninstall Go language on Ubuntu 22.04 machine.