官方下载地址:https://golang.google.cn/dl/
下载安装包
- 官网下载对应的安装包:go1.13.8.linux-amd64.tar.gz
- 解压到/usr/local目录下
[root@eth131 go1.13.8]# pwd
/usr/local/go1.13.8
[root@eth131 go1.13.8]# ll
总用量 204
drwxr-xr-x. 2 root root 4096 2月 13 04:58 api
-rw-r--r--. 1 root root 55389 2月 13 04:58 AUTHORS
drwxr-xr-x. 2 root root 29 2月 13 05:01 bin
-rw-r--r--. 1 root root 1339 2月 13 04:58 CONTRIBUTING.md
-rw-r--r--. 1 root root 84339 2月 13 04:58 CONTRIBUTORS
drwxr-xr-x. 8 root root 4096 2月 13 04:58 doc
-rw-r--r--. 1 root root 5686 2月 13 04:58 favicon.ico
drwxr-xr-x. 3 root root 18 2月 13 04:58 lib
-rw-r--r--. 1 root root 1479 2月 13 04:58 LICENSE
drwxr-xr-x. 13 root root 193 2月 13 04:58 misc
-rw-r--r--. 1 root root 1303 2月 13 04:58 PATENTS
drwxr-xr-x. 6 root root 76 2月 13 05:01 pkg
-rw-r--r--. 1 root root 1607 2月 13 04:58 README.md
-rw-r--r--. 1 root root 26 2月 13 04:58 robots.txt
-rw-r--r--. 1 root root 397 2月 13 04:58 SECURITY.md
drwxr-xr-x. 47 root root 4096 2月 13 04:58 src
drwxr-xr-x. 23 root root 12288 2月 13 04:58 test
-rw-r--r--. 1 root root 8 2月 13 04:58 VERSION
配置环境变量
修改/etc/profile文件,配置GOROOT和GOPATH参数
[root@eth131 go1.13.8]# vi /etc/profile
export GOROOT=/usr/local/go1.13.8
export GOPATH=/usr/local/gopath
export PATH=$GOROOT/bin:$PATH
验证环境
任意目录下,执行go version指令,可以返回当前版本号
[root@eth131 ~]# go version
go version go1.13.8 linux/amd64