Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Go on Ubuntu 22.04

Install Go with APT or Snap and check the version.

VPS and Cloud Servers1 min read7 screenshots

Requirements

  • A 64-bit system with a modern processor.
  • A few hundred MB of free disk space.
  • An internet connection.

Method 1: Install with APT

Step 1: Update the package list

sudo apt update
Updating the package list

Step 2: Install Go

sudo apt install golang-go
Installing Go

Step 3: Check it

go version
The Go version
Note: The Go version in the Ubuntu 22.04 repository is older than the latest release. If you need a newer one, use Snap or the official tarball.

Method 2: Install with Snap

Step 1: Install snapd (if it is not installed)

sudo apt install snapd
Installing snapd

Step 2: Install Go

sudo snap install go --classic
Installing Go with Snap

Step 3: Add the Snap folder to the PATH

echo 'export PATH=$PATH:/snap/bin' >> ~/.bashrc
source ~/.bashrc
Updating the PATH

Step 4: Check it

go version
The Go version after the Snap install

Method 3: The official tarball (newest version)

Download the Linux tarball from go.dev/dl, then:

sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc

Use the file name of the version you downloaded.

Quick recap

  • sudo apt install golang-go is the simplest way.
  • sudo snap install go --classic gives a newer version.
  • Check with go version.