GO or Golang is an open source programming language created by Google with the focus of creating highly available & scalable web apps simple and easy. It is termed as statically types programming language.
Due to it’s ease of use, reliability & versatility , Golang has become the leading choice for many organizations as well developers alike. Many companies today including Expert Remote LLC help organizations hire skilled Go developers for their project needs.
In this tutorial, we are going to discuss to install Go on CentOS machines.
(Recommended Read: Learn to install PYTHON 3.6 on CentOS 7)
(Also Read: Real Time Linux server monitoring with GLANCES monitoring tool)
Install Go on CentOS
Update the system
Firstl make sure that our system is up to date & all the installed packages are to their latest versions. To do so, execute the following command from terminal,
$ sudo yum update
Download & install GO
Go or Golang is available in the form of binary package & we can download the latest binary package, which at the time of writing this tutorial is 1.10.1. To download the package use the complete command mentioned below,
$ wget https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz
Since this is a tar package, we need to extract the package and also move it to the desired location (we will use /home ) . Extract the tar & move the extracted package to /home with the following command,
$ tar -xvzf go1.10.1.linux-amd64.tar.gz -C /home
Configure the Environment variables
We now have to set the below mentioned three Go enviroment varaibles to complete the install of Go. To set the variable, use the mentioned commands & execute them from terminal,
$ export GOROOT=/home/go
$ export GOPATH= $HOME/Go_projects/First_project
$ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
Here, GOROOT tells the Go installation directory, GOPATH tells the work directory location & PATH sets the access to Go binary for whole system. But these variables are only setup temporarily & will go away as soon the current session has been terminated.
For setting these variables permanently, we need to make the above mentioned entries into our .bashrc file located at ‘/home’,
$ sudo nano /home/.bashrc
& make the entries at the bottom of the file,
export GOROOT=/home/go
export GOPATH= $HOME/Go_projects/First_project
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
Now to implement the changes, run
$ source /home/.bashrc
Note:- We can also make the above mentioned entries in /home/.bash_profile .
Test the installation
That’s it, we now have everything in place and are ready to use Go on our system. We can check the Go installation by running,
$ go version
This should produce the following output,
go version go1.10.1 linux/amd64
This shows that our Go installation was a success & we now end this tutorial on how to install Go on Centos & other Linux distributions. Please do let us know if you have any questions or feedback using the comment box below.
If you think we have helped you or just want to support us, please consider these :-
Connect to us: Facebook | Twitter | Google Plus
Donate us some of your hard earned money: [paypal-donation]
Linux TechLab is thankful for your continued support.