CentOS6 更新时间:每5小时更新一次
[1]备份原有文件
[root@dbserver ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.original
[root@dbserver ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOs6-Base-163.repo
[root@dbserver ~]# yum clean all
[root@dbserver ~]# yum makecache
Loaded plugins: fastestmirror
Metadata Cache Created缓存
CentOS7
[1] 首先备份/etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bakide
[2] 进入yum源配置文件所在文件夹
[root@localhost yum.repos.d]# cd /etc/yum.repos.d/server
[3] 下载163的yum源配置文件,放入/etc/yum.repos.d/(操做前请作好相应备份)
[root@localhost yum.repos.d]# wget -O http://mirrors.163.com/.help/CentOS7-Base-163.repoget
[4] 运行yum makecache生成缓存
[root@localhost yum.repos.d]# yum makecacheit
[5] 更新系统或安装软件(时间比较久,主要看我的网速)
[root@localhost yum.repos.d]# yum -y update或者 yum -y upgradeast