How to install Go lang on CentOS?

We use pre-compiled binary files to install Go development environment on CentOS. This is very easy to follow, and all you need to do are, download the package, decompress it in a proper directory, and set system variables for Go. This guide work on RHEL as well.

Download the package from official website

wget -c

The -c mean transfer resume is enabled, as my connection in office in not so reliable. The file is 54MB in size.

Decompress the file to /usr/local

sudo tar zxvf go1.2.1.linux-amd64.tar.gz -C /usr/local

Setup variables for Golang environment

Here we go, just create the exact file with these content,

# cat /etc/profile.d/
export GOROOT=/usr/local/go
export GOPATH=$GOROOT/src
export PATH=$GOROOT/bin:$PATH

Finally re-login, all’s ready,

$ type go
go is hashed (/usr/local/go/bin/go)

Share this post

Post Comment