go升级
安装go:
yum install epel-release
yum install golang
设置环境变量:
vim /etc/profile
export GOROOT=/usr/local/go
export GOPATH=you code path
source /etc/profile
需要go版本为1.16+(升级go可按照步骤:https://golang.org/doc/install?download#download)
升级步骤:
1、rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz
2、export PATH=$PATH:/usr/local/go/bin
3、go version
如果服务器上其他用户在/usr/local/go中使用的go版本和自己想要的不一样,可以先解压到自己用户目录下,然后更改自己用户的PATH,改为首先查询自己用户目录下的路径
PATH="/home/test/go1.17/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/lib/snapd/snap/bin:/root/anaconda3/bin:/usr/local/nodejs/bin:/root/bin:/usr/git/bin:/home/test/go/bin"
ubuntuan 安装go:
wget https://go.dev/dl/go1.20.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.20.1.linux-amd64.tar.gz
ls /usr/local/go
vi ~/.bashrc
export PATH=$PATH:/usr/local/go/bin
source ~/.bashrc
posted on 2022-05-16 15:36 MissSimple 阅读(946) 评论(0) 编辑 收藏 举报