RedHat 使用 CentOS yum 仓库

本文提供了一套详细的步骤来帮助用户从RedHat的YUM环境切换到CentOS的YUM源,包括卸载原有环境、下载并安装新的YUM组件、配置仓库文件、清理残留数据及验证安装成果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一.先卸载RedHat上的yum环境

命令如下: rpm -qa|grep yum|xargs rpm -e --nodeps

二.下载CentOS yum安装包

http://vault.centos.org/5.4/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm

http://vault.centos.org/5.4/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm

http://vault.centos.org/5.4/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

http://vault.centos.org/5.4/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm

三.安装上面下载的rpm安装包

命令如下:

1.rpm -ivh yum-3.2.22-20.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

2.rpm -ivh python-iniparse-0.2.3-4.el5.noarch.rpm

四.生成yum仓库文件CentOS-Base.repo,放在/etc/yum.repos.d/目录下,我用的5.4的版本,直接贴出来,文件内容如下:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-5.4 - Base - org
baseurl=http://vault.centos.org/5.4/os/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=i386&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates 
[updates]
name=CentOS-5.4 - Updates - org
baseurl=http://vault.centos.org/5.4/updates/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=i386&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-5.4 - Addons - org
baseurl=http://vault.centos.org/5.4/addons/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=i386&repo=addons
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-5.4 - Extras - org
baseurl=http://vault.centos.org/5.4/extras/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.4 - Plus - org
baseurl=http://vault.centos.org/5.4/centosplus/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=i386&repo=centosplus
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5.4 - Contrib - org
baseurl=http://vault.centos.org/5.4/contrib/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=i386&repo=contrib
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

注:

     因为我的red-hat是 32位 Server5 的缘故,我直接将$releasever更换成了5.4,将$basesearch更换成了i386,如果你的系统是64

     位的,此处需要按照你的系统具体修改.

五.清除RedHat-yum默认残留

1.yum clean metadata

2.yum clean dbcache

3.yum makecache

六.命令验证

yum update

此处建议输入n ^=^

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值