How to Install Go on Ubuntu Linux

This tutorial guides students and new users on how to install the Go programming language (Golang) on Ubuntu 20.04 or 18.04. Golang is a cross-platform language developed by Google, widely used in popular apps like Kubernetes, Docker, and Grafana. The instructions include downloading Go binary, extracting it, and configuring the system to find Go executable…

This brief tutorial shows students and new users how to install the Go programming language on Ubuntu 20.04 | 18.04.

Go is used to build popular software and apps today, like Kubernetes, Docker, Grafana, etc. It supports Linux distributions, macOS, Windows, and more.

There are several reasons why someone might want to install Go on Ubuntu Linux. Firstly, Go is a popular programming language that is easy to learn and use, making it an excellent choice for beginners and experienced developers.

Additionally, Go is cross-platform and can be used on various operating systems, including Ubuntu Linux. Furthermore, Ubuntu Linux is a great operating system for beginners and people who want an easier distribution to start learning.

It has a large community of users and developers, which means many resources are available for people who are just starting with programming or Linux in general.

Finally, Go is used to build some of the most popular software and applications today, such as Kubernetes, Docker, and Grafana. So, if you’re interested in developing software or applications, Go is a language worth learning, and installing it on Ubuntu Linux is a great way to get started.

To get started with installing Go on Ubuntu, please follow the steps below:

How to download Go on Ubuntu Linux

For other systems, the process is usually straightforward. You must download and install its binary package on Ubuntu and other Linux systems.

At the time of this writing, the latest version is 1.13. But before downloading, visit the official Go downloads page and check if a new version is available.

To download the Go binary, run the commands below:

cd /tmp
wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz

After that, run the commands below to extract the tarball file into the /usr/local directory.

sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz

That should extract the Go binary and save it in the /usr/local directory.

How to configure Go on Ubuntu Linux.

At this point, Go should be ready to use. However, to locate or find the Go executable binaries, you must configure your system and define an environment variable for Go.

You can define the Go environment variable by adding the line below into the /etc/profile file (for system-wide usage) or your $HOME/.profile file just for you.

To make Go executable for your account only, add the line into your $HOME/.profile file by running the commands below to open it.

nano $HOME/.profile

Then copy and paste the line below into the file and save.

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

Save the file and exit

When you’re done, run the commands below to complete the setup

source ~/.profile

To verify if Go is installed, run the commands below:

go version

You should see similar output as shown below:

Output:
go version go1.13 linux/amd64

This is how one installs and configures Go on Ubuntu 18.04 | 16.04

Your first program

To learn how to create your first Go program, please visit the link below:

https://golang.org/doc/code.html

Richard Avatar

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *