How to install go1.19beta on Ubuntu 22.04

In this tutorial, we are going to explore how to install go on Ubuntu 22.04

Golang is an open-source programming language that is easy to learn and use. It is built-in concurrency and has a robust standard library. It is reliable, builds fast, and efficient software that scales fast.

Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel-type systems enable flexible and modular program constructions.

Go compiles quickly to machine code and has the convenience of garbage collection and the power of run-time reflection.

In this guide, we are going to learn how to install golang 1.19beta on Ubuntu 22.04.

Go 1.19beta1 is not yet released. There is so much work in progress with all the documentation.

Related Articles

Installing Go 1.19beta on Ubuntu 22.04

1. Run system updates

To begin with, we need to run system updates in order to make our current repositories up to date. To do so we need to run the following command on our terminal.

sudo apt update && apt upgrade -y

When both upgrades and updates are complete, go ahead to download go from its download page.

2. Installing Go

To install go we need to download it from go download page. we are going to download the beta release. We are going to use the curl command to download.

$ wget

when the download is complete, extract the archive downloaded to your desired location. I will be using /usr/local directory.

sudo tar -C /usr/local -xzf go1.19beta1.linux-amd64.tar.gz

After extraction is complete move ahead and set up the go environment.

3. Setting Go Environment

To set up go environment we need to define the root of golang packages. We normally use GOROOT and GOPATH to define that environment. We need to set up the GOROOT location where the packages are installed.

export GOROOT=/usr/local/go

Next, we will need to set up the GOPATH. Let’s set up GOPATH in the $HOME/go directory.

export GOPATH=$HOME/go

Now we need to append the go binary PATH so that we can be able to access the program system-wide. Use the following command.

export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

To apply the changes we have made above, run the following command:

source ~/.bashrc

Lastly, we can do the verification with the following;

$ go version
go version go1.19beta1 linux/amd64

Let’s create a program to check all our settings. We will create a simple one.

Create a file main.go on the main directory.

touch main.go

On your favorite text editor do the following

sudo nano main.go

Insert the below code

$ package main

import "fmt"

func main(){
	fmt.Println("This is go1.19beta1 on Ubuntu 22.04")

To run the program use the following command;

$ go run main.go
This is go1.19beta1 on Ubuntu 22.04


Now you know how to install golang 1.19beta in Ubuntu 22.04. You can consult the go documentation in case you have any problems.

About Kipkoech Sang

I am a technology enthusiast who loves to share gained knowledge through offering daily tips as a way of empowering others. I am fan of Linux and all other things open source.
View all posts by Kipkoech Sang →

Leave a Reply

Your email address will not be published.