直接使用yum install golang

[root@master app]# yum install golang
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.bfsu.edu.cn* extras: mirrors.huaweicloud.com* updates: mirrors.huaweicloud.com
没有可用软件包 golang。

解决办法

先添加源,再使用命令行安装。添加源的方式如下:

								Install on CentOS:Current version: 1.12.5
rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
yum install golangInstall on Fedora:
Current version: 1.12.5
rpm --import https://mirror.go-repo.io/fedora/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/fedora/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
yum install golangExample $GOPATH setup:
mkdir -p ~/go/{bin,pkg,src}
echo 'export GOPATH="$HOME/go"' >> ~/.bashrc
echo 'export PATH="$PATH:${GOPATH//://bin:}/bin"' >> ~/.bashrcUnstable (Pre-release) PackagesCurrent version: 1.11rc2CentOS:
rpm --import https://mirror.go-repo.io/centos-unstable/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos-unstable/go-repo-unstable.repo | tee /etc/yum.repos.d/go-repo-unstable.repo
yum install golangFedora:
rpm --import https://mirror.go-repo.io/fedora-unstable/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/fedora-unstable/go-repo-unstable.repo | tee /etc/yum.repos.d/go-repo-unstable.repo
yum install golang