Go Installation on Ubuntu 22.04

Update package index files

sudo apt update

Download package

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

Remove any previous Go installation by deleting the /usr/local/go folder (if it exists), then extract the archive you just downloaded into /usr/local, creating a fresh Go tree in /usr/local/go:

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

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

nano ~/.profile

Add below line to the end of file

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

source ~/.profile 

Check the go version

go version

Terminal output for reference

$ go version
go version go1.20.7 linux/amd64