Installing Latest Go in Ubuntu 22.04

Photo by Chinmay B on Unsplash

Installing Latest Go in Ubuntu 22.04

Go, often referred to as Golang, is a statically-typed programming language developed by Google. It was created by Robert Griesemer, Rob Pike, and Ken Thompson and first released in 2009. Go was designed with a focus on simplicity, efficiency, and maintainability, aiming to address the shortcomings of existing programming languages.

So you have decided to learn Go and get it setup on your Ubuntu machine - Great!

This tutorial will tell you how to do the same and get Go up and working in under 2 minutes flawlessly!

(There are other methods of installing Go - using apt and snap. This article uses the method of binary file, as it offers greater control for programmers.)

Downloading Go

Visit https://go.dev/dl/ to know what is the latest version of Go for your distribution.

wget https://golang.org/dl/go1.18.linux-amd64.tar.gz

Extracting the compressed file

Extract the just downloaded file by -

sudo tar -xf go1.18.linux-amd64.tar.gz -C /usr/local/

Adding Go to the PATH

Open the /etc/profile file in editor of your choice,

sudo nano /etc/profile

And append the following line to its end -

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

Now exit from the editor after saving the file (Ctrl+X and Y for nano)

Checking installation

Check if Go is installed by checking its version as -

go version

If you followed all steps as mentioned, it will show the version of Go installed as -

Yay! You have installed Go successfully on your Linux machine. Go ahead and build something cool with it!