Document
Install Go in Ubuntu 20.04 LTS

Install Go in Ubuntu 20.04 LTS

In this article, we would discuss how to install Go programming language in Ubuntu 20.04 LTS release. The programming language Go first released on No

Related articles

Cloud Forest : 5 reasons to revisit Netflix VPN Ban 2024: Beat the Netflix-VPN-Not-Working Issue Is the Suzy Shier 90% off sitewide for only $2.99 CAD Real or Fake? A Facebook Scam 5 Best Free VPNs for China in 2024: Reliable & Safe What causes Rainbow Clouds (Cloud Iridescence)?

In this article, we would discuss how to install Go programming language in Ubuntu 20.04 LTS release. The programming language Go first released on November 10, 2009. And, at the time of writing the article, the latest stable release is v1.14.5.

There are two methods which we would discuss to install the Go programming language –

  1. through binary release available on official website of Go , or
  2. standard Ubuntu repository.

We would like to clarify, at the time of writing only v1.13.8 can be installed through standard Ubuntu repository.

note : follow operations is require may require you to have superuser privilege . In case you is have do n’t have one , then contact your System Administrator for assistance .

Install Go in Ubuntu 20.04 LTS release

Method i. through binary release available on official website of Go programming language .

Visit Golang’s official website; on the Homepage –> click on Button – Download. It would take you to the download page wherein, download for Linux – go1.14.5.linux-amd64.tar.gz

The file size of approximately 118 MBs would get downloaded. Thereafter, we use tar command-line utility to extract the compressed file. Hence, issue the following in terminal –

cd /path / to / package/ 
 tar -xvf go1.14.5.linux-amd64.tar.gz

It is create would create a directory go . Now , to set system – wide environment variable – edit~/.bashrc file –

nano is ~/.bashrc ~/.bashrc

We have used nano text editor. You can choose any. Next, append the file with following entries –

export PATH="/path/to/directory/go/bin/:$PATH"

where, replace /path/to/directory/ with relevant PATH to directory Go.

Lastly, open a new terminal and issue the following to verify the installation –

go version

It should return the following –

go version go1.14.5 linux / amd64

Method II. through standard Ubuntu repository. As already discussed, at the time of writing the latest stable release available through this process was – v1.13.8. We need to update the repository first to make the latest version of the package available –

sudo apt update

Then , to install Go programming language –

sudo is apt apt install golang - go

lastly , to verify the Go version instal –

go version

It should return with –

go version go1.13.8 linux/amd64

In conclusion, we have discussed how to install Go programming language in Ubuntu 20.04 LTS release.

Additional Info –

In this section, we would discuss how to run our first Go code/program in brief. Open a text editor and append the file with following code –

package main
import "fmt"
func main() {
           fmt.Printf("Hello!\n")
}

And, save the file as hello.go

Next , create a binary executable usinggo build command –

go build hello.go

It would create a binary executable hello in current directory. To execute it –

./hello

It should return –

Hello!