Wednesday, January 25, 2006

RPM Auto Install Dependency (--aid option)

Ever ran into a situation where you did the minimum installation of linux and later you started to install the softwares (RPMs) from the dist CD(s) and ran into lot of dependency failures??

The best way to deal this is using the Auto Install Dependency option (--aid) provided by RPM.

Install the minimal RH linux system. Copy ALL the .rpm files from the RPMS folder (from all the CDs) to some folder on the HDD - say /var/dist/RPMS

Now, this folder contains all the RPMS of the distribution.

Make sure that the rpmdb-redhat package is installed.

Now, you have to edit the RPM configuation to point to the location of RPM repository.

Edit the following file: /etc/rpm/macros.solve and change/add these lines:

%_solve_pkgsdir /var/dist/RPMS
%_solve_name_fmt %{?_solve_pkgsdir}%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm

Now, when ever you try to install a software and encounter a missing dependency, use the --aid switch like illustrated below:

rpm -ivh --aid /path/to/installtree/RedHat/RPMS/somepackage.rpm

This shud automatically resolve all the dependencies and also install them from the RPM tree.

The above solution will be capable of resolving dependecy based on the information available on the distribution's RPM database you installed. It cannot resolve the dependencies from packages which are not a part of the distribution. There are automated tools which can download and install dependencies on demand from the internet. Use tools such as yum, up2date etc.

Source: http://www.redhat.com/advice/tips/rhce/rpm.html

No comments: