The Right Way to Install Go Language on AlmaLinux or Rocky Linux 8/9 10


If you’re on the lookout for a simple strategy to get began with programming in a language that gives versatile options and efficiency, then look no additional than Go! Developed by Google. Golang is designed to be easy but highly effective, making it an excellent match for learners. It additionally helps cross-platform growth and can be utilized for net and cellular growth together with for cloud computing, machine studying, knowledge science, and synthetic intelligence.

This step-by-step information will make it easier to install Go on AlmaLinux or Rocky Linux so you can begin coding very quickly.

Install Go Language on AlmaLinux or Rocky Linux


  1. AlmaLinux or Rocky Linux
  2. Internet connection
  3. sudo or root person entry

Steps to install Golang on AlmaLinux or Rocky

The instructions given right here will work for each Almalinux or Rocky 8 and 9.  Hence, simply get to your Linux terminal and begin following them.

#1st Method utilizing Yum or DNF

1: Update AlmaLinux or Rocky Linux

If you haven’t up to date your system for fairly some time then run the system replace command as soon as earlier than going by the information additional. This helps the DNF to rebuild the bundle index cache and install if any newest bundle replace is offered.

sudo dnf replace

2: Use Yum or DNF to install Golang

The packages we have to install the Go programming language can be found by the default repository of AlmaLinux or Rocky Linux. Hence, we are able to use the system’s default DNF bundle supervisor to install it. But the model of the Golang is not going to be the newest one. For instance, whereas penning this tutorial the newest model was 1.20 and the one accessible by Yum or DNF was 1.18.

So, those that are on the lookout for the newest model can try the #Method-2 given on this article.

sudo dnf install golang


sudo yum install golang
Use Yum or DNF to install Golang

#2nd Method for the newest model

4. Download the Go Package

Golang presents precompiled binaries for Linux distributions like AlmaLinux, Ubuntu, RHEL, and so forth. To obtain the bundle.

  1. First, go to the Golang web site to obtain Go
  2. Find the Tar file given for Linux.
  3. Click on it.
  4. A pop-up will seem to save the file.
Download the Go Package for Linux

First change to the Downloads listing as a result of by default browser saves all of the recordsdata in it.

cd Downloads

Create your individual workspace listing wherever handy similar to your property listing or use the ‘/usr/local’. Here we’re utilizing the latter one.

sudo tar -xzf go*.linux-amd64.tar.gz -C /usr/native

Now, if you would like can delete the downloaded file to free area utilizing:

sudo rm go*.linux-amd64.tar.gz

6. Add Golang to your System Path

As we have now manually downloaded and extracted the Go, our system is not going to know what to run after we use this programming language’s command software. Therefore, configure the system surroundings for it by including its folder usr/native/go/bin to your path.

sudo dnf install nano -y
sudo nano ~/.bashrc

Scroll to the top of the file and add the next line:

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

Save the file by urgent Ctrl+X, kind Y, after which hit the Enter key.

Add Go to your System Path

7. Save and Reload Bash Configuration File

Now reload your configuration file utilizing the supply command, it would make your present session acknowledge the added path and let entry the Go command line software.

supply ~/.bashrc

8. Check Version

To affirm the set up we have now carried out is profitable with none error, run

go model

To see all of the accessible choices we are able to use:

go --help
Check Golang Version

9. Write a Go program to check it

To get conversant in the programming language, let’s create a easy whats up program to understand how Golang works.

nano whats up.go

Add the next strains

bundle primary 
import "fmt" 
func primary () {
fmt.Printf( "hello worldn" )

Save the file utilizing Ctrl+X, Y, and hit the Enter key.

Explanation: bundle primary – Tells the Go compiler that the file ought to compile as an executable program. Whereas import inform the system to import “fmt” from the Go library for printf operate.

Compile this system:

go whats up.go

10. Run the executable file.

After compilation, an executable file will seem in the identical listing. We can execute that to see the output:

./whats up

To apply additional, you need to use the Golang on-line editor or study extra from the documentation.



After following all the above steps your system might be prepared to put in writing Go code on Almalinux or Rocky Linux. Learn further- How to create, compile & run a C Program in a Linux terminal

Related hyperlinks:

The Right Way to Install Arpwatch on AlmaLinux or Rocky Linux 8/9

Previous article

The Right Way to Install Docker on AlmaLinux 8

Next article

You may also like


Leave a Reply

More in Almalinux