Open In App

How to Install Golang on CentOS 7?

The Go programming language is an open-source project to make programmers more productive. 
Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It’s a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.

Prerequisites:

The user used(Linux user)In this tutorial is root or a user with root power i.e add sudo at the starting of every command.



Installing Go on Centos 7:

Follow the below steps to install the Go programming language on Centos 7:

Step 1:First download Wget software using the below command:



yum install wget -y

Then install GO using wget command:

wget https://golang.org/dl/go1.17.2.linux-amd64.tar.gz3

Step 2: Now remove the previous installation (if any ) and unzip the downloaded tar file of GO using the below command:

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz

Step 3: Now add the path of Go in the PATH variable by  using the below command:

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

Step 4:  To verify that go is properly installed run this command: 

go version

If this shows up then you are all set to start with go, if not redo all the steps above.

Article Tags :