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 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 Scala in Linux? Prerequisite: Introduction to Scala Before, we start with the process of Installing Scala on our System. We must have first-hand knowledge of What the Scala Language is and what it actually does? Scala is a general-purpose, high-level, multi-paradigm programming language. It is a pure object-oriente
3 min read
How to Install Go in Alpine Linux? Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write microservices, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time
1 min read
How to Install PyGObject in Linux? PyGObject is a Python extension module that will deliver you clean and consistent access to the complete GNOME software platform with the use of GObject Introspection. PyGObject will deliver full support of GObject Introspection and all of its features (callbacks, GVariant support, closures, sub-cla
2 min read
How to Install LISP on Linux? LISP (List programming) is the second-oldest high-level programming language after Fortran. It has a fully parenthesized prefix notation. Installing LISP on Linux:Follow the below steps to install LISP on Linux: Step 1: Install SBCL compiler. Steel Bank Common Lisp (SBCL) is the most common Lisp com
1 min read
How To Install "git-gui" on Linux? Git is a FOSS (Free and Open Source Software) that is used for version control of any set of files, typically, the source code of software projects. Git is a version control system for recording changes in any group of files. During software development, it's generally used to coordinate work among
2 min read