1. yum 安装
$ yum -y install epel-release
$ yum -y install golang
$ go version
go version go1.15.5 linux/amd64
2. 二进制包安装
$ wget https://dl.google.com/go/go1.12.10.linux-amd64.tar.gz
$ tar -zxvf go1.12.10.linux-amd64.tar.gz -C /usr/local/
$ mkdir /usr/local/go/projects
$ vi /etc/profile
export GOROOT=/usr/local/go
export GOPATH=/usr/local/go/projects # 工作环境
export PATH=$GOROOT/bin:$PATH
$ . /etc/profile
$ go env
go 命令无响应问题
go env -w GOPROXY=https://goproxy.cn
# 永久有效
echo "export GOPROXY=https://goproxy.io,direct" >> ~/.profile && source ~/.profile