树莓派CENTOS的源更换后一直没有办法更新
-
备份系统镜像源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
-
下载阿里镜像源,如果没有
wget
,使用yum install wget
安装
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
-
运行yum makecache生成缓存
yum makecache
报错,其实就是找不到XML文件的原因:
[root@centos-rpi3 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
http://mirrors.aliyun.com/centos/7/os/armhfp/repodata/repomd.xml: [Errno 14] HTTP Error 404 – Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article
解决方式:
编辑Centos-7.repo文件:
将:
http://mirrors.aliyuns.com/centos/$releasever/os/$basearch/
更改为:
http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/
存盘,重新执行
yum makecache
成功
-
然后更新
yum update
-
增加epal源
// 安装epel源yum install epel-release// 修改为阿里的epel源 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo// 安装yum源优先级管理工具 yum install -y yum-priorities// 添加优先级(数字越小优先级越高) vim /etc/yum.repo.d/epel.repo priority=88// 添加优先级(这个数要小于epel里的88即可) vim /etc/yum.repo.d/Centos-7.repo priority=6// 开启yum源优先级功能 vim /etc/yum/pluginconf.d/priorities.conf// 确保文件内容包含如下: [main] enabled=1 <wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">