Packaging software with RPM
The Red Hat Package Management system is a well-designed, fully functional, user-friendly method of managing applications and programs within the Linux environment. The RPM technology was unique to Red Hat Linux, but it is also using with many other distributions, such as Mandrake, Caldera, and SuSE.
What is a Package Management System?
Package Management System is a collection of tools to automate the process of installing ,upgrading,configuring and removing applications,which also comprises tracking for version updates and dependencies.
What is RPM?
RedHat Package Manager (RPM) is one of the package Management System (PMS) ,primarily intended for Linux distributions.
RPM allows to take the source code for newsoftwsre and package it into source and binary form,such that binaries can be easily installed and tracked and source can be rebuilt.
What are all the features of RPM?
- Non interactive,scriptable installation
- Tracking,querying and verifying
- Dependancy tracking
- Digitally signed software
How do you install software packages using RPM?
To install an rpm package, use the following command followed by the file name:
i – Install package
v – Verbose mode
h – Print hash marks while the package archive is unpacked
# rpm -ivh <Package file Name>
How will you Update an RPM?
To update an rpm package use the “-U” attribute .
# rpm -Uvh <Package file Name>
How do you list what software packages are installed?
To list all the installed software packages on your system using the following command:
# rpm -qa
How do you list information about a package?
To see if a specific package is installed based on its name type the following command followed by the text of the package name:
# rpm -qa <package Name>
To get a summary description about a certain package type the following command followed by the package name:
# rpm -qi <package Name>
How do you list files associated with a package?
To list all files on the system that are associated with a package type the following command:
# rpm -ql <package Name>
To list what package is associated with a specific file:
# rpm –qf <file path>
# rpm -qf /usr/bin/testfile
How do you remove software packages I do not need?
Before we can attempt to remove a package we need to check if the package has any conflicts or dependencies. We use the rpm attribute “-e” for removing but include the attribute “–test” to only test and not actually attempt to remove the package:
# rpm -e --test <package Name>
Remove a package without dependencies by using the attribute “-e”:
# rpm -e <package Name>
To force the removal of a package use the attribute “–nodeps–”:
# rpm -e --nodeps <package Name>
How do you verify an installed package against RPM database to ensure its not different from original?
Verifying an installed package is important for ensuring the files associated with a package have not been altered. This is useful for when a program is failing and as security measure.
Verify all files
# rpm --verify -a
Verify a packages files:
# rpm –verify <package Name>
If the result is empty then the package files are unaltered compared to the original state.
Verify a specific file that is part of a package:
# rpm --verify --file <File Path> # rpm --verify --file /usr/bin/testfile
Interpreting the verify results:
There are 8 tests performed and each tests result is shown before the file path. A dot “.” signifies a pass.
. . . . . . . . c /etc/TestApp/Test.cf
The tests and error codes are:
- M – Mode
- G – Group
- U – User
- D – Device
- T – Time
- L – Link
- S – Size
- 5 – MD5 checksum