配置阿里云镜像

详情参考阿里云官方配置https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11PJpevX
其他镜像地址可参考https://blog.csdn.net/m0_67598987/article/details/134339726

1.备份原文件

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

2. 下载阿里云文件

注:不同版本对应不同的下载地址

2.1 centos7.x

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

2.2 centos6.x

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

2.3 centos5.x

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

3. 更新cache

yum makecache

注:如更新时一直提示无法下载,可先 yum clean all 然后执行 yum makecache

更新

1. centos

详情参考阿里云官方配置https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11PJpevX
其他镜像地址可参考https://blog.csdn.net/m0_67598987/article/details/134339726

备份原文件
yum install wget -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup1

下载阿里云文件
注:不同版本对应不同的下载地址

  • centos7.x
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  • centos6.x
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
  • centos5.x
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
yum clean all
yum makecache

2. redhat

备份原文件
yum install wget -y
mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.bak
  • redhat8.x

红帽8系统可使用与CentOS 8兼容的阿里云yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
# 注:如没有下载 wget 则可以手动访问yum源地址,在复制到服务器中	

注:禁用红帽订阅管理提示(红帽系统默认会提示未注册订阅服务,需手动禁用相关插件)

# 编辑以下两个文件,将enabled=1改为enabled=0
vi /etc/yum/pluginconf.d/subscription-manager.conf
vi /etc/yum/pluginconf.d/product-id.conf
yum clean all
yum makecache

 
 
 
 
 

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐