How to Install Go on CentOS – 7

Date Posted: 15/05/2019

Introduction

Go, often referred to as golang is a ultra modern open source programming language created by Google. In day today life, many popular applications such as , Docker, Kubernetes and Hugo, are written in Go language.

In this tutorial we will guide you how to download and install Go on a CentOS 7 environment.

Prerequesties

For instance the latest stable version of Go is version 1.12.5.

Moreover before downloading the tarball visit the official of Go downloads page and check if there is a new version available.

Follow the step by step procedure to install Go on CentOS 7:

  1. Initially, download the tarball.

Therefore to download the Go binary use either curl or wget command:

wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz

2. Most importantly, verify the tarball checksum with the sha256sumcommand:

sha256sum go1.12.5.linux-amd64.tar.gz
OUTPUT:

aea86e3c73495f205929cfebba0d63f1382c8ac59be081b6351681415f4063cf go1.12.5.linux-amd64.tar.gz

3. Similarly extract the tarball.

Subsequently use the tar command to extract the tarball to the /usr/local directory:

sudo tar -C /usr/local -xzf go1.12.5.linux-amd64.tar.gz

4. On the other hand adjust the Path Variable:

Now we need to tell our system where to find the Go executable binaries by adjusting the PATH environment variable.

We can do this by appending the following line to the /etc/profile file (for a system-wide installation) or to the $HOME/.bash_profile file (for a current user installation):

                             ~/.bash_profile

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

Save the file and load the new PATH environment variable into the current shell session with the following command:

source ~/.bash_profile

Conclusion

Now, we have successfully downloaded and installed Go your CentOS system, you can start developing your Go projects.

Thanks for using pheonix solutions.

You find this tutorial helpful? Share with your friends to keep it alive.


Leave a Reply