• 备份本地yum源

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  • 下载yum源

[root@localhost ~]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
  • yum更新

[root@localhost ~]# yum clean all    # 清除系统所有的yum缓存
[root@localhost ~]# yum makecache     # 生成yum缓存
[root@localhost ~]# yum update        # 升级所有包,改变软件设置和系统设置,系统版本内核都升级。
  • 查看yum源

[root@localhost ~]# yum repolist all        # 查看所有的yum源
[root@localhost ~]# yum repolist enabled    # 查看可用的yum源
  • 常用yum源补充:

####阿里云######
# CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
# CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
# CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

####中科大######
wget http://centos.ustc.edu.cn/CentOS-Base.repo

####163#######
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

####sohu######
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo