GO is used by many large companies and has become one of the most popular programming languages in the world because of its popularity among cloud application developers.
Some of the most notable applications written in Go include Kubernetes, the container orchestration system that powers many popular cloud platforms; Docker, the containerization platform that makes it easy to deploy and manage applications; and Terraform, the infrastructure as code tool that helps developers build and manage cloud infrastructure.
In this direct-to-point tutorial, we will guide you through the process of downloading and installing the latest version of Go on Ubuntu.
Install Go from the standard repository
Fire up your terminal, and the following commands will guide you through the installation process, which is incredibly straightforward.
First off, let's make sure that the package lists are up to date. This will also ensure that you are installing the latest version of Go available in the repository.
sudo apt update
To install Go from the standard repository, run the following command.
sudo apt install golang-go
You will then be prompted with "Do you want to continue?" [Y/n]. Once the download and installation is complete, you can check the version of Go by using the following command.
After the installation is complete, you can also run the following command to upgrade any other packages on your system to their latest versions. This step is optional and depends on your preference.
sudo apt upgrade
This is the most straightforward method to install Go on Ubuntu and is preferred by developers, as it is similar to installing any other package from the standard repository.
Install Go on Ubuntu with wget
Wget is more powerful and flexible than downloading through the browser. For example, Wget can download files from any website, regardless of the protocol, and it can download files in parallel to improve download speeds.
The following command uses the wget method to download the latest version of the Go binary for Linux:
This command will download the Go binary tarball to the current directory. However, you should take note of the link. It is a specific version, and you can always get the latest file link from go.dev/dl.
Once the download is complete, you can extract the tarball using the following command:
sudo tar -C /usr/local/ -xzf go1.21.1.linux-amd64.tar.gz
Add the Go binaries directory to your PATH environment variable:
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
To reload the PATH environment variable, source your bashrc file.
Verify that Go is installed correctly by running the following command:
You should see the version of Go that you installed.
This also is the most reliable way to install Go on Ubuntu or any Linux distro. If, however, you encounter any errors during the installation process, please refer to the Go documentation for troubleshooting steps.
Thanks for making it to the end.
If you're a diehard Linux fan, we've got just the thing for you. Check out this resource on lightweight Linux distros that are perfect for older hardware or systems with limited resources. It's totally worth a read!