How to Install Go Programming Language in Linux?
Last Updated :
06 Oct, 2021
In this article, we will discuss how to install GoLang (Go Programming Language) in Linux. But at first let's know a brief about GoLang.
GoLang is a procedural programming language. It was developed in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson at Google but launched in 2009 as an open-source programming language. Programs are assembled using packages, for efficient management of dependencies. This language also supports the environment adopting patterns alike to dynamic languages.
Download Go Latest Stable Version
Download GoLang using this link and choose the latest version of GoLang in an archive and install using the below command:
$ sudo wget https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
Download GoLang using the wget command
Verify the downloaded tarball version by verifying the SHA256 checksum of the downloaded file using the command below :
$ sha256sum go1.16.5.linux-amd64.tar.gz
Extract the 'go1.16.5.linux-amd64.tar.gz' Go tarball file to the '/usr/local' directory next.
$ sudo tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
In the /usr/local directory, you'll find a directory called go. Change the owner and group of this directory to root recursively:
$ sudo chown -R root:root /usr/local/go

Configure System Environment for Go
To construct the directory structure for your Go workspace, run the following command:
$ mkdir -p $HOME/go/{bin,src}
By adding global variables to your /.profile, you can set your $GOPATH. To begin, open /.profile in nano or another text editor:
$ nano ~/.profile
Now Append the following lines then save and close:
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOPATH/bin:/usr/local/go/bin
To load the global variables, run the following command to update your shell:
$ . ~/.profile
Using the echo command and analyzing the result, you can check that your $PATH has been updated:
$ echo $PATH
Verify the installation by looking at the current Go version:
$ go version

Verify GoLang Installation
Write a simple Go Hello World program to see if your Go installation is operating properly. Create a new file called hello.go then save and close:
$ nano hello.go
Now compile and run the go program:
$ go run hello.go
Similar Reads
How to Install Go Language in Manjaro Linux? Manjaro is a free open-source Linux distribution based on the Arch Linux operating system. Its features include a highly customizable GUI with a powerful command-line user interface. Golang is a procedural and statically typed programming language similar to the C programming language. It provides a
1 min read
How to install Ruby Programming Language on Manjaro Linux? Ruby is an open-source, dynamic, cross-platform, object-oriented, general-purpose programming language. It was developed by Yukihiro Matsumoto in the mid-1990s in Japan. Everything in Ruby is an object except the blocks but there are replacements for those as well, i.e procs and lambda. The language
1 min read
How to install Ruby Programming Language on Godaddy Server? GoDaddy VPS is a shared server that provides computational services, databases, storage space, automated weekly backups, 99% uptime, and much more. Itâs a cheaper alternative to some other popular cloud-based services such as AWS, GPC, and Azure. Ruby is an open-source, dynamic, cross-platform, obje
2 min read
How to Download and Install R Programming Language On Mac? In the world of data science, statistical analysis, and visualization, R programming language stands out as a powerful tool. Installing R on your Mac opens up a world of possibilities for data manipulation and exploration. This guide will walk you through the process of downloading and installing R
3 min read
How to Install GNU Octave in Linux? Octave is open-source, free available for many of the platforms. It is actually a High-level Language. It comes up with a text interface along with an experimental graphical interface. It is also used for various Machine Learning algorithms for solving various numeric problems. You can say that it i
2 min read
How to Install python-gadfly in Linux? In this article, we will be looking at the stepwise procedure to install the python-gadfly for Python in Linux. Gadfly is a relational database management system written in Python. Gadfly is a collection of Python modules that provides relational database functionality entirely implemented in Python
2 min read
How to Install Kotlin on Linux? Kotlin is a programming language introduced by JetBrains in 2011, the official designer of the most intelligent Java IDE, named Intellij IDEA. This is a strongly statically typed general-purpose programming language that runs on JVM. In 2017, Kotlin is sponsored by Google, announced as one of the of
2 min read
How to Install Lightgbm on Linux? Lightgbm is an acronym for Light Gradient Boosting Machine. It is a machine learning framework based on decision tree algorithms. It is an open-source and free distributed gradient boosted model library. It is used for classification and other machine learning tasks. It is built by Microsoft Corpora
2 min read
How to install GIMP on Linux? GIMP is a free and open-source raster graphics editor used for image manipulation and image editing, free-form drawing, transcoding between different image file formats, and more specialized tasks. It is not designed to be used for drawing, though some artists and creators have used it for such. In
2 min read
How to Install OpenJDK in Linux If you have started Java learning, you must have the Java Development Kit (JDK) installed on your system. OpenJDK is a free and open-source version of Java that provides everything you need to develop and run Java applications. Itâs a popular choice for developers because itâs easy to install and wo
4 min read