How to Install Go on Debian 11

Go or Golang is a Google-designed high-level programming language. The syntax of golang is almost the same as C programming language but with better features such as structural typing, memory collection and garbage collection. Also, Go is well supported on all kinds of OSes, Windows, Linux and MacOS.

In this article, we will show you different ways to install Go on Debian.

How to Install Go on Debian 11?

There are three methods to install Go on Debian which are as follows:

Method 1: By Using “apt” Command

The first method to install Go is by using the apt command, which is used in Linux based systems such as; Debian to install different packages from the official repository. However, before that, update your Debian 11 repository by running the below-mentioned command:

sudo apt update

Then install Go by using the below-written apt command:

sudo apt install golang

To verify the installation of Go, run the below-written command:

go version

Remove Go from Debian

To remove an installed Go package from Debian, use the below-mentioned “apt remove” command:

sudo apt remove golang

Method 2: By Using the .tar file

Another method through which the updated version of Go can be installed is by using the .tar file, which can be downloaded by using the below-mentioned command:


Now extract the downloaded tar file and copy the content in the “/usr/local” location by running the following command:

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

Then by using nano editor, open the etc/profile file:

sudo nano /etc/profile

Scroll to the bottom of the file and add the below-mentioned text to give path of Go:

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

Once done, save the file by pressing Ctrl+X.

Finally reload the profile using the following command so that new changes can be updated on Debian.

source .profile

Now, run the version command to confirm the installation of Go latest version on Debian.

go version

Note: Reboot the device if the go command isn’t working.

Remove Go from Debian

To remove Go installed through tar.gz method, you must remove the source directory from the below-mentioned command:

sudo rm -rf /usr/local/go

Method 3: By Using Snap Store

Lastly, the Go can be installed by using the snap package but for that ensure that you have snapd installed in your Debian.

If you do not have snap installed, then run the below-written command to install it on Debian.

sudo apt install snapd

Then install the core by using the below-mentioned snap command:

sudo snap install core

Finally, install Go by using snap from the below-given command:

sudo snap install go --classic

Note: Reboot the device if the go command isn’t working.

Remove Go from Snap Store

To remove Go installed using snap, run the below-mentioned command:

sudo snap remove go


There are three ways to install Go on Debian, one is through the “apt” command that installs Go from the official repository. The other method installs the latest version of Go using the .tar file. The third method installs Go on Debian is by using the Snap Store service.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.