Centos7安装go.10.1环境

1、下载

wget https://studygolang.com/dl/golang/go1.10.1.linux-amd64.tar.gz
或载tar包到本地再上传到服务器

2、建立目录并解压

建立Go目录:mkdir /go/work/go

建立GoPath目录:mkdir /go/work/gopath

解压缩:mv go1.10.1.linux-amd64.tar.gz /go/work/
      cd /go/work
      tar -xvf go1.10.1.linux-amd64.tar.gz

进入解压目录:cd /go/work/go

3、设置环境变量

vim /etc/profile
底部添加:
export GOROOT=/go/work/go
export GOPATT=/go/work/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
保存退出,执行source /etc/profile

4、查看安装版本

go version
原文地址:https://www.cnblogs.com/xxdebug/p/14142301.html