下载安装包
下载地址:https://golang.google.cn/dl/
创建安装目录移动并解压到安装目录
mkdir -p ~/support/gopath
mv go1.11.linux-amd64.tar.gz ~/support
tar -xzvf go1.11.linux-amd64.tar.gz
添加环境变量
[ocetl@x666 ~]$ vi .bash_profile
#go
export GOROOT=~/support/go
export GOPATH=~/support/gopath
export PATH=${GOROOT}/bin:$PATH
export PATH=${GOPATH}/bin:$PATH
source ~/.bash_profile
查看环境变量是否生效
[ocetl@x666 ~]$ go version
go version go1.11 linux/amd64