原因分析:
2020年12月2日下架了包括官方所有的CentOS6源(包括国内的镜像站)CentOS 6的yum 官网不在维护,所以镜像的yum源也不在维护了,尝试使用网上搜的替换阿里云、163的yum源,发现也不行了。
解决方案:
使用centos-vault作为更新源
具体操作:
1.更换yum源
先执行
vi /etc/yum.repos.d/CentOS-Base.repo
再将CentOS-Base.repo中的内容全部用下面代码替换,注意替换对应的centos的版本号
name=CentOS-6.10
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
# 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
2.更换epel源
先执行 ,进入epel.repo文件
vi /etc/yum.repos.d/epel.repo
将源epel.repo文件中所有内容用下面代码替换
[epel]
name=epel
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-$releasever&arch=$basearch
enabled=1
gpgcheck=0
按下ESC,输入 :wq 保存并退出文件
3.清除缓存
yum clean all && yum makecache
参考文章:
epel源mysql版本_CentOS使用EPEL源的方法步骤
心得体会:
感谢上面两篇文章的作者,帮助我这个linux小白解决问题。目前是看网课在学习大数据部分知识,因为网课的录制实在centos6停止维护前录制的,所以视频中老师的操作现在并不能完全照抄,导致这个问题困扰了我好久,现在终于解决了,芜湖!第一次写博客以此记录此次解决过程。希望看到这篇文章的朋友能对你有所帮助。