Home  »  How ToLibrariesProgrammingSoftwareTechnologyTools   »   How to Install GO(Golang) on Rocky Linux 8.10 Systems

How to Install GO(Golang) on Rocky Linux 8.10 Systems

Go, also known as Golang, is a statically typed, compiled programming language designed by Google. It is known for its simplicity, efficiency, and strong concurrency capabilities. This guide will walk you through the steps to install Go on your Rocky Linux 8.10 system.


Before you begin, ensure you have:

  • A running Rocky Linux 8.10 system
  • A user account with sudo privileges
  • Internet access to download the Go binary

Step 1: Update Your System

Start by updating your system to ensure all existing packages are up to date.

$ sudo dnf update -y

Step 2: Download the Go Binary

Visit the official Go downloads page to find the latest version of Go. At the time of writing, the latest version is 1.18. Download the Go tarball using wget.

$ wget https://golang.org/dl/go1.18.linux-amd64.tar.gz

Step 3: Extract the Archive

Extract the downloaded tarball to the /usr/local directory.

$ sudo tar -C /usr/local -xzf go1.18.linux-amd64.tar.gz

This command installs Go in the /usr/local/go directory.

Step 4: Set Up Go Environment

Next, you need to set up the Go environment variables. Add the following lines to your shell profile file (~/.bashrc, ~/.zshrc, etc.) to set up the Go environment variables.

$ echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
$ source ~/.bashrc

This adds Go’s binary directory to your system’s PATH, enabling you to run Go commands from any terminal session.

Step 5: Verify the Installation

To verify that Go is installed correctly, check its version.

$ go version

You should see output similar to:

$ go version go1.18 linux/amd64

Step 6: Create a Go Workspace

Go encourages a specific workspace structure. By default, your Go workspace should be in your home directory. Create a directory named go and subdirectories for your Go projects.

$ mkdir -p ~/go/{bin,src,pkg}
  • src: contains your Go source files
  • pkg: contains package objects
  • bin: contains executable commands

Step 7: Write a Simple Go Program

Create a new directory for your first Go project and write a simple Go program.

$ mkdir -p ~/go/src/hello
$ nano ~/go/src/hello/hello.go

Add the following content to hello.go:

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")

Save and exit the text editor.

Step 8: Build and Run the Go Program

Navigate to your project directory and use the go run command to build and run your program.

$ cd ~/go/src/hello
$ go run hello.go

You should see the output:

Hello, World!


You have successfully installed Go on your Rocky Linux 8.10 system. You can now start developing your applications in Go, taking advantage of its powerful features and efficient performance. For more information on using Go, refer to the official Go documentation.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.