0%

Centos7 换源

解决

进入目录,备份

1
2
3
cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/

换源

1
2
wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

除系统 yum 缓存并生成新的 yum 缓存

1
2
yum clean all		# 清除系统所有的yum缓存
yum makecache # 生成yum缓存

安装 epel 源

1
2
yum list | grep epel-release
yum install -y epel-release

使用阿里开源镜像提供的 epel 源

1
2
3
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all # 清除系统所有的yum缓存
yum makecache # 生成yum缓存

其他

CentOS 8

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

1
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

CentOS 7

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

1
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

CentOS 6

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

1
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

参考文章