CentOS添加中科大、163 yum源

首先备份CentOS-Base.repo

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

其次,下载对应版本的CentOS-Base.repo, 放入/etc/yum.repos.d/目录

CentOS6.x

[root@richard yum.repos.d]# wget http://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2

CentOS5.x

[root@richard yum.repos.d]# wget http://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=1

运行yum clean all、yum makecache生成缓存

[root@NJZYY06 yum.repos.d]# yum clean all
Loaded plugins: aliases, changelog, downloadonly, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify,
              : versionlock
Loading support for CentOS kernel ABI
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
11 delta-package files removed, by presto
[root@richard yum.repos.d]# yum makecache Loaded plugins: aliases, changelog, downloadonly, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify, : versionlock Loading support for CentOS kernel ABI base | 9.4 kB 00:00 http://mirrors.ustc.edu.cn/centos/6/os/x86_64/repodata/repomd.xml: [Errno -1] Error importing repomd.xml for base: Damaged repomd.xml file Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again [root@njzyy07 yum.repos.d]# yum makecache Loaded plugins: aliases, changelog, downloadonly, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify, : versionlock Loading support for CentOS kernel ABI Loading mirror speeds from cached hostfile base | 3.7 kB 00:00 base/group_gz | 220 kB 00:00 base/filelists_db | 5.9 MB 00:20 base/primary_db | 4.4 MB 00:00 base/other_db | 2.8 MB 00:13 extras | 3.4 kB 00:00 extras/filelists_db | 11 kB 00:00 extras/prestodelta | 907 B 00:00 extras/primary_db | 19 kB 00:00 extras/other_db | 5.8 kB 00:00 updates | 3.4 kB 00:00 updates/filelists_db | 2.2 MB 00:06 updates/prestodelta | 343 kB 00:01 updates/primary_db | 3.7 MB 00:14 updates/other_db | 31 MB 01:46 Metadata Cache Created

运行 yum update升级所有软件包(可以不选)

[root@richard yum.repos.d]# yum update

 163网易源配置请参见163官网:http://mirrors.163.com/.help/centos.html

原文地址:https://www.cnblogs.com/Richard-xie/p/3831242.html