参考地址:https://www.cnblogs.com/opsprobe/p/9679800.html      

最近由于企业项目需要,需要用到CentOS6.5,在修改更新源后,yum命名却无法使用了,显示“File contains no section headers.”。我参考了上面博客的内容,成功解决了问题,为了方便以后参考,特地写下笔记。

国内常用的CentOS源有:

修改CentOS6.5的更新源

中科大的yum源:

Centos5: https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=1

Centos6: https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2

Centos7: https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3

更换源的操作(以163源为例):

[1] 首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[2] 进入yum源配置文件所在文件夹
[[email protected] yum.repos.d]# cd /etc/yum.repos.d/
[3] 下载163的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份)
[[email protected] yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[4] 运行yum makecache生成缓存

[[email protected] yum.repos.d]# yum clean all
[[email protected] yum.repos.d]# yum makecache

[5] 更新系统(可选)
[[email protected] yum.repos.d]# yum -y update

相关文章: