centos下安装go最新版本

# centos下安装go最新版本

yum install golang 的版本 是 1.17版本,最新版是 1.19.1

下载 https://golang.google.cn/dl/

1
2
3
4
5
6
wget -c https://golang.google.cn/dl/go1.19.1.linux-amd64.tar.gz

tar -zxf go1.19.1.linux-amd64.tar.gz -C /opt/

ls /opt/
mkdir /opt/gopath 

环境变量

1
nano /etc/profile

在最后添加

1
2
3
4
export GO111MODULE=on
export GOROOT=/opt/go
export GOPATH=/opt/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin 

更新生效 设置代理

1
2
3
4
 source /etc/profile
 go version
go version go1.19.1 linux/amd64
[root@0ef053b03825 opt]# go env -w GOPROXY=https://goproxy.cn,direct

关于go的代理

慎选择 阿里的,很多404不说,竞厂的sdk 阿里是不会让你下载的。真感觉好用,用逗号分割就好

Licensed under CC BY-NC-SA 4.0
最后更新于 2022-09-07 19:56 UTC
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计