1、安装go语言环境
[root@172 ~]# yum install golang -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.sjtu.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
Resolving Dependencies
.......
Installed:
golang.x86_64 0:1.8.3-1.el7
Dependency Installed:
golang-bin.x86_64 0:1.8.3-1.el7 golang-src.noarch 0:1.8.3-1.el7
Complete!
2、检查安装情况
[root@172 ~]# go version
go version go1.8.3 linux/amd64
3、设置环境变量
在/etc/profile中添加GOROOT和GOPATH,如下:
export GOROOT=/usr/lib/golang
export GOPATH=/home
生效配置
source /etc/profile