用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
mount --bind /var/rhel/ClusterStorage/repodata /media/rhel/ClusterStorage/repodata
mount --bind /var/rhel/Server/repodata /media/rhel/Server/repodata
mount --bind /var/rhel/VT/repodata /media/rhel/VT/repodata
6. yum clean all