Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Go Lang on Raspberry Pi
cd $HOME
FileName='go1.13.4.linux-armv6l.tar.gz'
wget https://dl.google.com/go/$FileName
sudo tar -C /usr/local -xvf $FileName
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
@sighmon
Copy link

sighmon commented Mar 21, 2022

Version 1.18 for Raspberry Pi 4

cd /tmp
fileName='go1.18.linux-arm64.tar.gz'
wget -c https://golang.org/dl/$fileName && sudo rm -rfv /usr/local/go && sudo tar -C /usr/local -xvf $fileName

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

source ~/.bashrc

read -p "Press any key to delete downloaded file: $fileName..."
rm -rf "$fileName"

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