Showing posts with label Mint. Show all posts
Showing posts with label Mint. Show all posts

Friday, October 30, 2020

How to Install Go on Linux

Installing Go in Linux is very simple! Learn how in this tutorial

So you're ready to learn Go and need some help installing it on Linux? Sure, let's get started! On this tutorial let's learn how to install Go on Ubuntu (and other deb-based systems), Fedora (and RPM-based systems), Arch and by hand.

Installing Go in Linux is simpler than on Windows and Macs since it's already available in the repositories for most distributions

Installing Go in Ubuntu/Debian/Mint/Elementary/Pop!_OS

Installing Go on Ubuntu (and other deb-based systems) is pretty simple. Simply open a terminal and type:

sudo apt update && sudo apt upgrade -y # updates pkgs
sudo apt install golang                # installs go

As simple as that. Once the installation completes, check the next step in the "Testing" section.

Installing Go in Fedora/CentOS/RHEL/SUSE/openSUSE

Similarly, installing Go in Fedora and related RPM-based distributions as as simple as it could be:

sudo dnf update -y        # updates packages
sudo dnf install golang   # installs go

Installing Go in Arch/Manjaro

We don't expect that Arch/Manjaro users wouldn't know how to install Go in their systems but anyway, let's list it here to. Since Go's already package in their repositories, it's not much more complicated that in other distros:
sudo pacman -Syu && sudo pacman -S go

Installing from Source

If Go's not packaged in your favorite distro, it's also possible (and really simple!) to install it from source. Download the latest .tar.gz file from the official site and extract it into /usr/local with the following command:
sudo tar -C /usr/local -xzf go1.14.3.linux-amd64.tar.gz

Add /usr/local/go/bin to the PATH environment variable:

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

Testing the Installation

Once the installation finishes, it's time to check if Go was correctly installed in your system. To verify that you've installed Go by opening a command prompt and typing the following command:

go version

If you see a message similar to the below, Go was installed successfully.

go version go1.15.3 darwin/amd64

Testing GOPATH

Let's now test if the GOPATH environment variable was correctly set (it should) with:

echo $GOPATH

You should see something like:


If all of the previous worked, congratulations! You have go installed in your system!


On this quick tutorial we learned how simple it is to install Go on Linux. Not sure why you should learn Go? Check our main reasons to learn Go.


See Also

Any comment about this page? Please contact us on Twitter

Featured Article

Pointers in Go

Understand all about declaring and using pointers in Go If you're coming from Python, Java, JavaScript, C# and others, tal...

Popular Posts