Reinin

A prospective computer science student living in the American North East. New blog posts every weekend

How to install Go(lang) on Debian

2024-02-08 programming go

This also works on WSL2 Debian based, which is what I use.

Navigate to the Go download page

Copy the “Linux” install link, and navigate back to your shell. Use the following commands:

wget https://dl.google.com/go/goVERSION.linux-amd64.tar.gz
sudo tar -xvf goVERSION.linux-amd64.tar.gz
sudo mv go /usr/local
echo "export GOROOT=/usr/local/go" >> ~/.bashrc
echo "export GOPATH=\$HOME/go" >> ~/.bashrc
echo "export PATH=\$GOPATH/bin:\$GOROOT/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc

Source might not work, in which case restart your terminal or shell instance.

If using ZSH, simply replace all instances of ~./bashrc with ~/.zshrc