修改CentOS默认yum源


修改CentOS默认yum源

有时候CentOS默认的yum源不一定是国内镜像,导致yum在线安装及更新速度不是很理想。需要将yum源设置为国内镜像站点。

腾讯源

1.备份系统旧配置文件

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

2、进入yum源配置文件所在的文件夹

[root@linux ~]# cd /etc/yum.repos.d/

3、下载mirrors.cloud.tencent.com的yum源配置文件到上面那个文件夹内

CentOS5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos5_base.repo

CentOS6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos6_base.repo

CentOS7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo

CentOS8

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos8_base.repo

更新缓存

yum clean all
yum makecache
yum -y update

阿里源

1.备份系统旧配置文件

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

2、进入yum源配置文件所在的文件夹

[root@linux ~]# cd /etc/yum.repos.d/

3、下载mirrors.aliyun.com的yum源配置文件到上面那个文件夹内

CentOS5

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

CentOS6

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

CentOS7

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

CentOS8

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

更新缓存

yum clean all
yum makecache
yum -y update


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM