首页 > 代码库 > RedHat 更换centos yum源

RedHat 更换centos yum源

1 删除rhel自带的yum包:

rpm -aq | grep yum |xargs rpm -e --nodeps

2 安装yum:

[china~/yum_64#]rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
warning:python-iniparse-0.3.1-2.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, keyID c105b9de: NOKEY
Preparing...               ########################################### [100%]
packagepython-iniparse-0.3.1-2.1.el6.noarch is already installed
[china~/yum_64#]rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
warning:yum-metadata-parser-1.1.2-16.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, keyID c105b9de: NOKEY
Preparing...               ########################################### [100%]
   1:yum-metadata-parser    ###########################################[100%]
[china~/yum_64#]rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
warning:yum-3.2.29-40.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key IDc105b9de: NOKEY
Preparing...               ########################################### [100%]
  1:yum-plugin-fastestmirro########################################### [50%]
  2:yum                   ########################################### [100%]
[ichina~/yum_64#]

若提示需要依赖

libc.so.6 is neededby yum-metadata-parser-1.1.2-16.el6.i686
libc.so.6(GLIBC_2.0)is needed by yum-metadata-parser-1.1.2-16.el6.i686
libc.so.6(GLIBC_2.1.3)is needed by yum-metadata-parser-1.1.2-16.el6.i686
libglib-2.0.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
libpthread.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
libpython2.6.so.1.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
libsqlite3.so.0 is needed by yum-metadata-parser-1.1.2-16.el6.i686
libxml2.so.2 is needed by yum-metadata-parser-1.1.2-16.el6.i686
libxml2.so.2(LIBXML2_2.4.30) is needed by yum-metadata-parser-1.1.2-16.el6.i686

安装: glibc-2.12-1.107.el6.x86_64.rpm http://pkgs.org/centos-6/centos-x86_64/glibc-2.12-1.132.el6.x86_64.rpm.html

3 添加网易163的yum源

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
cp CentOS-Base-163.repo rhel-source.repo
sed -i ‘s/\$releasever/6/g‘ rhel-source.repo

4 清空 yum 缓存

yum clean all

5 将服务器上的软件包信息缓存到本地

yum makecache