Skip to content

Instantly share code, notes, and snippets.

@zoonderkins
Last active May 2, 2024 03:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zoonderkins/8c0c7eba6d7b12d5da6a8bdeec1da9b2 to your computer and use it in GitHub Desktop.
Save zoonderkins/8c0c7eba6d7b12d5da6a8bdeec1da9b2 to your computer and use it in GitHub Desktop.
Install Golang on Debian / Raspberry Pi #linux

Install Golang on Debian / Raspberry Pi

rm -rf /usr/local/go
GOVERSION="1.22.2"
wget "https://golang.org/dl/go${GOVERSION}.linux-amd64.tar.gz" -4
tar -C /usr/local -xvf "go${GOVERSION}.linux-amd64.tar.gz"
rm "go${GOVERSION}.linux-amd64.tar.gz"


rm -rf /usr/local/go
GOVERSION="1.21.9"
wget "https://golang.org/dl/go${GOVERSION}.linux-amd64.tar.gz" -4
tar -C /usr/local -xvf "go${GOVERSION}.linux-amd64.tar.gz"
rm "go${GOVERSION}.linux-amd64.tar.gz"

For Bash

cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF

source ~/.bashrc

For ZSH

cat >> ~/.zshrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF

source ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment