FreeOS.com logo

FreeOS Most Popular
* Most Read stories
* Commented Stories
* Active Categories
* Non Linux Section
* User Submitters
* Top Polls
* Top Authors
* Top Reviews
* Top Rated
* Top Search Terms

Top Articles
* Writing a Linux device driver
* The Linux filesystem explained
* Samba NT Domain Controller
* Setting up Squid as your caching HTTP/FTP proxy
* Web server tutorial - Part 1

FreeOS Highlights
* Howtos (72)
* Reviews (20)
* Opinions (18)
* Interviews (8)
* News (3)

My FreeOS

Nick:
Pass:
Register

Forgot your password?

Contact Us
Contact Us

       

Project: Linux triangle Articles triangle

RPM usage for newbies

By Mayank Sarup <mayank@freeos.com>
Posted: ( 2000-10-20 08:06:44 EST by )

The Red Hat Package Manager (RPM) has establised itself as one of the most
popular distrubution formats for linux software today. A first time user may feel
overwhelmed by the vast number of options available and this article will
help a newbie to get familiar with usage of this tool.

RPM stands for Red Hat Packet Manger. The traditional way to install a
package was to take an archive and then just extract the files off it into
the required directories. This worked fine but then the administrator
faced a problem when it came to updating the packages. He must locate the
files from the previous install and then make sure they are removed from
the system. RPM helps here. It is a easier and more flexible way of
installation and maintainence of packages. Upgrades are easy. RPM
maintains a database of the packages installed on your system as well as
the locations of the files and the version numbers. Anytime you install a
package in rpm format, RPM will check to see whether there are any files
are in conflict between the packages installed and the packages being
installed. It will also tell you whether any other packages need to be
installed for the software to work. All in all RPM makes life a lot
easier.

RPM has become really popular and several distributions are now based on
it. Red Hat, SuSE, Mandrake, Caldera -- all use the rpm format to maintain
the system software.

Installation of an RPM

RPM installation, updation and removal will have to be done as root.
Querying the database does not require you to be root.

A basic installation of an RPM file can be accomplished by

rpm -ivh

e.g - rpm -ivh foo-1.03.rpm

At this point rpm will go out and check whether the files required by foo
are installed on the system or not. If some other package needs to be
installed then it will inform you of the requirements and exit. If some
files from the package have been installed by some other package then you
will be notified of that also.

Multiple files can also be specified using wildcards so the following is
also legal.

rpm -ivh foo*.rpm

Let's look at the options specified.

-i = Specifies installation as the action to be taken.
-v = Will display additional information while installing.
-h = Prints 50 hash marks (#) as installation progresses.

You can get by with just -i but it is generally a good idea to specify -v
and -h too so that you get proper feedback.

Other options that may be given are

--replacepkgs = Sometimes you may need to re-install a package that has
been damaged then you need to specify this option. If you try a
installation then rpm will say that the package is already installed.

--replacefiles = If you get a package with newer versions of a file and
you would like to install it then use this option to replace the files.

--force = Force the installation to go ahead regardless of any
errors. Failed dependencies will still stop it though.

--nodeps = Package dependencies are any packages that are required by a
certain software. Fetchmail may require sendmail or some other mail server
to be present on your system. Sendmail is the package dependency for
fetchmail. You might have some other mail server installed, like qmail,
and you want to go ahead and install fetchmail. Adding --nodeps to the
command line tells rpm to skip the checkup for any dependency packages and
to go ahead and install fetchmail.

Another place this option is very useful is when you have packages that
require each other. So package A will say that package B should be
installed, but package B will want A to be installed first. Just install
one of the packages with --nodeps before you go on to install the other
one.

RPM can also install over the net. If you happen to know the full url of
your rpm file then just enter the following to get and install the
package.

rpm -ivh ftp://ftp.linux.tucows.com/pub/RedHat/foo.rpm

If the site requires a valid login and password pair then you can enter
that in the url too.

rpm -ivh ftp://yahoo@ftp.linux.tucows.com/put/RedHat/foo.rpm

You will be prompted for the password after which the file will be
downloaded and installed.

Updating

Updating your current package installation. If you come across a updated
package then upgrading would be the right choice. Syntax is pretty much
the same as installation. The default behaviour of this command is that
rpm will first check for a older version of the package. If one is found
then that package is updated otherwise normal installation is done. This
is the recommended command to use because it prevents you from installing
multiple versions of the same package.

rpm -Uvh filename.rpm

Un-Installation

An package installed via rpm can be uninstalled by rpm -e

The package name would be the name of the package at installation.

e.g - rpm -e gpm would remove the package named gpm

Occasionally you might get dependency errors when removing packages that
are required by other packages. Use --nodeps here too tell rpm to ignore
such dependency errors and uninstall the package regardless.

Query

Query is one useful function that you really need to know. Generally a
query is given with the -q followed by a query option.

If you want to check out the version of the installed package then simply
run a '-q' on the package.

rpm -q samba

- samba-2.0.6-62

-f = You see a file on your drive and you want to know what package it
comes in then use

rpm -qf /usr/sbin/smbd

-samba-2.0.6-62

-i = Information regarding a package installed on your system.

rpm -qi samba

- Information regarding here. Description, version and packager
and other miscellaneous information.

-l = Long listing of the files in a package installed in your system. Shows
you the full paths where the files have be installed to.

rpm -ql samba

- /usr/bin/addtosmbpass
/usr/bin/convert_smbpasswd
/usr/bin/mksmbpasswd.sh
/usr/bin/smbadduser
/usr/bin/smbpasswd
/usr/bin/smbstatus
.....

-a = Show a list of all packages installed on your system.

This one comes in handy when you want to check whether a certain package
is installed on the system. Just pipe the output of this to grep and you
can check whether a package is installed or not.

rpm -qa | grep samba

- samba-2.0.6-62

-p = This has to be used with the -q switch. Do this if you want to query
a file instead of the rpm database. All the other options given above
work as expected. Only -a will not work since only one kind of query can
take place at a time.

rpm -qi samba

Will query the rpm database for information regarding the Samba
package which is already installed on the system.

rpm -qip samba-2.0.7-20000425.i386.rpm

Will query the file named samba-2.0.7-20000425.i386.rpm.

For normal usage, the above commands will do most of your work. RPM has a
wealth of options. The man page is a good place to study all these options
and see what can work for you.

RPM.org
Maximum RPM
RPM Howto

Other articles by Mayank Sarup

Current Rating: [ 8.21 / 10 ] Number of Times Rated: [ 63 ]

More Articles
* Know Linux
* If I could re-write Linux
* Interview with Mozilla engineering director Chris Hofmann
* Response to SCO's Open Letter
* GNU Linux Security

Contents
Articles
  Howtos
  Interviews
  News
  Opinions
  Reviews
Comparison
Links
  Articles
  Howtos
  Interviews
  Opinions
  Reviews
  Websites
News

Linux
About Linux

Print It!
Printer Friendly Version