centos7 modify yum source

Modify the default yum source of CentOS to mirrors.163.com

1. First, back up the yum source configuration file / etc/yum.repos.d/CentOS-Base.repo

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2. Enter the folder where the yum source configuration file is located

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

3. Download the yum source configuration file of 163 to the above folder

CentOS7

[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

[root@localhost yum.repos.d]# mv CentOS7-Base-163.repo CentOS-Base.repo

4. Run yum makecache to generate the cache

[root@localhost yum.repos.d]# yum makecache

5. When you update the system, you will see the following information of mirrors.163.com

[root@localhost yum.repos.d]# yum -y update
Plug in loaded: fastestmirror, refresh-packagekit, security
Set up update process Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com


Modify the default yum source of CentOS to mirrors.aliyun.com
1. First, back up the yum source configuration file / etc/yum.repos.d/CentOS-Base.repo

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2. Download the yum source configuration file of ailiyun to / etc/yum.repos.d/
CentOS7

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3. Run yum makecache to generate the cache

[root@localhost ~]# yum makecache

4. When you update the system, you will see the following information of mirrors.aliyun.com

[root@localhost ~]# yum -y update
Plug in loaded: fastestmirror, refresh-packagekit, security
Set up update process Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com

Keywords: Operation & Maintenance yum CentOS

Added by aod on Thu, 26 Dec 2019 16:13:45 +0200