Installing Go on CentOS 7.x
This has given me trouble more than once so here are my notes for future reference:
1. Download git (Go uses git to download files)
yum -y install git
2. Download Go: (Get the latest version from here: https://golang.org/dl/)
cd /tmp
curl -LO https://dl.google.com/go/go1.9.3.linux-amd64.tar.gz
3. Decompress it:
tar -xvf go1.9.3.linux-amd64.tar.gz
4. Move the files to a reasonable location:
mv go /usr/local
5. Create a directory where the downloaded Go apps will be installed:
mkdir /root/goapps
6. Set the environmental variables you need:
export GOROOT=/usr/local/go
export GOPATH=/root/goapps
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
7. Add them to your ~/.bashrc as well so that they persist across reboots:
echo export "GOPATH=/root/goapps" >> ~/.bashrc
echo export "export PATH=$PATH:$GOPATH/bin:$GOROOT/bin" >> ~/.bashrc
8. Test Go:
go version
go version go1.9.3 linux/amd64
9. Download and compile a sample tool ( cuchi):
go get github.com/michlabs/cuchi
10. Does it work and where is it installed?
cuchi -h
Usage of cuchi:
-s run in server mode
which cuchi
/root/goapps/bin/cuchi