当前位置:网站首页 > 杂货铺 > 正文

为CentOS安装yum源 使用centos-vault作为停止支持的CentOS的yum源

评论:0 发布时间: 2021-06-07 浏览: 67

安装CentOS 6.10 版本后发现,无法使用yum安装软件

登录官方网站,看到下载界面里边已经取消了CentOS6的下载链接,我想可能是已经不再支持了。
当我使用最小安装完毕的CentOS 6.10进行yum安装软件时,会报下边的错误。
 
[root@localhost ~]# yum install vim -y
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
 
解决:
 我去网上查了一下上边的错误,原因是:更新的repo源里边的地址错误,随后我换成了阿里源云,网易云,都不得行,我手动去登录里边的网址,结果显示已经下架。我就用到了官方的已经下架系统的镜像网站


将 /etc/yum.repos.d/CentOS-Base.repo 文件中所有的源主机地址修改为http://vault.centos.org,并且将$releasever替换为当前系统所使用的CentOS版本,可以使用6.x最后的版本6.10。注意,需要将所有其他备用的主机都删除,内容如下:
 vi /etc/yum.repos.d/CentOS-Base.repo

[base]
name=CentOS-6.10 - Base - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/centos/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6.10 - Updates - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/centos/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/centos/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/centos/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - vault.centos.org
failovermethod=priority
baseurl=http://vault.centos.org/centos/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://vault.centos.org/centos/RPM-GPG-KEY-CentOS-6

 
 
 
 确认在 /etc/yum.repos.d/目录没有除了CentOS-Base.repo之外其他以repo结尾的文件,如果有的话需要删除,然后执行 yum clean all && yum makecache 更新和启用新的yum源。


TAGS:

Powered By Csuper,Theme By Csuper 悠然小屋,Copyright Csuper All Rights Reserved. 湘ICP备18017694 网络是工具,不是玩具 QQ:493754678