Todays Linux class will attempt to answer some of the topic question I collected in a class in the fall. We will go through them in the order I wrote them down. Finally, we will discuss some changes in the distribution landscape for Linux. How does it affect us, and how to pick a distribution.
RPM (Redhat Package Manager) is a tool to install, update, rebuild, and remove applications from Linux.
When Unix was first coming into use there was a need to archive files in a format easy to backup. One of the original tools for this purpose was tar Tape Archive Routine. This tools is given either a list of file, or a directory as input. It then copies the files into a single file. If you do not compress a tar file, you can open it in an editor a view the individual files. So tar’s main purpose was to create an archive preserving their directory structure. If uncompressed, a tar archive is the same size as the original files.
The next improvement was to compress the archive. Originally this was done with the program Compress, and uncompressed with Uncompress. The problem with these two programs was that they were proprietary. The next format which came along was zip . Again originally proprietary, but since taken into an open source version. The GNU people then created the compress/uncompress programs gzip/gunzip, which are actually a single program. The next step was to teach tar to use the gzip program internally. There is also the newer compression program bzip2, which is superior to all the previous ones in terms of small size.
The reason for this discussion of tar is that it was the original way to distribute application packages. A package, in this context is an executable file, any associated libraries, and documentation. When I first installed a Slackware distribution, this is how the applications were packaged.
What are the advantages and disadvantages of tar archive packaging?
Advantages: The format is pretty universal. A tar package created on AT&T Unix, can be read on HPUX. This is not always true, but usually. The files are compressed, and contain both the files and the location information in a single file.
Disadvantages: The package has to be installed from a given location. ie. if the archive writes to bin/zinf you could start in the directory / or the directory /usr/local, or some where else. The package does not include any information to allow removal or updating of the package. Finally there is no information on dependencies, ie. you must have library X installed before you can use this application.
Redhat looked at these issues and decided that it needed something more robust for installing and managing the packages needed in their distributions. Originally, I think RPM was a set of perl scripts. Today the RPM format is used by Redhat, Suse, Mandrake, Yellow Dog, and other distributions. Redhat has created a web site www.rpm.org to manage and continue implementation of the RPM application. The best reference for learning about how to build and use RPMs is Maximum RPM book. It is a fairly complete description of the package manager and how to work with RPMs.
So what can RPM do and how do I use it for day to day use.
First lets talk about what RPM does. It can install packages, uninstall packages, check dependencies, update packages, and maintain a database of what is on your system which were added or modified with the RPM package manager.
RPM packages names contain the basic information about the package. Lets look at a package to understand how this works. I will use the rpm package pdmenu-1.2.69-5mdk.i586.rpm as an example.
First look at the name of the package. It shows the package name as pdmenu. The version is 1.2.69 and this is rpm 5 of that version. It was compiled for the Mandrake distribution, and is for the i586 processor family. The other common name you find in place of processor family is src, meaning source package. So now we have some information about the package we are viewing. Lets use RPM to see what else we can learn about this package. I ran the command rpm -qip pdmenu-1.2.69-5mdk.i586.rpm to get the following results.
Name : pdmenu Relocations: (not relocateable) Version : 1.2.69 Vendor: MandrakeSoft Release : 5mdk Build Date: Mon 05 May 2003 12:21:56 PM EDT Install Date: (not installed) Build Host: bi.mandrakesoft.com Group : Shells Source RPM: pdmenu-1.2.69-5mdk.src.rpm Size : 103003 License: GPL Signature : (none) Packager : Lenny Cartier <email@example.com> URL : http://kitenet.net/programs/pdmenu/ Summary : A simple text-based menu program Description : A simple full screen menu program, intended to be a comfortable login shell for inexperienced users.
This is the information on the package. The options I used were -qip or query, information package. This is the easy to see the information from a package. If the package were installed on your system the command would then be rpm -qi pdmenu . Next we can use the command rpm -qlp pdmenu-1.2.69-5mdk.i586.rpm to see what files are included in the package.
/etc/pdmenurc /usr/bin/pdmenu /usr/lib/pdmenu /usr/lib/pdmenu/cpp.pl /usr/lib/pdmenu/editdir.pl /usr/lib/pdmenu/modem-check /usr/lib/pdmenu/rpm-info-on-command /usr/lib/pdmenu/showdir.pl /usr/share/doc/pdmenu-1.2.69 /usr/share/doc/pdmenu-1.2.69/ANNOUNCE /usr/share/doc/pdmenu-1.2.69/BUGS /usr/share/doc/pdmenu-1.2.69/README /usr/share/doc/pdmenu-1.2.69/TODO /usr/share/doc/pdmenu-1.2.69/changelog /usr/share/doc/pdmenu-1.2.69/examples /usr/share/doc/pdmenu-1.2.69/examples/README /usr/share/doc/pdmenu-1.2.69/examples/ba.lpd /usr/share/doc/pdmenu-1.2.69/examples/newbie /usr/share/doc/pdmenu-1.2.69/examples/newbie/pdmenurc.newbie /usr/share/doc/pdmenu-1.2.69/examples/pdmenurc /usr/share/doc/pdmenu-1.2.69/examples/pdmenurc.complex /usr/share/doc/pdmenu-1.2.69/examples/pdmenurc.monitor /usr/share/man/man1/pdmenu.1.bz2 /usr/share/man/man5/pdmenurc.5.bz2
This is a list of the files included in the package, and where they will be installed. Again if the package was installed on your system the command would be rpm -ql pdmenu .
Lets do a brief introduction of how to use RPM. I will assume you are in the directory which contains the packages, so I will use ./ for the directory to the package.
When you want to add a package to your system, you use the -i or –install option. I tend to use the command rpm -ivvh <package> . This says install, extra verbose output, and hash marks as the files are installed.
When you want to upgrade a package you can download a newer version and run the command rpm -Uvvh <package> or rpm -Fvvh <package> . The difference between -U and -F is upgrade will install the package if it does not exist, but Freshen will only upgrade an existing package.
One issue that often comes up during an Upgrade is dependences. If a package has dependences it will give you a message something like:
error: failed dependencies: libqt.so.3 is needed by opera-7.22-20031103.3
This is RPM’s way of telling you that it needs another package updated before you can install this one. The easiest way to deal with this situation is to upgrade the specified package.
One of RPM’s real strengths is it’s ability to completely remove a package from the system. In windows the install shield program can remove the files, but the registration information is left behind. This might not sound like a big deal but it can definitely hose a windows system.
Since the RPM system keeps a record of all the packages stored on your system you can lookup all the package information without needing the package. The command rpm -qa will produce a list of all the packages on your system. You can check for an individual package by name or by using grep, as in rpm -qa | grep -i perl . That will find all the rpm packages related to perl. Finally the command rpm -qf <filename> will tell you which package contains <filename>. This is useful if you have a file and want to know where it came from.
Another strength of the RPM system is to allow it to build a package on your computer using the libraries and files you have installed. The way this works is by starting with a Source package like: pdmenu-1.2.69-5mdk.src.rpm . Notice that part of the name is src. This means that the package contains the source code. You can use the command rpmbuild –rebuild <packagename> to install the package under /usr/src/redhat, then invoke the compiler to build a binary RPM package which will be available in /usr/src/redhat/RPMS/i386 when it finishes. You can then install the binary package on your system.
For a more hands on approach to RPM let me again recommend Package Management from the Redhat Manual 9.0.
The rpm program has many more options than can reasonably be handled in one lesson. I recommend you read through the man page, or if you want more details, have a look at Maximum RPM listed above.
If you are interesting in an article which discusses the Good, the Bad, and the Ugly of RPM have a look at this article: Is RPM doomed?.
Lets suppose you have just downloaded a new ISO image and want to have a look at it before burning it on a CD. Lets assume the image is called /tmp/magic.iso.
You could start by creating a directory named /mnt/magic. You would then use the command mount -v -t iso9660 -o ro,loop=/dev/loop0 /tmp/magic.iso /mnt/magic. This uses a device known as the loop back device or /dev/loop to mount a CD file image onto your directory tree. This is a good way to examine a CD image you created or downloaded.
Lets suppose you have a set of mp3 files and want to burn them into a CD for easy storage or playing. Here are the steps you could use to accomplish this task.
The Xwindows package for cygwin can be downloaded with the setup program. It is now included in the distribution. Once it is installed you run the command startx to start it. If you would like a better window manager than the default TWM, I would recommend Xfce. You can download Xfce from Dream Wiz . Once you have the package you untar it and tweak the startup file if you want.
This operation is not for the faint of heart. If you make a mistake during the upgrade, you may need to re-install the entire system. But before you do an upgrade, ask yourself, why are you upgrading the kernel instead of the whole distribution? If you want to optimize the kernel or modify the list of drivers you would be better to build rebuild the kernel and install a second kernel rather than upgrade.
If you want to upgrade, you best source of information is directly from Redhat. Assuming you are using Redhat 9.0 have a look at the web page Preparing to Upgrade . This page plus the following pages will walk you through the upgrade process.
For myself, I usually like to build a new kernel, and install that one. The compile takes a while, but the most difficult part is selecting what drivers you want. To build a new kernel follow the steps in Building a Custom Kernel. The advantage of this method is you can have multiple kernels available for booting. By using this method, you can select with Lilo or grub which kernel to boot by default. So if something goes wrong with the build or install, you can simply boot back into your existing kernel and fix the problem. This is both safer and achieves the same results. I would recommend this method if you want to upgrade your kernel.
I don’t know how many of you are up on what is happening in the Linux Distribution scene, but I found these two issues interesting.
Redhat is getting out of the Home User distribution business
Here is a quote from an Email sent to some Redhat Users: “As previously communicated, Red Hat will discontinue maintenance and errata support for Red Hat Linux 7.1, 7.2, 7.3 and 8.0 as of December 31, 2003. Red Hat will discontinue maintenance and errata support for Red Hat Linux 9 as of April 30, 2004. Red Hat does not plan to release another product in the Red Hat Linux line.”
Redhat has setup a community distribution site known as Fedora , to continue the community involvement in Redhat.
Novell to purchase Suse Linux distribution company.
From a news article on the Novel purchase of Suse: “Now that the initial reactions to Novell’s US$210 million acquisition of SuSE Linux have passed – and questions on the who, what, when and how much of the deal have been answered – the broader implications are beginning to hit home in the Linux community.
In order to place these two news issues into perspective lets have a look at Linux and what is a distribution anyway.
One of the first issues to keep in mind is that Linux is in fact only the kernel. What Linus created was a Unix like kernel, which when combined with the GNU tools already existing, constitute what most people today mean when they talk about a Linux system.
So in reality what we mean by a Linux system is a combination of software from many sources. So then a distribution is really a collection of applications which have been selected and compiled to sing and dance together. Given this loose definition we can understand how there are so many Linux distributions available. Some of the best known ones are RedHat, Suse, Debian, Mandrake, Gentoo, Koppix, among many others. Each of these distributions starts with a pool of source code and compiles a set of application to make a working system. Given the flexibility of the Linux system it is not surprising that there are so many distributions. Each company thinks they can do something better than anyone else has done it. This entrepreneurial spirit is what makes for interesting times, and some confusion.
So why should we care if the landscape in the distribution market is changing shape? Other than the amusement value of watching the board being reshuffled, it gives us an excuse to discuss what separates one distribution from another. So with that intro, lets talk about the difference between distributions to get a better understanding of what goes into a creating a distribution.
Now lets be clear, I have no intention of going through all the issues involved, but some a discussion of some general issues will open the door to a better understanding of how to choose a distribution which suits your needs.
Please understand these are my opinions, you are welcome to disagree with me, or present your own views. After all this is a users group, not a classroom.
OK you have heard enough of my opinions, what are yours?
Probably the biggest impact of this distribution consolidation is the ability to download quality distributions for free. Redhat has made it a policy of always posting current distribution CD’s on it’s web server for people to download for free. Neither Mandrake or Suse post their current distribution on the web. But Debian always has, so this might be good for them.
Interesting site for a discussion of distributions is the Distro Watch web site.
Written by John F. Moore
Last Revised: Wed Oct 18 11:01:34 EDT 2017