Go, also known as "Golang," is an open-source programming language released back in 2012. It was made by Google with the intention of making a language that could be easily learnt.
Over the years, Go has gained popularity among many programmers who use it to create various projects starting from cloud applications to artificial intelligence and robotics. It has also been used to create popular platforms such as Kubernetes, Prometheus, Docker and Terraform.
Go, is available for various operating systems such as Windows, Linux systems and macOS. This tutorial shows you how to install the GO programming language on the Ubuntu Linux distribution.
Let's get started.
Installation
Several methods can be used to install the Go programming language on an ubuntu system. You can use the apt repository, download the source code or install it using snap.
1. Using apt repository to Install Go
Start by opening the terminal window by pressing Ctrl + Alt + t
. Once the terminal is open, update the packages list with the command below:
sudo apt update
This command will ensure that the package database is updated with more package lists so that everything is up to date and missing packages are downloaded.
After the update, install golang with the following command and press Enter
.
sudo apt install golang -y
We use the -y
flag to accept all the prompts. This command should install all the required Go dependencies to the system.
You can verify that Go is installed by checking the version with the following command.
go version
Output:
2. Go Installation using Snap
The other method to install Go is using the snap application. The snap application allows you to install your preferred go version. Snaps are
You can check the list of go versions using the command below.
sudo snap info go
Output:
You can select your preferred version from the lists and use Snap to install it.
The snap installation syntax is as follows.
sudo snap install go --classic --channel=version-no/stable
Where "version-no" is the version you choose.
Example:
sudo snap install go --classic --channel=1.20/stable
Output:
If you are unhappy with the choice of go installed, you can use the following command to upgrade or downgrade it.
sudo snap refresh go --classic --channel=1.19/stable
The command above downgrades go to version 1.19 from 1.20.
3. Downloading the Source Code
You can also Install Go by downloading the source code from the official site and installing it manually. Check this article to see how to do it. How to install go using the source code
Ending
In this article, you have seen how to install golang using Snap and using the apt repository. Choose one of the methods and get started with development.
If you found the article useful, share it and consider subscribing to geekbits to get notified whenever we publish interesting articles.
Thanks for reading :)
Related Topics


