Package Management With RPM

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 21

Package Management with RPM

Packages
• Most software applications designed for Linux
or Unix systems are distributed as packages,
which are archives that contain the pre-
compiled binary software files, installation
scripts, configuration files, dependency
requirements, and other details about the
software
Linux Package Manager
Two type of Package manager
• RPM(Redhat Package Manager)
Can’t install automatic dependencies of any
package
• YUM(Yellowdog updater Modifer )
Can’t install automatic dependencies of any
package
RedHat Package Manager
With RPM
• system updates easy
• Installing, uninstalling, and upgrading RPM
packages can be accomplished with short
commands.
• database of installed packages and their files
are maintained
RPM modes of Operation

RPM has five basic modes of operation


• Installing
• Uninstalling
• Upgrading
• Querying
• Verifying
RPM details
To complete details and options, try
• rpm –help
or
• man rpm
• Package Name
• Version
• Supporting Architecture
# rpm –qa-----Display all packages that are
installed in our system
• Rpm –qa | wc –l
• Shows how many packages installed
Finding RPM Packages

• An Internet search returns many RPM


repositories, but if you are looking for RPM
packages built by Red Hat, they can be found
at the following locations:
• The Red Hat Enterprise Linux CD-ROMs
Installing Packages

• RPM packages typically have file names like foo-1.0-1.i386.rpm. The file
name includes the package name (foo), version (1.0), release (1), and
architecture (i386).
• To install a package, log in as root and type the following command at a
shell prompt:
rpm -ivh foo-1.0-1.i386.rpm

i –install
v – verbose
h - hash
To upgrade an installed package
• To upgrade a package,

rpm -Uvh foo-1.0-1.i386.rpm

Preparing... ########################################### [100%]


1:foo ########################################### [100%]

• The signature of a package is checked automatically when installing or


upgrading a package. The signature confirms that the package was signed
by an authorized party.
Package already installed
• If a package of the same name and version is already installed, the
following output is displayed:

Preparing... ########################################### [100%]


package foo-1.0-1 is already installed

• However, if you want to install the package anyway, you can use the --
replacepkgs option, which tells RPM to ignore the error:

rpm -ivh --replacepkgs foo-1.0-1.i386.rpm


Conflicting Files

• If you attempt to install a package that contains a file which has already
been installed by another package, the following is displayed:

Preparing... ########################################### [100%]


file /usr/bin/foo from install of foo-1.0-1 conflicts with file from package
bar-2.0.20

• To make RPM ignore this error, use the --replacefiles option:

rpm -ivh --replacefiles foo-1.0-1.i386.rpm


Uninstalling package

• Uninstalling a package is just as simple as installing one. Type the


following command at a shell prompt:

rpm -e foo

Notice that we used the package name foo, not the name of the original
package file foo-1.0-1.i386.rpm. To uninstall a package, replace foo with
the actual package name of the original package.
• Rpm –e tar –nodeps
• Used to remove package forcefully
Upgrading package

• Upgrading a package is similar to installing one. Type the following


command at a shell prompt:

rpm -Uvh foo-2.0-1.i386.rpm

As part of upgrading a package, RPM automatically uninstalls any old versions


of the foo package. Note that -U will also install a package even when
there are no previous versions of the package installed.
Freshening package

• Freshening is similar to upgrading, except that only existent packages are


upgraded. Type the following command at a shell prompt:

rpm -Fvh foo-1.2-1.i386.rpm

RPM's freshen option does not install a package if no previously-installed


package of the same name exists. This differs from RPM's upgrade option,
as an upgrade does install packages whether or not an older version of the
package was already installed.

If you have just downloaded a large number of different packages, and you
only want to upgrade those packages that are already installed on your
system, freshening does the job.

rpm -Fvh *.rpm


Querying a package

• The RPM database stores information about all RPM packages installed in
your system. It is stored in the directory /var/lib/rpm/, and is used to
query what packages are installed, what versions each package is, and any
changes to any files in the package since installation, among others.
• To query this database, use the -q option. The rpm -q package name
command displays the package name, version, and release number of the
installed package package name . For example,
• Using rpm -q foo to query installed package foo might generate the
following output:

foo-2.0-1
Querying a package
• rpm –qa // list all installed packages
• rpm –q httpd // Checking if a package is installed or not
• rpm –ql httpd List all the files for a package
Verifying a package

• Verifying a package compares information about files installed from a


package with the same information from the original package.
• To verify ALL installed packages throughout the system:
• rpm –Va
• To verify an installed package against an RPM package file:
• rpm -Vp foo-1.0-1.i386.rpm
• This command can be useful if you suspect that your RPM databases are
corrupt.

You might also like