建站不啰嗦,上手跟我做(二十三)Go 环境配置
Go 安装包下载
安装
上传安装包到 /usr/local 目录下
[root@localhost opt]# cd /usr/local
[root@localhost local]# ls
bin etc games go1.12.10.linux-amd64.tar.gz include lib lib64 libexec nginx sbin share src
解压安装包
[root@localhost local]# tar -xzf go1.12.10.linux-amd64.tar.gz
[root@localhost local]# ls
bin etc games go go1.12.10.linux-amd64.tar.gz include lib lib64 libexec nginx sbin share src
配置环境变量
[root@localhost local]# vim /etc/profile
export GOROOT=/usr/local/go #设置为go安装的路径
export GOPATH=$HOME/go #默认安装包的路径
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
使配置的环境变量立即生效
[root@localhost local]# source /etc/profile
查询 go 版本
[root@localhost local]# go version
go version go1.12.10 linux/amd64