How To Install Go on Ubuntu 22.04 Jammy Jellyfish Linux

The objective of this tutorial is to install Go/Golang on Ubuntu 22.04 Jammy Jellyfish Linux. Go also know as Golang, is an open source programming language developed by Google.

Installing Go on Ubuntu 22.04 will allow you to write and compile programs in the Go language, as you will see in an example Hello World script in this tutorial.

In this tutorial you will learn:

  • How to install Go / Golang
  • How to check Go version number
  • How to run example hello world application
Using Go on Ubuntu 22.04 Jammy Jellyfish Linux
Using Go on Ubuntu 22.04 Jammy Jellyfish Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu 22.04 Jammy Jellyfish
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 22.04 step by step instructions



  1. In order to install Go on Ubuntu 22.04, we will start by opening a command line terminal and executing the following apt commands to install Go language executables.
    $ sudo apt update
    $ sudo apt install golang
    
  2. Confirm the installation by checking for the go version:
    $ go version
    
  3. Next, let’s try running a Hello World script. Copy and paste the following code into a file called hello.go.
    package main
    
    import "fmt"
    
    func main() {
        fmt.Println("hello world")
    }
    
  4. Then, execute the Hello World program with the following command.
    $ go run hello.go 
    hello world
    

    You should get the “hello world” output as long as Go has been properly installed on your Ubuntu 22.04 system.

Closing Thoughts




In this tutorial, we saw how to install Go (or Golang as it is sometimes called) on Ubuntu 22.04 Jammy Jellyfish Linux. This will allow you to compile and execute Go programs on your system. The Go programming language is quickly sweeping the tech world and is a must-have for developers and programmers.