Contact us

Print

Installing, Querying and Uninstalling Packages

In this Lab you will kill two birds with one stone. You will learn how to use the Red Hat package management system and you will also install the Openoffice.org word processing application on your system.

You will use the Red Hat package manager (RPM) to perform the install because the Red Hat package manager has become the standard package installation tool for major distributions such as Fedora™, SuSE©, Mandrake© and so on.

As with most packages – there are issues of dependencies to deal with. This results mostly from issues of “shared libraries”.
When trying to install a package, the package manager (RPM) may not always tell you what other rpm packages you need to satisfy these dependencies – in-which case it will usually give you clues as to the exact files (libraries) you need.


PREAMBLE:

Before proceeding, with the following exercises, download the following files from your software distribution location (ftp server, web server, DVD-ROM or CD-ROM media).

i. openoffice.org-writer-*.rpm - wordprocessor application of openoffice.org
ii. openoffice.org-core-*.rpm - core libraries and support files for openoffice.org
iii. libwpd-0*.rpm - Library that handles Word Perfect documents.
iv. curl-7*.rpm - A utility for getting files from remote servers
v. libidn-0*.rpm - Internationalized Domain Name support library


Assuming that you want to install the openoffice.org software package from the install Fedora Core 4 DVD-ROM media and that the DVD-ROM is mounted at the “/media/dvd” mount point – you will find all the files referenced in the list above under the “/media/dvd/Fedora/RPMS” directory.

You can also manually download the files needed directly from the any of the Fedora Core 4 mirror sites. For example:

http://mirrors.kernel.org/fedora/core/4/i386/os/Fedora/RPMS/ (external link)
or
http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/ (external link)


NOTES:

The operating system (OS) installation exercise performed in Lab 1 recommended a specific group/list of applications to select during the initial OS install. The “Office/Productivity” group was NOT on the list. One of the reasons for this was because of future exercises like the one in this section.

If you selected the “Office/Productivity” group of packages during the initial operating system installation, then you already have the “openoffice.org-writer*” word processing application installed on your system. This is because the openoffice.org suite is grouped under the “Office/Productivity” package group. As a result, some of the steps in the following section will not be very relevant to you since you already have the software installed.
To query packages for information.

1. To see a list of all the packages currently install on your local system type:

root@localhost root# rpm –qa

libgcc-4.0.0-8
basesystem-8.0-5
glibc-2.3.5-10
device-mapper-1.01.02-1.0
ethtool-3-1
…………

You should get a very long list.

2. You will use one of the numerous switches of the rpm command to obtain information about the
openoffice.org-writer- *.rpm package.
Make you sure are in the directory that contains the “openoffice.org-writer- *.rpm” package that you
downloaded earlier, then type (The steps below are running the commands from the
“/media/dvd/Fedora/RPMS/” directory on our sample system with the FC4 DVD-ROM mounted):

root@localhost RPMS# rpm –qip openoffice.org-writer-*rpm

warning: openoffice.org-writer-*.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Name : openoffice.org-writer Relocations: (not relocatable)
Version : 1.9.104 Vendor: Red Hat, Inc.
Release : 2 Build Date: Tue 24 May 2005 04:59:17 AM PDT
Install Date: (not installed) Build Host: tweety.build.redhat.com
Group : Applications/Productivity Source RPM: openoffice.org-1.9.104-2.src.rpm
Size : 5933133 License: LGPL/SISSL
Signature : DSA/SHA1, Tue 24 May 2005 02:21:10 PM PDT, Key ID b44269d04f2a6fd2
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://www.openoffice.org/ (external link)
Summary : writer module for openoffice.org
Description :
wordprocessor application of openoffice.org


3. From your output in the previous step, what is the summary of description for the
“openoffice.org-writer- *.rpm” package ?


4. If you are interested in the particular files that are contained in the openoffice.org-writer- *.rpm
package, you could list all the files it provides by typing:

root@localhost RPMS# rpm –qlp openoffice.org-writer-*rpm

warning: openoffice.org-writer-*rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
/usr/bin/oowriter
/usr/lib/openoffice.org1.9.104
/usr/lib/openoffice.org1.9.104/help
………..

5. It is possible to download a corrupted or tainted file. Verify the integrity of the package you -
downloaded. Type:

root@localhost RPMS# rpm -K openoffice.org-writer-*rpm

openoffice.org-writer-*.rpm: (SHA1) DSA sha1 md5 (GPG) NOT OK (MISSING KEYS:
…………. GPG#4f2a6fd2)

The above output normally might mean there is something wrong with the package. But before we
come to that conclusion, we will first import/install the packager’s (Fedora’s) public key into the system.

To import a public key via rpm

1. There are several location from which you can obtain a vendor’s public key - vendor’s ftp or http site,
distribution media, local source etc.. Import Fedora’s public key from your local system. Type:

root@localhost RPMS# rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora

2. After importing the public key, try verifying the package again. Type:

root@localhost RPMS# rpm -K openoffice.org-writer-*rpm

openoffice.org-writer-*.rpm: (sha1) dsa sha1 md5 gpg OK

Note that most of the output is in lower case now- This indicates success.



To install packages

Installing packages via rpm can be very easy sometimes and can be a pain at other times.
In this example you will try to install the openoffice.org-writer package (openoffice.org-writer-*rpm).

While trying to install software on your system, you might stumble on issues of “failed dependencies”
For example if you try to install package “abc.rpm” the RPM installer might complain about some failed dependencies. It might tell you that package “abc.rpm” requires another package “xyz.rpm” to be installed first.
Dependencies can be regarded as prerequisites.

The output of the error you get, might help direct you to the package you need to install first, in order to satisfy the requirements of the original software.

In the exercise below your primary objective will be to try to install the “openoffice.org-writer-*rpm” package, but when trying to install it might complain about failed dependencies.

The “openoffice.org-writer” package that you will be installing below is one of the more tricky ones to install because it depends on a couple of other packages. Most other packages are easier to install.


1.cd to the location/directory that you downloaded the packages into.





2. Run a dry test to see what will happen if you try to install the openoffice.org-writer- *.rpm
package. Type:

root@localhost RPMS# rpm -Uvh --test openoffice.org-writer-*rpm

error: Failed dependencies:
openoffice.org-core = 1:1.9.104-2 is needed by openoffice.org-writer-1.9.104-2.i386
libwpd >= 0.8.0 is needed by openoffice.org-writer-1.9.104-2.i386
libcomphelp4gcc3.so is needed by openoffice.org-writer-1.9.104-2.i386
libsb680li.so is needed by openoffice.org-writer-1.9.104-2.i386
……………….


NOTE:

According to the output of the test above, the openoffice.org-writer package needs/requires that the openoffice.org-core* and the libwpd* packages be installed. i.e. those two packages are a prerequisite to installing openoffice.org-writer.
You can forcefully install the package using the “nodeps” option, if you absolutely know what you are doing. But this is generally a BAD practice.

3. Query the openoffice.org-core package for information. Type:

root@localhost RPMS# rpm -qip openoffice.org-core-*.rpm

4. From your output in the previous step, what is the summary of description for the
“openoffice.org-core” package and what version is it ?



5. Run a test install of the “openoffice.org-core” package. Type:

root@localhost RPMS# rpm -Uvh --test openoffice.org-core-*.rpm

error: Failed dependencies:
curl is needed by openoffice.org-core-1.9.104-2.i386
libcurl.so.3 is needed by openoffice.org-core-1.9.104-2.i386
libwpd-0.8.so.8 is needed by openoffice.org-core-1.9.104-2.i386

More dependency issues.

The first line of the sample output above suggests that a package called curl is needed by openoffice.org-core.

6. Run the dry-run test of an install of the suggested curl package. Type:

root@localhost RPMS# rpm -Uvh --test curl-7*.rpm

error: Failed dependencies:
libidn.so.11 is needed by curl-7.13.1-3.i386

The previous output recommends that a library named “libidn.so*” is needed by curl. With any luck, the libidn*.rpm package will provide this library.

7. Install the Install the libidn-*.rpm package. We wont bother testing this time. We’ll just hope. Type:

root@localhost RPMS# rpm -Uvh libidn-0*.rpm

Preparing... ######################################## 100%
1:libidn ######################################## 100%

The output shows the “libidn” package was successfully installed and we have satisfied the prerequisite of the curl package.

8. Try to install the curl package. Type:

root@localhost RPMS# rpm -Uvh curl-7*.rpm

Preparing... ######################################## 100%
1:curl ######################################## 100%

curl is now installed.

9. Lets do a test run of the openoffice.org-core-*.rpm package again. Type:

root@localhost RPMS# rpm -Uvh — test openoffice.org-core-*.rpm

error: Failed dependencies:
libwpd-0.8.so.8 is needed by openoffice.org-core-1.9.104-2.i386


The previous error shows that we still need something that provides the library named “libwpd”

10. Install the libwpd-0.*.rpm package. Type:

root@localhost RPMS# rpm -Uvh libwpd-0.*.rpm

Preparing... ########################################### 100%
1:libwpd ########################################### 100%

Good we are making some headway.

11. You can now install the openoffice.org-core package. Type:

root@localhost RPMS# rpm -Uvh openoffice.org-core-*.rpm

Preparing... ###################################### 100%
1:openoffice.org-core ###################################### 100%


12. Finally we can now achieve our primary objective - which was to install the openoffice.org-writer.
Type:

root@localhost RPMS# rpm -ivh openoffice.org-writer-*.rpm

Preparing... #################################### 100%
1:openoffice.org-writer #################################### 100%


NOTES:

i. RPM supports transactions. In the previous exercises we could have performed a single rpm transaction that included the original package we wanted to install (i.e. ) as well as all the packages and libraries (i.e. openoffice.org-core, libwpd, curl etc) it depends on. This would have been possible since we already have already downloaded the relevant packages and we know the path to where the files are.

A single command such as the one below would have sufficed:

root@localhost RPMS# rpm -Uvh openoffice.org-writer-*.rpm openoffice.org-core-*.rpm \
> libwpd-0*.rpm curl-7*.rpm libidn-0*.rpm


13. You may have noticed that when you installed the openoffice.org-writer package, you used the command - “rpm -ivh” (step 12) but when you installed the other packages package you used the command: “rpm -Uvh” (step 10, 11 etc).

Consult the man page for rpm and write down the difference between the -i and -U option when
used with the rpm command.





TIPS!!

If you are in a GUI environment with X window running, you can use the “system-config-packages” program to quickly install and uninstall programs ( or groups of programs) from your system. Type:

root@localhost root# system-config-packages

But, this is Linux. Right? We wouldn’t want to make things too easy !!

To un-install packages

Un-installing packages is almost just as easy as installing, with Red Hat’s package manager (RPM).
In this exercise you will try to un-install the libidn package you installed earlier.

1. Un-install the “libidn” package from your system. Type:

root@localhost root# rpm -e libidn

error: Failed dependencies:
libidn.so.11 is needed by (installed) curl-7.13.1-3.i386


Explain in detail why you couldn’t remove the package?


2. If you want to break the package that relies on libidn and forcefully remove the package from your system. Type:

root@localhost root# rpm -e --nodeps libidn


NOTES:

i. The “nodeps” option means No dependencies. i.e. ignore all dependencies.

ii. The above is just to show you how to forcefully remove a package from your system. There may be
times when you need to this, but it is generally not a good practice.

iii. Forcefully removing a package “xyz” that another installed package “abc” relies on effectively makes package “abc” unusable or at the very least somewhat broken.


4. Re-install the libidn package you just un-installed to keep everything else happy.

What is the command to do this?


Created by: system. Last Modification: Tuesday 25 of November, 2008 17:32:02 EST by admin.

...