Last active
June 28, 2023 14:07
-
-
Save anthonyaxenov/3b5ef7b8f08ed3d06d33e13a48f1c119 to your computer and use it in GitHub Desktop.
[SHELL] Install golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# GoLang installer | |
# https://golang.org/doc/install | |
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu | |
# if [ "$EUID" -ne 0 ] | |
# then echo "*** root permissions required ***" | |
# exit | |
# fi | |
[ $1 ] && VERSION="$1" || VERSION="1.17.5" | |
FILE="go$VERSION.linux-amd64.tar.gz" | |
cd /usr/src | |
sudo rm -rf "$FILE" /usr/local/go | |
sudo wget "https://golang.org/dl/$FILE" | |
sudo tar -C /usr/local -xzf "$FILE" | |
sudo chown $USER: -R /usr/local/go | |
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile | |
echo "export GOPATH=~/.go" >> ~/.profile | |
source ~/.profile | |
echo "$(go version)" | |
echo "NOTE: now run \`source ~/.profile\` to apply new env vars" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment