旧版CentOS(如CentOS6)yum源不维护继续使用的方法

2021-05-18 54点热度 0人点赞 0条评论

如果要使用DVD/ISO安装文件作为yum源,可以移步:https://blog.terrynow.com/2021/06/04/centos-how-to-mount-dvd-or-iso-to-yum-repository/

手头有一些比较老的CentOS6系统,因为要mount nfs需要安装nfs-utils,所以尝试安装:

yum install nfs-utils

发现yum install已经无法安装,因为CentOS6官方不再维护了

这种情况,其实可以找非官方(一般国内一些高校、阿里云等都有CentOS的镜像站,而有些镜像站保留了很早之前的版本,如阿里云的镜像站保留了从CentOS2 到最新的)

阿里云在国内的速度是超快的,给出阿里云的CentOS镜像站地址:

https://mirrors.aliyun.com/centos/会发现点进去只有CentOS7以上点进去是有内容的,咋了,阿里云的也CentOS旧版也停止维护了?

其实上面这个是正式和官方CentOS同步的,所以旧版也不见了,但是阿里云还有一个mirror:

http://mirrors.aliyun.com/centos-vault/centos/这个点进去,就发现所有的旧版都在了!

镜像mirror找到了,下面赶紧修改yum的配置文件吧:

找到编辑CentOS-Base.repo文件vim /etc/yum.repos.d/CentOS-Base.repo

把里面的地址都替换成阿里云的地址(请查看你的/etc/redhat-release 显示的版本替换,这里假设版本是CentOS 6.10):

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

好了,现在正常使用yum安装软件了!

admin

这个人很懒,什么都没留下

文章评论

*

code