Centos 安装 Go 编译环境

1.下载go(最新版列表 https://studygolang.com/dl)

wget -c https://studygolang.com/dl/golang/go1.13.5.linux-amd64.tar.gz

2.解压go到 /opt/

tar -C /opt/ -zxvf go1.13.5.linux-amd64.tar.gz

3.增加环境变量,编辑 /etc/profile 增加如下三行

export PATH=$PATH:/opt/go/bin
export GOROOT=/opt/go
export GOPATH=/root/project #项目代码所在目录,建议编译之前手动建立一个 /root/project

4.刷新环境变量

source /etc/profile

5.产看版本

go version

6.安装gcc编译器(根据要要编译的项目可选)

yum install gcc

猜你喜欢

转载自www.cnblogs.com/radmin/p/12146317.html
今日推荐