Knowledge Base
Tutorials
Tutorials
  • How to install Joomla 4.2.2 on Ubuntu 20.04?
  • How to set and execute environment and shell variables in Linux?
  • How to employ Docker containers?
  • How to access PostgreSQL Image?
  • How to add and delete users on Ubuntu 20.04?
  • How to add swap space on Ubuntu 20.04?
  • How to back up, restore, and migrate a MongoDB database on Ubuntu 20.04?
  • How to configure additional SSH keys to your public cloud instance?
  • How to configure static IP on Ubuntu?
  • How to create a CLI with Python Fire on Ubuntu 22.04?
  • How to create a new user and manage permissions in MySQL?
  • How to create an instance with Terraform?
  • How to import and export a MongoDB database on Ubuntu 20.04?
  • How to install 7zip on Ubuntu 20.04?
  • How to install AIDE on Ubuntu 22.04?
  • How to install Anaconda on Ubuntu 20.04?
  • How to install and use Docker on Ubuntu 20.04?
  • How to install and use Elinks on Ubuntu 20.04?
  • How to install and use PostgreSQL on Ubuntu 20.04?
  • How to install Android Studio on Ubuntu 22.04?
  • How to install Angular on Ubuntu 20.04?
  • How to install Ansible on Ubuntu 20.04?
  • How to install Apache Kafka on Ubuntu 20.04?
  • How to install Apache Maven on Ubuntu 20.04?
  • How to install Asterisk on Ubuntu 20.04?
  • How to install Atom Text Editor on Ubuntu 20.04?
  • How to install Blender on Ubuntu?
  • How to install CFEngine3 on Ubuntu 20.04?
  • How to install Code::Blocks on Ubuntu 20.04?
  • How to install Composer on Ubuntu 22.04?
  • How to install Curl on Ubuntu 20.04?
  • How to install Desktop GUI on Ubuntu 20.04?
  • How to install Discord on Ubuntu 22.04?
  • How to install Django on Ubuntu 20.04?
  • How to install Docker Compose on Ubuntu 20.04?
  • How to install ELK on Debian 10 or Debian 11?
  • How to install Fail2ban on Debian 10?
  • How to install FFmpeg on Ubuntu 20.04?
  • How to install Flask on Ubuntu 20.04?
  • How to install Fish Shell in Ubuntu 20.04?
  • How to install Gedit on Ubuntu 20.04?
  • How to install Git on Ubuntu 20.04?
  • How to install Gitea on Ubuntu 20.04?
  • How to install Gitlab on Ubuntu 20.04?
  • How to install Go on Ubuntu 20.04?
  • How to install Google Chrome on Ubuntu 20.04?
  • How to install Gradle on Debian 10?
  • How to install Gradle on Ubuntu 20.04?
  • How to install Grafana on Ubuntu 20.04?
  • How to install Hadoop on Ubuntu 20.04?
  • How to install Homebrew on Linux?
  • How to install JAVA with APT on Ubuntu 20.04?
  • How to install Julia on Ubuntu 20.04?
  • How to install Jupyter on an Ubuntu Linux VM?
  • How to install Kdenlive on Ubuntu 20.04?
  • How to install Logwatch on Ubuntu 20.04?
  • How to install MariaDB on Ubuntu 22.04?
  • How to install Memcached on Debian 10?
  • How to install Microsoft Edge Browser on Ubuntu 22.04?
  • How to install MongoDB on CentOS 7?
  • How to install MongoDB on Linux?
  • How to install Mono on Debian 10?
  • How to Install Mono on Ubuntu 20.04?
  • How to install Mozilla Firefox on Ubuntu 20.04?
  • How to install MySQL on Ubuntu 22.04?
  • How to install Nagios on Ubuntu 20.04?
  • How to install Nginx on CentOS 8?
  • How to install Nginx on Ubuntu 22.04?
  • How to install Node.js on Ubuntu 22.04?
  • How to install NVIDIA CUDA on Ubuntu 20.04?
  • How to install Nvidia Optimus Driver on Ubuntu 22.04?
  • How to install OpenCV on Ubuntu 20.04?
  • How to install Perl on Ubuntu on 22.04?
  • How to install Pacman on Ubuntu 20.04?
  • How to install phpMyAdmin on Ubuntu 20.04?
  • How to install PIP on CentOS 8?
  • How to install Plex media server on Ubuntu 20.04?
  • How to install Podman on Ubuntu 20.04?
  • How to install Poetry on Ubuntu 22.04?
  • How to install Postman on Ubuntu 20.04?
  • How to install ProcessWire on Ubuntu 20.04?
  • How to install PyQuery package on Ubuntu 20.04?
  • How to install Python 3 on Ubuntu 22.04 and set up a programming environment?
  • How to install Python on Windows 10 using UI and Windows command prompt?
  • How to install R on Ubuntu 20.04?
  • How to install Ruby on Rails on Ubuntu 20.04?
  • How to install Ruby on Ubuntu 20.04 and setup programming environment?
  • How to install Rust on Ubuntu 22.04?
  • How to install Samba on Ubuntu 20.04?
  • How to install Skype on Ubuntu 20.04?
  • How to install Rancher on Ubuntu 20.04?
  • How to install Slack on Ubuntu 20.04?
  • How to install Springboot on Ubuntu 20.04?
  • How to install Spyder IDE in Ubuntu?
  • How to install Steam on Ubuntu 20.04?
  • How to install Strapi for Production on Ubuntu 20.04?
  • How to install TeamViewer on Ubuntu 20.04?
  • How to install TensorFlow on Ubuntu 20.04?
  • How to install Apache Web Server on Ubuntu 20.04?
  • How to install the Deno JavaScript Runtime on Ubuntu 20.04?
  • How to install Open LiteSpeed Web Server on Ubuntu 22.04?
  • How to install Sublime Text Editor on Ubuntu 20.04?
  • How to install tix package on Ubuntu 20.04?
  • How to install Vagrant on Ubuntu 20.04?
  • How to install Vim on Ubuntu 20.04?
  • How to install VirtualBox on Ubuntu 20.04?
  • How to install VLC Media Player on Ubuntu 20.04?
  • How to install VMware Workstation Player on Ubuntu 20.04?
  • How to install vscode on Ubuntu 20.04?
  • How to install Webmin on Ubuntu 20.04?
  • How to install Wine on Ubuntu 20.04?
  • How to install WordPress on Ubuntu 20.04?
  • How to install Xibo on Ubuntu 20.04?
  • How to install Zoom on Ubuntu 20.04?
  • How to install Yarn on Ubuntu 20.04?
  • How to keep Ubuntu 22.04 servers updated?
  • How to monitor system authentication logs on Ubuntu 20.04?
  • How to perform basic administration tasks for Storage Devices in Linux?
  • How to set up Jenkins on Ubuntu 20.04?
  • How to setup OpenVPN on Ubuntu 20.04?
  • How to setup time synchronization on Ubuntu 20.04?
  • How to setup a UFW on an Ubuntu or Debian Cloud Server?
  • How to setup SSH keys in Ubuntu 20.04?
  • How to SSH terminal through MobaXterm and PuTTY in Windows?
  • How to Use Ansible to Install and Set Up Docker on Ubuntu 20.04?
  • How to view system users on Ubuntu 20.04?
  • How to make OpenStack accessible through CLI?
  • How to make Block Storage available for Linux?
  • Script for automated incremental backups
  • How to configure a Git repository using Linux CLI?
  • How to enable remote access on MySQL?
  • How to Mount a S3 Bucket on Linux Instance?
  • How to access MySQL database credentials?
  • How to create an incremental backup using CLI?
  • How to set up web-based SQL server on OpenStack instance using SQL image?
Powered by GitBook
On this page
  • Overview
  • Prerequisites
  • Get Started
  • Conclusion

Was this helpful?

How to install Go on Ubuntu 20.04?

PreviousHow to install Gitlab on Ubuntu 20.04?NextHow to install Google Chrome on Ubuntu 20.04?

Last updated 1 year ago

Was this helpful?

Overview

Go, also known as Golang, is an open-source language designed for efficient and reliable system programming, making it a popular choice for developing high performance software applications. Go's integrated concurrency support, which enables programmers to create effective and scalable concurrent programmes without the use of other libraries or frameworks, is one of its core characteristics. Overall, it is a versatile and powerful language that is well suited for building a variety of applications, including network services, web applications, and more.

Here is a step-by-step tutorial on how to install Go on Ubuntu 20.04 using source code.

Prerequisites

There are certain prerequisites that need to be met before you begin.

  • Ubuntu 20.04 LTS configured on your system.

  • Non-root sudo user privileges.

Get Started

Step 1: Installation

  • Check to see if you are in the home directory:

cd ~
  • Execute curl to fetch the tarball:

curl -OL https://go.dev/dl/go1.20.1.linux-amd64.tar.gz

Note: Since this link was copied from the Go website and will reroute here in the home directory before the file download begins:

  • The -O flag guarantees that this outputs to a file,

  • The L flag prompts HTTPS redirects.

  • Use the sha256sum command with the filename as a parameter to check the file's integrity after it is downloaded:

sha256sum go1.20.1.linux-amd64.tar.gz

The output will display the SHA256 checksum of the tarball.

Note: You can verify the checksum by matching it with the one provided on the downloads page. If they match, then this step is accomplished.

  • Retrieve the tarball:

sudo tar -C /usr/local -xvf go1.20.1.linux-amd64.tar.gz

The parameters of the above command are:

  • The -C instructs tar to change to the specified directory before performing additional tasks.

  • Go should be installed in the /usr/local/ directory.

  • The x flag tells tar to extract.

  • The v flag instructs tar to produce verbose output containing a list of extracted files.

  • The f flag tells tar to output a filename.

Step 2: Path Setup

Set Go's root value first so it knows where to seek for its files. This can be accomplished by altering the commands listed in the .profile file, which is executed by the system upon each log-in.

  • Open the .profile file located in your user's home directory:

sudo nano ~/.profile
  • At the end of the .profile file, add the Go binary path:

export PATH=$PATH:/usr/local/go/bin

Press CTRL + X to save and close the file.

  • Once the file is closed, update your profile:

source ~/.profile
  • Print the version of go to verify if you can run the Go commands:

go version

The output will display the version of Go that you just installed on your system using the tarball:

Step 3: Testing

Now, that the installation of Go and its path setup have been successful, you can begin testing the functioning of Go.

  • Make a new directory for Go to build its files:

mkdir file

Note: Here, we have created a directory with the name "file". You can name your directory according to your project.

  • Enter into the directory:

cd file
  • Open the nano text editor:

nano file.go
  • Write the following 'Hello, World!' program in the editor:

package main
 
import "fmt"
 
func main() {
    fmt.Println("Hello, World!")
}
  • Compile and run your code with the go run command:

go run file.go

The output will display as:

Conclusion

You now have a system to utilize for Go programming after downloading, installing, and establishing its paths.

The most recent version of Go is go1.20.1. Visit , copy the URL of the file that ends in "linux-amd64.tar.gz" and ensure to replace the URL in the command.

Note: Ensure to replace the URL in the command with the one you obtained from

Go's official documentation of featured versions.
Go's official documentation of featured versions.