How-To: Install Go on Ubuntu 22.04

0
343

Checking if Installed

To verify if Go is installed, you can execute the following to check.

$ go version

By default on Ubuntu 22.04 Go is not yet installed, and you will be shown the following.

Installing Go

01. Go can be downloaded from the official Go website here. At the time of this writing, the version is 1.19, and the following command can be used to download the compressed package.

Change to the root user or use sudo to download the package

$ sudo su -

Download the package

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

02. It is recommended to place the installation in the /usr/local/go package. The following removes old installations and extracts the archive.

# rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz

03. Return to the non-root user, in this example is called geek.

# exit

03. Add /usr/local/go/bin to the PATH environment variable.

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

04. Verify that Go has been installed.

$ go version

Removing Go

01. To remove Go, simply delete the directory

$ sudo rm -rf /usr/local/go


For enquiries, product placements, sponsorships, and collaborations, connect with us at hello@firegulaman.com. We'd love to hear from you!