Updated on 10/18/19
Problem scenario
You want to do some coding in the Go programming language. You want a script to install Golang on any distribution of Linux (e.g., CentOS/Red Hat Enterprise Linux/Fedora, Debian/Ubuntu, or SUSE). What do you do?
Solution
1. Create a file in /tmp/ called go.sh with the following content:
version=1.10.8 # Change this version as needed
curl https://storage.googleapis.com/golang/go$version.linux-amd64.tar.gz > /tmp/go$version.linux-amd64.tar.gz
cp /tmp/go$version.linux-amd64.tar.gz /usr/local/go$version.linux-amd64.tar.gz
cd /usr/local/
tar xzvf go$version.linux-amd64.tar.gz
#echo "export PATH=""$""PATH:/usr/local/go/bin" >> ~/.profile
echo "export PATH=""$""PATH:/usr/local/go/bin" > /etc/profile.d/go.sh
echo "You will have to log out and log back in for go to work."
echo "You can use the 'go version' command to determine what version was installed"
2. Run it like this: sudo bash /tmp/go.sh