CentOS7更换系统源 解决无法 yum update

琉璃心
2021-07-27 / 0 评论 / 297 阅读 / 正在检测是否收录...

注:本内容已集成到一键脚本中

bash <(curl -Lso- https://blog.liulixin.top/bash/public/newvps.sh)

kwg4ye98.png

进入目录

cd /etc/yum.repos.d

修改epel.repo文件

完全填入覆盖

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
 
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://mirrors.aliyun.com/epel/7/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
 
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://mirrors.aliyun.com/epel/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0

备份旧源文件

mv ./CentOS-Base.repo ./CentOS-Base-repo.bak

下载新源文件

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

清理YUM环境

yum clean all

放置新源文件

mv CentOS7-Base-163.repo CentOS-Base.repo

刷新应用新源文件

yum makecache

换源结束

kvdn5boj.png

1

评论 (0)

取消