Introduction
Go, or Golang, is a relatively new, open-source language created by Google. The purpose of Go is to streamline software development, enabling users to create simple and reliable apps.
As a modern language, Go offers memory allocation, concurrency support, garbage collection, coordination avoidance, etc.
In this article, you will learn how to install Go on Debian in a few simple steps.
Prerequisites
How to Install Go on Debian 11?
Before starting the installation, ensure the Debian server is up to date. Update the repository and upgrade packages with the following:
sudo apt update && sudo apt -y
Step 1: Download Go
To start the installation process:
1. Visit the Go downloads page.
2. Click the Linux box under Featured downloads to start the download.
3. Save the file in case the download does not start automatically.
Step 2: Extract Files
Extract files to the /usr/local directory. To accomplish that, navigate to Downloads via the terminal and run:
sudo tar -C /usr/local -xzf go1.19.2.linux-amd64.tar.gz
The command doesn't print any output. However, tar extracts the specified file (go1.19.2.linux-amd64.tar.gz) to the desired directory.
Step 3: Set the Environment
To set the environment variable, add /usr/local/go/bin to PATH.
Take the following steps:
1. Access .profile in Vim or another text editor.
2. At the end of the file, paste the following line:
export PATH=$PATH:/usr/local/go/bin
Note: To install Go system-wide, edit /etc/profile. To install it for the current user, access $HOME/.profile.
Step 4: Verify the Installation
To confirm Go is installed on the machine, run go version
:
The output shows that the system includes a go1.19.2 version of Go, confirming a successful installation.
Conclusion
This tutorial explains how to install Go on Debian and how to verify the instsallation.
Next, read about the best Linux text editors for coding.