命令行安装

yum install golang

默认安装目录/usr/lib/golang/  (不同系统不一样,可通过搜索golang关键字查找: find / -name golang)

卸载

yum remove golang

配置环境变量

手动安装

官网下载安装包:链接

如:wget https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz

解压到  /usr/local/go

配置环境变量

# 打开
vim /etc/profile
# 添加
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
# 编译
source /etc/profile

是否需要配置GOPATH

Go的1.11版本之后,已不再推荐使用GOPATH来构建应用了,使用Module方式构建

相关文章:

  • 2022-12-23
  • 2021-09-26
  • 2021-11-07
  • 2022-01-28
  • 2022-01-03
  • 2021-06-26
  • 2022-01-06
猜你喜欢
  • 2021-12-11
  • 2021-08-04
  • 2022-01-01
  • 2022-01-24
  • 2022-12-23
  • 2021-07-20
相关资源
相似解决方案