1. 首先备份源文件
[root@ifcos ~]#cd /etc/yum.repos.d/
[root@ifcos yum.repos.d]#mv CentOS-Base.repo CentOS-Base.repo.bak
2. 下载163源
[root@ifcos yum.repos.d]#wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@ifcos yum.repos.d]#ls
CentOS7-Base-163.repo CentOS-Base.repo.bak
3. 查看系统发行版本和系统架构
查看系统发行版本
[root@ifcos yum.repos.d]#cat /etc/ifcos-release
IFCOS release 6.4 (Final)
查看系统架构
[root@ifcos yum.repos.d]#uname -a
Linux ifcos.ifcosdomain 2.6.32-358.23.2.el6.centos.plus.x86_64 #1 SMP Thu Oct 17 00:31:29 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
修改163源文件中的地址为适合自己系统的地址
在修改之前,可以先访问163源地址http://mirrors.163.com/centos。
由于我的系统发行版本为6.4,而6.4 文件夹下面没有东西,点开readme,发现这一版本已经被弃用,可以使用版本6代替6.4,readme文件如下:
This directory (and version of CentOS) is deprecated. For normal users,
you should use /6/ and not /6.4/ in your path. Please see this FAQ
concerning the CentOS release scheme:
https://wiki.centos.org/FAQ/General
If you know what you are doing, and absolutely want to remain at the 6.4
level, go to http://vault.centos.org/ for packages.
Please keep in mind that 6.0, 6.1, 6.2, 6.3 and 6.4 no longer gets any updates, nor
any security fix's.
修改163源
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/6/os/x86_64/
将源文件中的版本修改为系统对应版本,同时修改系统架构。
4. 运行命令生成缓存
[root@ifcos yum.repos.d]#yum clean all
[root@ifcos yum.repos.d]#yum makecache
参考博客:https://blog.youkuaiyun.com/wang_shen_tao/article/details/78676560