In this article, we are going to install Go on CentOS / RHEL 8. At the time of writing the article, the Go is version 1.13.5. Check their official page to download the latest version.
1. Download Go
Download the Go binary using wget:
Then verify the tarball checksum by typing:
The output should look like this:
cde4af177ef9f218f51f5e12041f43004f9fa1b0e45d3b647c252aba04901035 go1.13.5.linux-amd64.tar.gz
Extract the tarball using tar to /usr/local directory:
2. Set Go Path
Open /.bash_profile file:
Add the following lines:
Save the file and reload PATH using this command:
To verify go installation, run this command:
You’ll see the output like this:
go version go1.13.5 linux/amd64
3. Run Hello World Program
Create the Go workspace:
Inside the workspace make directory src/hello:
Create hello.go file inside hello folder:
Now paste the following code:
Build the program:
Run the executable by typing:
The output should be:
Hello, World