在官网上下载go1.6.linux-amd64.tar.gz
解压缩并拷贝程序到相应路径下
#tar -zxvf go1.6.linux-amd64.tar.gz #cp -rf go /usr/local/
备份配置文件并配置环境
#cp /etc/profile /etc/profile.backup #vi /etc/profile
在/etc/profile最后添加
# golang path configuration start
export GOROOT=/usr/local/bin/go
# 自定义目录
export GOPATH=/usr/local/bin/gwp
export GOBIN=$GOROOT/bin
export GOPKG=$GOROOT/pkg/tool/linux_amd64
export GOARCH=amd64
# go同级目录 cp -r go go1.4 ,为交叉编译执行make.bash需要
export GOROOT_BOOTSTRAP=/usr/local/bin/go1.4
export GOOS=linux
export PATH=.:$PATH:$GOBIN:$GOPKG
# golang path configuration ended
使配置生效
source /etc/profile