linux 老版本yum安装记录

本文详细记录了在CentOS 5.5上手动安装YUM源及其依赖的过程,包括下载YUM及其所需依赖的rpm包,解决安装过程中遇到的各种依赖问题,并最终成功配置YUM源。

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

1. 下载yum的rpm安装包 (由于linux测试虚机没有外网地址,实际是本机浏览器下载的)
2. #
wget http://vault.centos.org/5.5/os/x86_64/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
3. 安装目录 /usr/lib/rpm
4. # rpm -qa | grep yum //确定没有安装yum的rpm包
5. 安装下载的包
# rpm -ivh yum-3.2.22-26.el5.centos.noarch.rpm
warning: yum-3.2.22-26.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
yum-fastestmirror is needed by yum-3.2.22-26.el5.centos.noarch
yum-metadata-parser >= 1.1.0 is needed by yum-3.2.22-26.el5.centos.noarch
报出缺少的依赖的包
5.1 下载依赖
http://vault.centos.org/5.5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
http://vault.centos.org/5.5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm

5.2 安装依赖
# rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
error: Failed dependencies:
libxml2.so.2()(64bit) is needed by yum-metadata-parser-1.1.2-3.el5.centos.x86_64
报出缺少的依赖的包

5.3 再次下载依赖,并安装
http://vault.centos.org/5.5/os/x86_64/CentOS/libxml2-2.6.26-2.1.2.8.x86_64.rpm

# rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
warning: yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [100%]
# rpm -ivh libxml2-2.6.26-2.1.2.8.x86_64.rpm
warning: libxml2-2.6.26-2.1.2.8.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
package libxml2-2.6.26-2.1.2.8.x86_64 is already installed

6. 检验一下yum包的依赖情况
# rpm -ivh yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
warning: yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
yum >= 3.0 is needed by yum-fastestmirror-1.1.16-14.el5.centos.1.noarch

# rpm -ivh yum-3.2.22-26.el5.centos.noarch.rpm
warning: yum-3.2.22-26.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
yum >= 3.0 is needed by yum-3.2.22-26.el5.centos.noarch

7. 两个一起安装解决
# rpm -ivh yum-3.2.22-26.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
warning: yum-3.2.22-26.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:yum-fastestmirror ########################################### [ 50%]
2:yum ########################################### [100%]

8. 有需要可以yum -y update
# yum -y update
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
8.1 解决办法 开通外网访问关系


9. 解决yum无法使用
# yum install httpd-devel
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/addons/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: addons

解决参考网址:http://blog.youkuaiyun.com/justblues/article/details/38582139

10. 重建yum缓存
# yum clean all
# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
http://mirrors.163.com/centos/5/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again

10.1 解决报错404
修改替换/etc/yum.repos.d/CentOS-Base.repo文件中所有类似以下地址
http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://vault.centos.org/5.5/os/$basearch/

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

11. 再次重建yum缓存
# yum clean all
# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
addons | 951 B 00:00
addons/filelists | 197 B 00:00
addons/other | 192 B 00:00
addons/primary | 204 B 00:00
base | 2.1 kB 00:00
base/filelists_db | 4.0 MB 00:11
base/other_db | 11 MB 00:40
base/group | 920 kB 01:19
base/primary_db | 2.1 MB 03:21
centosplus | 1.9 kB 00:00
centosplus/filelists_db | 1.4 MB 01:10
centosplus/other_db | 4.1 MB 01:16
centosplus/primary_db | 92 kB 00:01
extras | 2.1 kB 00:00
extras/filelists_db | 227 kB 00:05
extras/other_db | 443 kB 00:02
extras/group | 9.7 kB 00:00
extras/primary_db | 243 kB 00:08
update | 1.9 kB 00:00
update/filelists_db | 2.8 MB 02:09
http://vault.centos.org/5.5/updates/x86_64/repodata/filelists.sqlite.bz2: [Errno 4] Socket Error: timed out
Trying other mirror.
update/primary_db | 1.1 MB 01:48
update/filelists_db | 3.9 MB 00:03
update/other_db | 14 MB 23:14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值