Table of Contents
Was this article helpful?

3  out of  6 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles.

Install the Latest Version of Golang on Ubuntu

Last Updated: Thu, Dec 3, 2020
Golang Programming Ubuntu


Go, or Golang is an open-source language developed by Google to create simple, reliable, and efficient software. This tutorial explains how to install Golang on a Vultr Ubuntu cloud server instance.


This guide is tested on a new Vultr Ubuntu 20.04 LTS cloud server instance, and works on any version of Ubuntu. Follow our best practice guides before installing Golang.

1. Download Golang

Because the Golang package is not always up to date in the Ubuntu repository, it's preferred to download the official website's latest version.

Change to a temporary directory for the installation.

$ cd /tmp

Select the latest package for your architecture from and download it.

$ wget<VERSION_NUMBER>.linux-amd64.tar.gz

2. Extract to the Installation Location

Extract the Golang executable to /usr/local.

$ sudo tar -C /usr/local -xzf go1.<VERSION_NUMBER>.linux-amd64.tar.gz

3. Set Environment

To use Golang, set the required environment variables in your .profile.

$ echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile

$ echo "export GOPATH=~/.go" >> ~/.profile

Reload your profile to begin using Golang.

$ source ~/.profile

4. Test the Installation

Verify you installed the expected version of Golang.

$ go version

# go version go1.<VERSION_NUMBER> linux/amd64

5. Hello World

  1. Create a Hello World program to test your environment.

    $ nano helloworld.go
  2. Paste the following in helloworld.go.

    package main
    import (
    func main() {
        fmt.Println("Hello world!")
  3. Save the file and exit the Nano editor.

  4. Run the program.

    $ go run helloworld.go
    # Hello world!


You have installed Golang. See more information at

Want to contribute?

You could earn up to $600 by adding new articles.