RedHat Linux用rpmdb和yum解决依赖问题

用rpmdb和yum解决依赖问题

在rhel5当中取消了rpmdb包(其实在fc4中就已经取消了),rpmdb主要是解决在安装包时的依赖关系。

通过以下方法可以查看究竟有没有安装rpmdb包。

[root@linux RPMS]# rpm -qa|grep rpmdb
rpmdb-RedHat-4-0.20050107


如何运用rpmdb来解决依赖关系呢?比如安装as4自带的apache时有很多依赖需要解决,如:

[root@linux RPMS]# rpm -ivh httpd-2.0.52-9.ent.i386.rpm                                         
warning: httpd-2.0.52-9.ent.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e  
error: Failed dependencies:                                                                                        
        httpd-suexec is needed by httpd-2.0.52-9.ent.i386                                            
    Suggested resolutions:                                                                                           
        httpd-suexec-2.0.52-9.ent.i386.rpm
报错需要安装依赖包。用rpmdb工具自动解决依赖的方法是先执行rpm -ivh rpmdb*.rpm,

然后在安装其他软件包时加上--aid的参数。

[root@linux RPMS]# rpm -ivh --aid httpd-2.0.52-9.ent.i386.rpm                                      
warning: httpd-2.0.52-9.ent.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e     
Preparing...                ########################################### [100%]    
   1:httpd                  ########################################### [ 50%]        
   2:httpd-suexec           ########################################### [100%]
安装完成了。

现在没有rpmdb工具,可以使用新的yum工具来完成。

组件包的安装都是通过yum来完成的,所以要对yum进行配置。

具体在命令行下操作如下:

1. mount -o loop rhel-5-server-dvd.iso /media/rhel

2. vi /etc/yum.repos.d/rhel-local.repo

[Cluster]
name=Red Hat Enterprise Linux $releasever - $basearch - Cluster
baseurl=file:///media/rhel/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]
name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage
baseurl=file:///media/rhel/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Server]
name=Red Hat Enterprise Linux $releasever - $basearch - Server
baseurl=file:///media/rhel/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]
name=Red Hat Enterprise Linux $releasever - $basearch - VT
baseurl=file:///media/rhel/VT
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

3. mkdir -p /var/rhel/{Cluster,ClusterStorage,Server,VT}

4. createrepo -o /var/rhel/Cluster -g /media/rhel/Cluster/repodata/comps-rhel5-cluster.xml /media/rhel/Cluster
   createrepo -o /var/rhel/ClusterStorage -g /media/rhel/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /media/rhel/ClusterStorage
   createrepo -o /var/rhel/Server -g /media/rhel/Server/repodata/comps-rhel5-server-core.xml /media/rhel/Server
   createrepo -o /var/rhel/VT -g /media/rhel/VT/repodata/comps-rhel5-vt.xml /media/rhel/VT

5. mount --bind /var/rhel/Cluster/repodata /media/rhel/Cluster/repodata

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/26699.html