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 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 install golang # installs go
Installing Go in Arch/Manjaro
Installing from Source
Add /usr/local/go/bin to the PATH environment variable:
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:
If you see a message similar to the below, Go was installed
successfully.
Testing GOPATH
Let's now test if the GOPATH environment variable was correctly set (it should) with:
You should see something like:
If all of the previous worked, congratulations! You have go installed in your system!
Conclusion
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.