How To Install Go on Ubuntu 20.04 Focal Fossa Linux

The objective of this guide is to install Go/Golang on Ubuntu 20.04 Focal Fossa Linux. Go also know as Golang, is an open source programming language developed by Google.

In this tutorial you will learn:

  • How to install Go / Golang
  • How to download example hello world application
  • How to run example hello world application

 Go on Ubuntu 20.04 Focal Fossa Linux

Go on Ubuntu 20.04 Focal Fossa Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa
Software Golang
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How To Install Go on Ubuntu 20.04 step by step instructions



  1. From a terminal execute the following command to install Go language executables:
    $ sudo apt install golang
    
  2. Confirm the installation by checking for the go version:
    $ go version
    
  3. Download Golang hello world example:
    $ go get github.com/golang/example/hello
    

    After execution of the above command a new directory named go will be created in your user home directory containing a source code and executable binary of the Hello World Golang program.

    Given that the new go directory is located within you user home directory, to execute the hello program run:

    $ ~/go/bin/hello
    Hello, Go examples!