Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Linux Last updated: May 20, 2023
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Go, also known as Golang, is an open-source programming language developed by engineers at Google in 2007. It was officially launched by Google in 2009, and the first stable version was released in 2012.

The primary intention of developing this language was to significantly reduce the compile time of heavy programs. Back then, engineers at Google were using languages such as C/C++ to develop computer programs only to get frustrated by the amount of time it took to compile those programs, and thus, they developed their own programming language, which was fast and effective.

YouTube video

The key highlight of Go is that it focuses on concurrency, which is a very useful feature for running resource-intensive programs. It achieves concurrency by using functions known as “goroutines”, managed by the Go runtime, working collaboratively to prioritize efficient program execution on OS threads. That’s what makes Go really good at handling multiple tasks simultaneously.

Go is primarily used for backend development because it was specifically designed for system-level development, and also, its standard library has multiple useful utilities required for backend development.

To summarize, here’s what made Go a popular programming language:

  • Open-sourced by Google
  • It’s fast
  • Developer focused
  • Great at multitasking

With that being said, let’s go through a quick tutorial on how you can install Go on Ubuntu – a distribution of the Linux operating system.


Before installing Go on your system, remove previous installations of Go (if any) from your system. The Go installation resides in the /usr/local/go folder, thus, delete this folder from your system if it exists.

sudo rm -rf /usr/local/go

Installing Go on Ubuntu

#1. By downloading binaries

  • Download Go’s binary release for linux from its website.
  • Extract the file which you just downloaded in the /usr/local/ directory by using the following command:
sudo tar -C /usr/local -xzf go1.20.4.linux-amd64.tar.gz
  • By doing so, a new folder /usr/local/go will be created on your system.
"/usr/local/go" folder
  • Add the path /usr/local/go/bin to the $PATH environment variable. Define the PATH variable in the $HOME/.profile file. You must need to restart your terminal for changes to apply.
if [ -d "/usr/local/go/bin" ] ; then
  • If you are using bash, then you must also define the PATH variable in $HOME/.bashrc file, along with defining the PATH variable in the $HOME/.profile file.
if [ -d "/usr/local/go/bin" ] ; then
  • For zsh users, export the PATH variable from the $HOME/.zshrc file, along with defining the PATH variable in the $HOME/.profile file.
if [ -d "/usr/local/go/bin" ] ; then
    export PATH=$PATH:/usr/local/go/bin
  • Restart your terminal, and check if go is installed or not by running the following command:
go version
go version check

#2. By using apt package manager

You can install Golang by using the apt package manager. I would not recommend using this method if you want the latest version of Golang because the apt repository might contain older versions.

First, update the apt package index to pull the latest packages available. Always update the apt package before upgrading or installing new packages.

sudo apt update

Then, install Golang by using the following command:

sudo apt install

#3. By using snap

Snap is nothing but a utility to download and install Linux app packages in a secure and robust way. For installing Golang, first check the available Golang package by using:

sudo snap info go

Then you can install it by using:

sudo snap install go --channel=stable --classic

The --channel flag is used to describe a specific release cycle, for example, stable or beta. When you use the refresh flag, it will pull the latest versions from the specific channel. So, if you want to try beta versions, change the channel accordingly.

The --classic flag is used to specify that the package should not be executed in a restricted sandbox environment.

Uninstalling Go

To uninstall Go from Ubuntu, simply remove the directory /usr/local/go by running:

sudo rm -rf /usr/local/go

And then, clear the PATH environment variable you created in $HOME/.profile, $HOME/.bashrc and $HOME/.zshrc depending on your configuration.


That was a simple installation tutorial of Go – a popular programming language used primarily for backend development.

If you want to install Go directly from the source and build and compile it on your machine manually, check out the official tutorial for that. I would recommend source installation only if you are well-versed in its intricacies.

Want to explore Go in-depth? Check out these amazing resources to learn Go.

  • Murtuza Surti
    Software Engineer & Content Creator
Thanks to our Sponsors
More great readings on Linux
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder