Go, often referred to as golang is a modern open-source programming language created by Google that allows you to build reliable and efficient applications. Go is a compiled language, which means you need to compile the source code to create an executable file that is used to run the software.
Many popular applications, such as Kubernetes, Docker, Prometheus, and Terraform, are written in Go.
This tutorial explains how to download and install Go on Ubuntu 20.04. However, those steps can be applicalble on Ubuntu 18.04 LTS or Ubuntu 16.04 LTS.
1. Downloading the Go tarball
The latest stable version of Go is version 1.14.2. Before downloading the tarball, visit the official Go downloads page and check if there is a new version available.
– Run the following command as a user with sudo
privileges to download and extract the Go binary archive in the /usr/local
directory:
$ wget -c https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
2. Adjusting the Path Variable
Let’s adding the location of the Go directory to the $PATH
environment variables. So, this can be done by appending the following line either to the /etc/profile
file or the $HOME/.profile
file
export PATH=$PATH:/usr/local/go/bin
Now, save the file, and load the new PATH environment variable into the current shell session, by running the below command:
source ~/.profile
3. Verifying the Go Installation
Verify the installation by executing the following command:
$ go version go version go1.14.2 linux/amd64
Conclusion
Now that you have downloaded and installed Go on your Ubuntu system, you can start developing your Go projects. However, there is still much more to learn about Go, for more information visit the Golang Documentation
You might want to check the following guides: