进入/etc/yum.repo.d中

编译repo文件:vim 163.repo

 

[base]

name=CentOS-$releasever - Base
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#released updates

[update]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful

[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages

[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users

[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/devel/RPM-GPG-KEY-CentOS-5

已经更新过的可以直接使用这个命令:yum --enabled 163 check-update

第一次更新会失败,多更新几次就可以了。