注意: 通过uname -m 查看具体是x86_64 还是 ARM64 ,然后再下载对应安装包,否则会报错: -bash: /usr/local/go/bin/go: cannot execute binary file
上传到server并解压,将解压后的目录放入/usr/local/下
]# ls /usr/local/go
api AUTHORS bin codereview.cfg CONTRIBUTING.md CONTRIBUTORS doc lib LICENSE misc PATENTS pkg README.md SECURITY.md src test VERSION
将下面三行放到/etc/profile末尾
export GO111MODULE=on
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
重新登陆shell,验证go环境
]# go version
go version go1.18.4 linux/amd64
安装成功