Install Go on Ubuntu

Update apt

Start by refreshing the package index so Ubuntu sees the latest snap and apt metadata.

sudo apt update

This step does not install anything yet, it only makes sure the next commands resolve fresh package data.

Install with snap

The simplest path on Ubuntu is the snap package in classic mode.

sudo snap install go --classic

As an alternative, the Ubuntu archive also ships a package named golang-go for plain apt installs without snap.

Beginners can stay with snap because it tracks a recent stable release and needs no manual PATH edits.

go version

A fresh install should answer with its version number.

go version

go version go1.21 linux/amd64

If the command is not found, open a new terminal window so the updated PATH takes effect.

Newer versions

Snap follows recent stable releases, while the plain apt archive can lag behind by several minor versions.

When you need the newest toolchain right away, fetch the release archive from the official download page and unpack it by hand.

Next: Install Go on Rocky Linux

Article author: Arthur Isaev