ops-gateway的go环境构建
- 替换镜像源
sudo vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
清理并重建缓存:
sudo yum clean all
sudo yum makecache
sudo yum update
安装包:
yum install dos2unix
- 配置go
安装go之后:vim /etc/profile
export PATH=$PATH:/usr/local/go/bin
source /etc/profile
导入环境变量:
go env -w GO111MODULE=on
go env -w GOSUMDB=off
go env -w GOPROXY=https://mirrors.wps.cn/go/
go env -w GOPRIVATE=ksogit.kingsoft.net
git config --global url."git@ksogit.kingsoft.net:".insteadOf "https://ksogit.kingsoft.net/"
配置环境git仓库ssh免密:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
cat ~/.ssh/id_rsa.pub
配置host 10.23.8.111 ksogit.kingsoft.net
临时操作:GOSUMDB=sum.golang.org go mod tidy

浙公网安备 33010602011771号