linux 老版本yum安装记录

1. 下载yum的rpm安装包 (由于linux测试虚机没有外网地址,实际是本机浏览器下载的)
2. [root@localhost rpm]#
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. [root@localhost rpm]# rpm -qa | grep yum   //确定没有安装yum的rpm包
5. 安装下载的包
[root@localhost rpm]# 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 安装依赖
[root@localhost rpm]# 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

[root@localhost 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%]
[root@localhost rpm]# 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包的依赖情况
[root@localhost rpm]# 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

[root@localhost rpm]# 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. 两个一起安装解决
[root@localhost rpm]# 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
[root@localhost rpm]# 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无法使用
[root@localhost yum.repos.d]# 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.csdn.net/justblues/article/details/38582139

10. 重建yum缓存
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# 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缓存
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# 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



猜你喜欢

转载自june107.iteye.com/blog/2375172
今日推荐