centos7下配置golang开发环境
到官方https://golang.org/dl/下载安装包
wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
解压
tar zxvf go1.8.linux-amd64.tar.gz -C /usr/local
新建go项目根目录
mkdir -p /var/opt/wwwroot/goblog
配置环境变量
vim /etc/profile
export GOROOT=/usr/local/go export GOBIN=$GOROOT/bin export PATH=$PATH:$GOBIN export GOPATH=/var/opt/wwwroot/goblog
source /etc/profile
安装结束,验证
go version