Go is a programming language developed by Google’s team which offers a robust set of libraries and is becoming very popular. In this tutorial, we are going to show you how to install GO on Ubuntu Linux version 17.
Hardware List:
The following section presents the list of equipment used to create this Ubuntu Linux tutorial.
Every piece of hardware listed above can be found at Amazon website.
Ubuntu Playlist:
On this page, we offer quick access to a list of videos related to Ubuntu Linux.
Don’t forget to subscribe to our youtube channel named FKIT.
Ubuntu Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Ubuntu linux.
Tutorial – GO on Ubuntu Linux
On the Linux console, use the following commands to install the required packages.
# apt-get update
# apt-get install build-essential
Now, let’s download and install the Go software.
# mkdir /downloads
# cd /downloads
# wget https://dl.google.com/go/go1.9.3.linux-amd64.tar.gz
# tar -C /usr/local -zxvf go1.9.3.linux-amd64.tar.gz
In our example, the Go software was installed under the /usr/local folder.
In order to work properly, the Go software expect the system to have a set of environment variables.
Let’s create a file to automate the required environment variables configuration.
# vi /etc/profile.d/go.sh
Here is the go.sh file content.
#/bin/bash
export GOROOT=/usr/local/go
export GOPATH=$GOROOT/work
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Now, let’s reboot the computer and check if the required environment variables will be created automatically.
# reboot
Use the following command to check if the environment variables were created.
# env | grep -E “(ROOT|PATH)”
Test the Go program using the following command.
# go version
You are now the proud owner of a GO on Ubuntu Linux installation.