How to Install Go on Debian 10

Install Go on Debian 10

In this article, we will have explained the necessary steps to install and configure Go Lang on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Go Lang is an open source programming language developed by a team of Google engineers in 2007. Go language was designed to resolve the common criticisms of other languages while maintaining their positive characteristics and most widely used for writing servers these days.

Install Go on Debian

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade

Step 2. Install Go on Debian 10.

Download the Go tarball using the following command:


Verify the downloaded file using the sha256sum command:

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

Now extract the downloaded tarball using following command inside /usr/local directory:

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

Step 3. Set Go Path.

Next, edit the $PATH environment variable so that the system knows where the Go executable binaries are located. You can do this either by appending the following line to the /etc/profile file (for a system-wide installation) or to the $HOME/.profile file:

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

Save the file, and apply the new PATH environment variable to the current shell session by typing:

source ~/.profile

To verify that everything is working, run go version and see if the version is returned:

$ go version
go version go1.13 linux/amd64

Check the Go environment variables we set in previous sections:

$ go env

Step 4. Build Hello world Program in Go.

First, Create a new directory for go workspace by using following command:

mkdir $HOME/work

Now create src directory inside it typing below command:

mkdir -p $HOME/work/src/hello

Next create hello.go file inside src/hello directory using below command:

sudo nano ~/work/src/hello/hello.go

Add following content:

package main

import "fmt"

func main() {
    fmt.Printf("Hello, World\n")

Now go to the:

cd ~/work/src/hello

And build the program using typing:


The output should look like this:

Hello, World

Congratulation, you have learned how to install and configure Go Lang is an open source programming language on Debian 10 Buster. If you have any question, please leave a comment below.