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:
Then install Go by using the below-written apt command:
To verify the installation of Go, run the below-written command:
Remove Go from Debian
To remove an installed Go package from Debian, use the below-mentioned “apt remove” command:
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:
Then by using nano editor, open the etc/profile file:
Scroll to the bottom of the file and add the below-mentioned text to give path of Go:
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.
Now, run the version command to confirm the installation of Go latest version on Debian.
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:
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.
Then install the core by using the below-mentioned snap command:
Finally, install Go by using snap from the below-given command:
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:
Conclusion
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.