前情和概要

由于在前一篇文章(CentOS 安装 ntpdate 服务为系统同步时间)中需要安装系统同步时间服务,而很久时间没有为系统更新和安装新软件,这次发现之前已经配置成功的软件源(记一次替换 CentOS 软件包镜像源地址的问题)已经不起作用,而这大多数原因是 CentOS 系列陆续结束生命周期停止服务导致,而使用 Alinux 也无法避免。

记一次替换 CentOS 软件包镜像源地址的问题 使用的是 CentOS8 的华为云镜像,而这次无法正常安装系统服务就考虑使用阿里云的镜像,如有需要可以依然使用华为云的 CentOS7 的镜像来尝试。

更新镜像源

进入阿里云 CentOS 镜像页面下载和替换 repo 包;

备份当前源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载和替换

注意使用 Centos-7.repo 而不是 Centos-vault-8.5.2111.repo

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

编辑镜像源

进入编辑模式,将字段区域.../centos/$releasever/... 替换为.../centos/7/... 保存

iv /etc/yum.repos.d/CentOS-Base.repo

清除和刷新

yum clean all && yum makecache

测试镜像源

yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cloud.aliyuncs.com
 * extras: mirrors.cloud.aliyuncs.com
 * updates: mirrors.cloud.aliyuncs.com
repo id                                     repo name                                                                  status
base/x86_64                                 CentOS-2.1903 - Base - mirrors.aliyun.com                                  10,072
extras/x86_64                               CentOS-2.1903 - Extras - mirrors.aliyun.com                                   515
updates/x86_64                              CentOS-2.1903 - Updates - mirrors.aliyun.com                                4,907
repolist: 15,494

更新系统库

如果在使用 yum update 时提示以下报错:

 yum update
 ......
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

可使用以下任意命令跳过

yum update --skip-broken
rpm -Va --nofiles --nodigest

何星星原创文章仅用于个人学习,当前页面暂不支持复制操作,了解详情或文章转载请 点此 继续!

0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注