This brief tutorial shows students and new users how to install the Go programming language on Ubuntu 20.04 | 18.04.
For those who don’t know, Go, also known as Golang is a cross-platform programming language developed by Google which makes it easy to build simple and reliable software.
Go is used to build some of the popular software and apps in use today, like Kubernetes, Docker, Grafana, and a few others. It comes with support for Linux distributions, macOS, Windows, and more.
For students and new users looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS…. It’s a great Linux operating system for beginners and folks looking for easier Linux distribution to use.
To get started with installing Go on Ubuntu, please follow the steps below:
How to download Go on Ubuntu Linux
For other systems, the process is usually straightforward. On Ubuntu and other Linux systems, you must download its binary package and install it.
At the time of this writing, the latest version is 1.13. But before downloading, visit the official Go downloads page and check if there is a new version available.
To download the Go binary, run the commands below:
cd /tmp wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz
After that run the commands below to extract the tarball file into the /usr/local directory.
sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz
That should extract the Go binary and save it in the /usr/local directory.
How to configure Go on Ubuntu Linux
At this point, Go should be ready to use. however, to locate or find the Go executable binaries, you will need to configure your system and define an environment variable for Go.
You can define the Go environment variable by adding the line below into the /etc/profile file (for system-wide usage) or your $HOME/.profile file just for you.
To make Go executable for your account only, add the line into your $HOME/.profile file by running the commands below to open it.
Then copy and paste the line below into the file and save.
Save the file and exit
When you’re done, run the commands below to complete the setup
To verify if Go is installed, run the commands below:
You should see similar output as shown below:
Output: go version go1.13 linux/amd64
This is how one installs and configures Go on Ubuntu 18.04 | 16.04
Your first program
To learn how to create your first Go program, please visit the like below:
You may also like the post below: