1,下载二进制文件:
wget https://studygolang.com/dl/golang/go1.6.linux-amd64.tar.gz
2,解压并创建工作目录:
mkdir /usr/local/golang
tar -zxf go1.6.linux-amd64.tar.gz -C /usr/local/golang
3,设置环境变量:
export GOROOT=/usr/local/golang
export GOBIN=$GOROOT/bin
export GOPKG=$GOROOT/pkg/tool/linux_amd64
export GOARCH=amd64
export GOOS=linux
export GOPATH=/golang
export PATH=$PATH:$GOBIN:$GOPKG:$GOPATH/bin
4,重载配置 source /etc/profile 使之生效,或者重新登录Linux也可
go version
go version go1.6 linux/amd64
环境配置成功