2021-12-22 13:51:22 +00:00
|
|
|
#!/bin/bash
|
2022-01-09 08:52:56 +00:00
|
|
|
echo
|
|
|
|
echo "==============================================="
|
|
|
|
echo "Installing golang..."
|
|
|
|
echo "==============================================="
|
|
|
|
echo
|
2021-12-22 13:51:22 +00:00
|
|
|
|
2022-01-09 08:52:56 +00:00
|
|
|
# https://go.dev/dl/
|
2021-12-22 13:51:22 +00:00
|
|
|
# https://golang.org/doc/install
|
|
|
|
# https://www.vultr.com/docs/install-the-latest-version-of-golang-on-ubuntu
|
|
|
|
|
2022-01-09 08:52:56 +00:00
|
|
|
[ $1 ] && VERSION="$1" || VERSION="1.17.6"
|
2021-12-22 13:51:22 +00:00
|
|
|
FILE="go$VERSION.linux-amd64.tar.gz"
|
|
|
|
|
|
|
|
sudo rm -rf /usr/local/go
|
|
|
|
wget "https://golang.org/dl/$FILE" -O /tmp/$FILE
|
|
|
|
sudo tar -xzf $FILE -C /usr/local
|
|
|
|
rm -rf /tmp/$FILE
|
2022-01-09 08:52:56 +00:00
|
|
|
sudo chown anthony: -R /usr/local/go
|
2021-12-22 13:51:22 +00:00
|
|
|
|
|
|
|
echo "export PATH=$PATH:/usr/local/go/bin" >> /home/anthony/.profile
|
|
|
|
echo "export GOPATH=~/.go" >> /home/anthony/.profile
|
|
|
|
# source ~/.profile
|
|
|
|
|
2022-01-09 08:52:56 +00:00
|
|
|
echo
|
|
|
|
go version
|
|
|
|
echo "NOTE: now run 'source ~/.profile' to apply new env vars"
|
|
|
|
echo
|