Learn how to easily install Go on Ubuntu 20.04.

How to install Go on Ubuntu 20.04

Go (Golang) is a multi purpose open source programming language created by Google Engineer to create dependable and efficient software. It was modeled after C, is statically typed and explicit. It offers a lot of benefits over C such as its memory safety, automatic garbage collection, portability and independent error handling. The language is not conventionally object oriented and enforces strict rules. However, is widely used by various software development teams in applications such as orchestration, networks and cloud services.

In this short article, I will explain to you how to easily install Go in your Ubuntu 20.04 server.

1. Download and install

The first thing you need to do is to install Go on your server. Connect to your server using SSH and once you're connected, visit the official Go downloads page in your web browser. At the moment of writing this article, the latest available version is 1.19:

Download Go Website

First, move to a known directory to download the tar of Go. For example, you can download it in your current user directory changing the directory:

cd ~

Then, copy the download URL of the tar file that contains Go and download it using Curl (replace the URL if you're trying to download another version):

curl -OL https://golang.org/dl/go1.19.linux-amd64.tar.gz

Then, extract the content of the tar in the /usr/local directory:

sudo tar -C /usr/local -xvf go1.19.linux-amd64.tar.gz

This will let go available from the PATH. /usr/local/go is the recommended installation path for Go, however you may change it if it pleases you.

2. Testing installation

Go is now installed in your server! The only thing left you can do is to test it printing its version in the terminal with the following command:

go version

If everything went well, the version will appear as output. For example, this will be the output in my case:

go version go1.19 linux/amd64

Happy coding ❤️!

Senior Software Engineer at EPAM Anywhere. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Become a more social person