How To Install Go (Golang) on CentOS 8 | RHEL 8

Posted on 174 views

Go, commonly referred as Golang is a modern open source programming language for building reliable, simple and efficient software applications. Go powers popular applications such as Kubernetes, Prometheus, Docker, Terraform, Sensu and many others.

This tutorial will walk you through the installation of Golang on CentOS 8 | RHEL 8 Linux system.

Install Go (Golang) on CentOS 8 | RHEL 8

In this guide we’ll use official automated installation of Go (Golang) on CentOS 8 | RHEL 8. The script will download and install Go language under of your own user account.

Download Go installer script.

### with curl ###
sudo yum -y install curl
curl -O https://storage.googleapis.com/golang/getgo/installer_linux

### with wget ###
sudo yum -y install wget
wget https://storage.googleapis.com/golang/getgo/installer_linux

Make the script executable.

chmod +x installer_linux

If you run the script without passing version in option, it will download the latest release.

$ ./installer_linux
Welcome to the Go installer!
Downloading Go version go1.18.3 to /home/jkmutai/.go
This may take a bit of time...
Downloaded!
Setting up GOPATH
GOPATH has been set up!

One more thing! Run `source /home/jkmutai/.bash_profile` to persist the
new environment variables to your current session, or open a
new shell prompt.

Source your bash profile file.

source .bash_profile

To install specific version, pass the version number to -version argument.

$ ./installer_linux --help
Usage of ./installer_linux:
  -i	Prompt for inputs.
  -skip-dl
    	Don't download - only set up environment variables
  -v	Verbose.
  -version string
    	Version of Go to install (e.g. "1.8.3"). If empty, uses the latest version.

$ ./installer_linux -v 1.18.3

Confirm GOPATH is configured.

$ echo $GOPATH
/home/USER/go

Confirm Go version installed on CentOS 8 / RHEL 8 Linux system:

$ go version
go version go1.18.3 linux/amd64

 

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.