How To Install Golang 1.14 on CentOS 8 | CentOS 7

  • Bagikan

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 Go 1.14 on CentOS 8 / CentOS 7 Linux system.

Install Go 1.14 on CentOS 8 | CentOS 7

In this guide we’ll use a simple bash script created by Jorge Canha to install Go on CentOS 8 / CentOS 7 Linux machine. The script will download and install Go language under of your own user account.

Download script.

--- With curl ---
curl -O https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh

--- With wget ---
wget https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh

Make the script executable.

$ chmod +x goinstall.sh

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

./goinstall.sh

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

--- Install Go 1.14 ---
$ ./goinstall.sh --version  1.14

--- Install Go 1.13 ---
$ ./goinstall.sh --version  1.13

Installation output:

...
esolving storage.googleapis.com (storage.googleapis.com)... 2a00:1450:400f:808::2010, 216.58.211.144
Connecting to storage.googleapis.com (storage.googleapis.com)|2a00:1450:400f:808::2010|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 120050424 (114M) [application/octet-stream]
Saving to: ‘/tmp/tmp.vlZUgncsKp/go.tar.gz’

100%[==============================================================================================================>] 120,050,424 34.4MB/s   in 3.3s   

2020-06-12 00:46:12 (34.4 MB/s) - ‘/tmp/tmp.vlZUgncsKp/go.tar.gz’ saved [120050424/120050424]

Extracting File...

Go 1.14 was installed into /root/.go.
Make sure to relogin into your shell or run:

	source /root/.bashrc

to update your environment variables.
Tip: Opening a new terminal window usually just works. :)

Source your bashrc file.

source /root/.bashrc

Confirm GOPATH is configured.

$ echo $GOPATH
/root/.bashrc

Confirm Go version installed on CentOS 7:

$ go version
go version go1.14 linux/amd64

Uninstall Go on CentOS 8 | CentOS 7

The same script can be used to install Go on CentOS 8 | CentOS 7:

$ ./goinstall.sh  --remove
Go removed.

Enjoy developing world changing applications with Go.

  • Bagikan