Want to learn how to build better Go applications faster and easier? You can.
Check out my course on the Go Standard Library. You can check it out now for free.
If you want to install a specific version of Go in Linux (without a package manager) here’s how you do it.
Bring up the Go downloads page in a browser.
Copy the link to the download you want (I’m looking for 1.16.8):
mkdir ~/src && cd ~/src
Now, let’s download the archive (you copied from the webpage above)
wget https://golang.org/dl/go1.16.8.linux-amd64.tar.gz
Now that the archive is downloaded, unzip it:
sudo tar -C /usr/local -xzf go1.16.8.linux-amd64.tar.gz
This will unzip it into your go folder.
Now you’ll need to add a path. Open up ~/.profile
Add the following:
PATH=$PATH:/usr/local/go/bin
And save the file. Now run
source ~/.profile
and your Go binaries should be available. Type in
go version
And you’ll see your Go version available.
And that’s all there is to it!