写这篇文章我真的是一把鼻涕一把泪,配环境太不容易了,辛苦了各位!
我想要用yum安装某软件
yum install gcc-c++
但是报错
找了半天发现
2020年11月30日CentOS官方已经停止对CentOS6版本的维护,CentOS6要使用yum命令都需要修改yum配置。
因此我们需要修改yum配置文件
vi /etc/yum.repos.d/CentOS-Base.repo
我发现 baseurl后面的连接全是失效的 404页面
http://mirror.centos.org/centos/ releasever/ updates / releasever/updates/ releasever/updates/basearch/
因此我们需要替换源 用清华源
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/
gpgcheck=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/extras/x86_64/
gpgcheck=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
完成之后
yum clean all 和 yummakecache清理下缓存
再使用
yum install gcc-c++
发现它还是报错
这个意思就是说这个源没有有效的认证的证书,那怎么办,我们取消认证即可
解决方案:Adding “sslverify=false” in the ‘/etc/yum.conf’ file。
vim /etc/yum.conf