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