Atlantic.Net Blog

How to Install Golang on Arch Linux

Go, also known as Golang or Go language, is an open-source programming language developed by Google. It is a high-level language used for developing web applications, cloud, and networking services. Compared to other programming languages, Golang runs faster, compiles quicker, is easy to maintain and support, and allows for shorter software development lifecycles.

In this post, we will show you how to install Golang on Arch Linux.

Step 1 – Configure Repository

By default, the default repository is outdated in Arch Linux, so you will need to modify the default mirror list. You can do it by editing the mirror list configuration file:

nano  /etc/pacman.d/mirrorlist

Remove all lines and add the following lines:

## Score: 0.7, United States
Server =$repo/os/$arch
## Score: 0.8, United States
Server =$repo/os/$arch
Server =$repo/os/$arch
## Score: 0.9, United Kingdom
Server =$repo/os/$arch
## Score: 1.5, United Kingdom
Server =$repo/os/$arch
Server =$repo/os/$arch
## Score: 6.6, United States
Server =$repo/os/$arch
## Score: 6.7, United States
Server =$repo/os/$arch
## Score: 6.8, United States
Server =$repo/os/$arch
## Score: 7.1, India
Server =$repo/os/$arch
## Score: 10.1, United States
Server =$repo/os/$arch

Save and close the file then update all the package index with the following command:

pacman -Syu

Step 2 – Install Golang

First, visit the Golang official website, pick the latest version of Golang, and download it with the following command.


Once the download is completed, extract the downloaded file with the following command.

tar -C /usr/local -xzf go1.20.1.linux-amd64.tar.gz

You can verify the content of the extracted file with the following command.

ls /usr/local/go

You should see the following output.

api	 bin  doc  LICENSE	PATENTS    src   VERSION
AUTHORS  codereview.cfg  CONTRIBUTORS	  lib  misc	pkg  test

Step 3 – Create Golang Environment Variable

Next, you will need to create or edit the .bashrc file and define your Golang installation path.

nano ~/.bashrc

Add the following line:

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

Save and close the file, then activate the environment variable with the following command.

source ~/.bashrc

You can now verify the Go version with the following command.

go version

You should see the Go version in the following output.

go version go1.18.1 linux/amd64

Step 4 – Create a Project with Golang

First, create a project directory for Golang using the following command.

mkdir project

Next, navigate to the project directory and initialize the project with the following command.

cd project
go mod init

Next, create a hello application file with the following command.

nano hello.go

Add the following code.

package main

import "fmt"

func main() {
    fmt.Println("Hello, Go is working")

Save and close the file, then run the Go application using the following command.

go run hello.go

If everything is fine, you should see the following output.

Hello, Go is working


In this post, we showed you how to install Golang on Arch Linux. We also created a sample project with Golang. You can now start developing cloud and web applications using Golang. Deploy the Go application on a dedicated server hosting plan from Atlantic.Net!

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year