Thursday, August 11, 2005

Installating Redhat packages - the Debian Way


The RPM (Redhat Package Manager) in Redhat is a very good package manager to install RPMs. One downside to this is the complexities involved with installing big componenets like GCC which involves relationships similar to the way indian government runs.

If you are at the rookie, you tend to get lost.

Debian has the wonderful utility "apt-get" to upgrade their components. An utility to which we just mention the package name, the rest is taken care of by itself. Just one requirement. You need a net connection (Having an OSS and no net connection is like having toothbrush/paste with no teeth). Otherwise, its a damn good utility. The best part is that it takes care of all the dependency issues by ITSELF(!!! if only our government runs like this).

Hey, its open source. So, "apt-get" has jumped the bandwagon of redhat also. The utility is parked here. Just pull out the RPM for your distro and install it with RPM. Check out another blog of mine on how to install a particular RPM here.

Once installed, You should be feeling the power in your hands. The power of APT-GET. Now, to the details.

"/etc/apt/sources.list" is the main configuration file. This file contains the link to the latest RPMs to be retrieved from the freshrpms site. The file should always have an uncommented default suitable to suit your system. I had Fedora. Hence, I added the below lines to support fedora's path

#FC1
rpm http://ayo.freshrpms.net fedora/linux/1/i386 os updates freshrpms


Ok. we are ready to upgrade. First, we need to update the latest packages info from the site. Just call
$ apt-get update
.

This call will take care of collecting the info frmo the site. Now, we are ready to upgrade our system. Let met take the example of me installing libgcc. Check out the sequence of commands I used to install. Let met explain after the commands.

$ apt-cache search libgcc
$ apt-cache showpkg libgcc
$ apt-get install libgcc

The first line is like asking "search the packages list for packages containing the word libgcc and list all for me". I got the following (mine is Fedora). Yours may differ based on how you have updated and your distribution.

$ apt-cache search libgcc
libgcc - GCC version 3.3 shared support library
openoffice.org-libs - OpenOffice.org shared libraries

Now, since we have the package listed, we go to the second line. It talks like "show me the version of the package, what it provides, its dependencies and its reverse-dependencies. Mine listed something like this.

# apt-cache showpkg libgcc
Package: libgcc
Versions:
3.3.2-1(/var/state/apt/lists/ayo.freshrpms.
net_fedora_linux_1_i386_base_pkglist.os)
(/var/lib/rpm/Packages)

Reverse Depends:
glibc,libgcc
glibc,libgcc
glibc,libgcc
glibc,libgcc
gcc,libgcc 3.3.2-1
Dependencies:
3.3.2-1 - /usr/sbin/libgcc_post_upgrade (0 (null))
Provides:
3.3.2-1 - /usr/sbin/libgcc_post_upgrade libgcc_s.so.1
(GLIBC_2.0) libgcc_s.so.1(GCC_3.3.1) libgcc_s.so.1
(GCC_3.3)
libgcc_s.so.1(GCC_3.0) libgcc_s.so.1
Reverse Provides:

Now, we know what are the dependencies this package has, and what are all the related RPMs to be installed. Now, comes the best part. You DONT HAVE TO WORRY about this dependencies stuff. All you need to do is to silently call the third command and see apt-get weave its magic. In the end, all the related upgradation, degradations, installations are done successfully and all will be well that ends well.

2 comments:

Vijairaj said...

Apt and dselect were for long, the proud possession of debian users. The high popularity of these tools and the ease they provide in installing and maintaining packages made other distros look like distant last generation products. But things are changing lately. One such tool introduced in fedora is called yum. This tool promises easy package management on rpm based systems.

Joseph Antony said...

More related links here on
apt-cache and on apt-get