December 10, 2025 ⋅ 9 min read
How to properly install Golang on Linux
A tutorial on how to install Golang on linux environemnts.

Golang, often simply called Go, is an open-source programming language known for its simplicity, efficiency, and strong performance more especially in backend development. Its popularity has grown in recent years for many reasons, including type safety, performance, memory management, and fast compilation.
In this tutorial, you’ll learn how to install Go on your Linux environment.

There are several ways to install Go on Linux. The approach you choose may differ depending on your Linux distribution and the package manager it uses. This guide will walk you through all the common installation methods.
Installing from the official Binary Files (Recommended)
This method is recommended because it’s the official installation approach provided by Golang, and it ensures you’re getting the latest version. It may not be the easiest option, but it works reliably across all Linux environments.
1. Download the binary file
Visit the official Go documentation to download the binary file. You can also grab it directly from the terminal using a curl command. Just make sure you know your system’s CPU architecture as most Linux systems use AMD64, while some run on ARM. If you're using curl, download the correct file with:
$ VERSION="1.25.5" # confirm version you are looking for
$ ARCH="amd64" # confirm the archicture you are using
$ curl -O -L "https://golang.org/dl/go${VERSION}.linux-${ARCH}.tar.gz"
$ ls -l
Once the download is complete, extract the file in the directory where it’s located:
$ tar -xf "go${VERSION}.linux-${ARCH}.tar.gz"
2. Move the binary files to the /usr/local/ directory
Before you proceed, make sure to remove any older Go installation from your system. Move the extracted files into the /usr/local/ directory. To perform this opertation you might need root permission:
$ rm -rf /usr/local/go
$ sudo mv -v go /usr/local
3. Configure environment variables for the binary files
To make the binaries accessible system-wide, add /usr/local/go/bin to your PATH environment variable. To do this, edit your ~/.bash_profile file. On some systems, the file may be ~/.profile instead. You can run "ls -al" to check which one you have. Use your preferred text editor to edit the file; in this tutorial, we’ll use Vim:
$ vim ~/.bash_profile
Add this to the file and save:
# set up Go lang path #
export PATH=$PATH:/usr/local/go/bin
Run the source command to load the updated environment variables:
$ source ~/.bash_profile
4. Verify the installation
Your system will confirm a successful installation by displaying the Go version. If you see any other message, it likely means the was unsuccessful. To verify the installation run:
$ go version
Installing using Snap
Snap is a universal package manager for many Linux systems, offering smoother updates with fewer compatibility issues. While it might not always be as up-to-date as downloading binaries directly from the official docs, Snap provides recent versions by frequently updating its package library.
1. Installation
To install the latest version using snap run this command:
$ sudo snap install go --classic
Installing using Advanced Package Tool (APT)
If you’re using a Debian-based distribution like Ubuntu, Kali, or Elementary OS, you’re most likely using APT as your package manager. This section shows how to install Go using APT. Keep in mind, however, that this method isn’t always recommended since the available Go version may not be the latest.
1. Update & Upgrade packages
Make sure to update and upgrade your existing packages to their newest versions, ensuring your system is up-to-date and compatible. To do this run these commands:
$ sudo apt update
$ sudo apt upgrade
2. Install
Make sure to update and upgrade your existing packages to their newest versions, ensuring your system is up-to-date and compatible. To do this run these commands:.
$ sudo apt install golang-go