1、查询安装的rpm包
1 |
|
2. 删除自带的 rpm包
1 |
|
因为一些包之间可能会有依赖关系,所以我们需要加上参数 --nodeps 无视依赖关系。
3. 下载rpm包
rpm包下载地址http://mirrors.163.com/centos/6.9/os/i386/
在这个网站里,你可以自己选择需要下载的文件,进入形如5/或者6/的文件下载,其他的无法下载。7.0版本以后不支持i386,只支持x86_64。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm yum-metadata-parser-1.1.2-16.el6.i686.rpm yum-plugin-security-1.1.30-40.el6.noarch.rpm
# mkdir yum # cd yum/ wget http: //mirrors .163.com /centos/6 .9 /os/i386/Packages/yum-3 .2.29-81.el 6.centos.noarch.rpm wget http://mirrors.163.com/centos/6.9/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm wget http://mirrors.163.com/centos/6.9/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
wget http://mirrors.163.com/centos/6.9/os/i386/Packages/yum-utils-1.1.30-40.el6.noarch.rpm |
4、安装RPM包
1 2 | # rpm -ivh *.rpm
|
5、删除原来的yum源
1 2 | # cd /etc/yum.repos.d
|
6、下载163的yum源
1 |
|
7、编辑yum源repo文件
把文件里面的$releasever全部替换为版本号: 6.9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | vim CentOS6-Base-163.repo name=CentOS-$releasever - Base - 163.com baseurl=http://mirrors.163.com/centos/6.9/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates - 163.com baseurl=http: //mirrors .163.com /centos/6 .9 /updates/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates gpgcheck=1 gpgkey=http: //mirror .centos.org /centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - 163.com baseurl=http: //mirrors .163.com /centos/6 .9 /extras/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http: //mirror .centos.org /centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - 163.com baseurl=http: //mirrors .163.com /centos/6 .9 /centosplus/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http: //mirror .centos.org /centos/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - 163.com baseurl=http: //mirrors .163.com /centos/6 .9 /contrib/ $basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib gpgcheck=1
|
8、清理并重建缓存
1 2 | yum clean all
|
9、更换完毕。