CentOS Golang安装

1、下载Golang
[root@VM_0_14_centos golang]# wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz
2、解压,然后移动到指定目录
[root@VM_0_14_centos golang]# tar -zxvf go1.8.1.linux-amd64.tar.gz 
[root@VM_0_14_centos golang]# mv go /usr/local/install/
4、添加到环境变量
[root@VM_0_14_centos golang]# vim /etc/profile

修改内容为(在path后添加)
export GOROOT=/usr/local/go
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN:$PATH
export GOPATH=/opt/gopath
刷新修改的配置,并测试是否成功
source /etc/profile
go version

你可能感兴趣的:(CentOS Golang安装)