-->

Previous | Table of Contents | Next

Page 21

not always available. Therefore, the URL may also contain a username and password preceding the hostname:


ftp://smith:mypass@ftp.gnomovision.com/pub/rpms/foobar-1.0-1.i386.rpm

However, entering a password where it can be seen by anyone looking at your screen is a bad idea. So try this format:


ftp://smith@ftp.gnomovision.com/pub/rpms/foobar-1.0-1.i386.rpm

RPM will prompt you for your password, and you'll be in business:


# rpm -i ftp://smith@ftp.gnomovision.com /pub/rpms/apmd-2.4-1.i386.rpm

Password for smith@ftp.gnomovision.com: mypass (not echoed)

#

After you enter a valid password, RPM installs the package.

On some systems, the FTP daemon doesn't run on the standard port 21. Normally this is done for the sake of enhanced security. Fortunately, there is a way to specify a nonstandard port in a URL:


ftp://ftp.gnomovision.com:1024/pub/rpms/foobar-1.0-1.i386.rpm

This URL will direct the FTP request to port 1024. The --ftpport option is another way to specify the port. This option is discussed later in the chapter, in section 2.4.15.

2.2.2. A Warning Message You Might Never See

Depending on circumstances, the following message might be rare or very common. While performing an ordinary install, RPM prints a warning message:


# rpm -i cdp-0.33-100.i386.rpm

warning: /etc/cdp-config saved as /etc/cdp-config.rpmorig

#

What does it mean? It has to do with RPM's handling of config files. In the previous example, RPM found a file (/etc/cdp-config) that didn't belong to any RPM-installed package. Because the cdp-0.33-100 package contains a file of the same name that is to be installed in the same directory, there is a problem.

RPM solves this the best way it can. It performs two steps:

  1. It renames the original file to cdp-config.rpmorig.
  2. It installs the new cdp-config file that came with the package.

Continuing our example, if we look in /etc, we see that this is exactly what has happened:


# ls -al /etc/cdp*

-rw-r--r--    1 root    root    119 Jun 23 16:00 /etc/cdp-config

-rw-rw-r--    1 root    root     56 Jun 14 21:44 /etc/cdp-config.rpmorig

#

Page 22

This is the best possible solution to a tricky problem. The package is installed with a config file that is known to work. After all, the original file may be for an older, incompatible version of the software. However, the original file is saved so that it can be studied by the system administrator, who can decide whether the original file should be put back into service.

2.3. Two Handy Options

There are two options to rpm -i that work so well and are so useful that you might think they should be RPM's default behavior. They aren't, but using them requires only that you type an extra two characters, which are described in the following sections.

2.3.1. Getting a Bit More Feedback with -v

Even though rpm -i is doing many things, it's not very exciting, is it? When performing installs, RPM is pretty quiet unless something goes wrong. However, we can ask for a bit more output by adding -v to the command:


# rpm -iv eject-1.2-2.i386.rpm

Installing eject-1.2-2.i386.rpm

#

By adding -v, RPM displayed a simple status line. Using -v is a good idea, particularly if you're going to use a single command to install more than one package:


# rpm -iv *.rpm

Installing eject-1.2-2.i386.rpm

Installing iBCS-1.2-3.i386.rpm

Installing logrotate-1.0-1.i386.rpm

#

In this case, there were three .rpm files in the directory. By using a simple wildcard, it's as easy to install 1 package as it is to install 100!

2.3.2. -h: Perfect for the Impatient

Sometimes a package can be quite large. Other than watching the disk activity light flash, there's no assurance that RPM is working, and if it is, how far along it is. If you add -h, RPM will print 50 hash marks (#) as the install proceeds:


# rpm -ih eject-1.2-2.i386.rpm

##################################################

#

When all 50 hash marks are printed, the package is completely installed. Using -v with -h results in a very nice display, particularly when you're installing more than one package:


# rpm -ivh *.rpm

eject          ##################################################

iBCS           ##################################################

logrotate      ##################################################

#

Page 23

2.4. Additional Options to rpm -i

Normally rpm -i, perhaps with -v and -h, is all you'll need. However, there may be times when a basic install is not going to get the job done. Fortunately, RPM has a wealth of install options to make the tough times a little easier. As with any other powerful tool, you should understand these options before putting them to use. Let's take a look at them.

2.4.1. Getting a Lot More Information with -vv

Sometimes it's necessary to have even more information than we can get with -v. By adding another v, we can start to see more of RPM's inner workings:


# rpm -ivv eject-1.2-2.i386.rpm

D: installing eject-1.2-2.i386.rpm

Installing eject-1.2-2.i386.rpm

D: package: eject-1.2-2 files test = 0

D: running preinstall script (if any)

D: setting file owners and groups by name (not id)

D: ///usr/bin/eject owned by root (0), group root (0) mode 755

D: ///usr/man/man1/eject.1 owned by root (0), group root (0) mode 644

D: running postinstall script (if any)

#

The lines starting with D: have been added by using -vv. The line ending with files test = 0 means that RPM is going to install the package. If the number were nonzero, it would mean that the --test option is present, and RPM would not perform the install. For more information on using --test with rpm -i, see section 2.4.2.

Continuing with this example, we see that RPM next executes a preinstall script (if there is one), followed by the actual installation of the files in the package. There is one line for each file being installed, and that line shows the filename, ownership, group membership, and permissions (or mode) applied to the file. With larger packages, the output from -vv can become quite lengthy! Finally, RPM runs a postinstall script, if one exists for the package. We'll be discussing pre- and postinstall scripts in more detail in section 2.4.10.

In most cases, it will not be necessary to use -vv. It is normally used by software engineers working on RPM itself, and the output can change without notice. However, it's a handy way to gain insights into RPM's inner workings.

2.4.2. --test: Perform Installation Tests Only

There are times when it's more appropriate to take it slow and not try to install a package right away. RPM provides the --test option for that. As the names implies, it performs all the checks that RPM normally does during an install, but it stops short of actually performing the steps necessary to install the package:


# rpm -i --test eject-1.2-2.i386.rpm

#

Previous | Table of Contents | Next