SlideShare a Scribd company logo
RPM: The RPM Package
Manager
RPM (RPM Package Manager; www.rpm.org) works only with software packages built for
processing by RPM; it can download, install, uninstall, upgrade, query, and verify RPM packages.
The files that hold these packages have a filename extension of .rpm. RPM uses the local RPM
installation database to track the locations where software packages are installed, the versions
of the installed packages, and the dependencies between the packages.
RPM uses the Berkeley Database (Berkeley DB or BDB) and stores the database files in
/var/lib/rpm. RPM forms the basis for yum: yum finds packages, downloads them from
repositories, and then calls RPM to install/upgrade/remove the packages.
Querying Packages and Files
The following rpm command displays a list of one-line summaries of all packages
installed on the system:
$ rpm -qa
mtools-4.0.15-2.fc15.i686
iwl6000-firmware-9.221.4.1-2.fc15.noarch
gnome-desktop3-2.91.93-1.fc15.i686
libmusicbrainz3-3.0.3-3.fc15.i686
dejavu-fonts-common-2.32-2.fc15.noarch
pptp-1.7.2-12.fc15.i686
The –q option queries the package database; the –a option specifies all packages.
Without –a, –q takes the name of a package as an argument and displays information
about that package only. For instance, rpm –q ypserv tells you whether the ypserv
package is installed and, if so, which version is installed. Use the –ql options to list the
files in a package.
$ rpm -q ypserv
package ypserv is not installed
$ rpm -ql logrotate
/etc/cron.daily/logrotate
/etc/logrotate.conf
/etc/logrotate.d
/usr/sbin/logrotate
/usr/share/doc/logrotate-3.7.9
/usr/share/doc/logrotate-3.7.9/CHANGES
/usr/share/doc/logrotate-3.7.9/COPYING
/usr/share/man/man5/logrotate.conf.5.gz
/usr/share/man/man8/logrotate.8.gz
/var/lib/logrotate.status
With the –qi options, rpm displays information about a package:
$ rpm -qi logrotate
Name : logrotate
Version : 3.7.9
Release : 8.fc15
Architecture: i686
Install Date: Wed 23 Mar 2011 05:37:59 PM PDT
Group : System Environment/Base
Size : 84226
License : GPL+
Signature : RSA/SHA256, Mon 21 Mar 2011 03:05:16 PM PDT, Key ID b4ebf579069c8460
Source RPM : logrotate-3.7.9-8.fc15.src.rpm
Build Date : Mon 21 Mar 2011 06:28:12 AM PDT
Build Host : x86-06.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
Summary : Rotates, compresses, removes and mails system log files
Description :
The logrotate utility is designed to simplify the administration of
log files on a system which generates a lot of log files. Logrotate
allows for the automatic rotation compression, removal and mailing of
log files. Logrotate can be set to handle a log file daily, weekly,
monthly or when the log file gets to a certain size. Normally,
logrotate runs as a daily cron job.
Install the logrotate package if you need a utility to deal with the
log files on your system.
You can use the –qf options to determine which package a file belongs to; it works
with installed packages only. Use the yum whatprovides command (page 537) to
search repositories for the same information. The following command shows that
more is part of the util-linux package:
$ rpm -qf /bin/more
util-linux-2.19-3.fc15.i686
Include the –p option with other options to query an uninstalled RPM package file:
$ ls ypser*
ypserv-2.24-2.fc15.i686.rpm
$ rpm -qip ypserv-2.24-2.fc15.i686.rpm
Name : ypserv
Version : 2.24
Release : 2.fc15
Installing, Upgrading, and Removing
Packages
Although it is frequently easier to use yum or gpk-application, you can use rpm to download,
install, upgrade, or remove a package. Run rpm with root privileges; although you can run rpm
as a nonprivileged user, you will not have permission to write to the necessary directories during
an install or uninstall, and the procedure will fail. During a query, you do not need to work with
root privileges, so you can and should work as a nonprivileged user. Give the –U (upgrade)
option, followed
by the name of the file that contains the RPM version of the package you want to install. The –U
option upgrades existing packages and installs new packages (as though you had used the –i
option). For kernels, use –i (not –U) to leave the old kernel intact when you install a new kernel.
Add the –v (verbose) option to display more information about what is happening and the –h (or
––hash) option to display hash marks as the package is unpacked and installed.
Installing a package For example, the following command installs the samba package on the local
system:
# ls samba*
samba-3.6.0-64pre1.fc15.1.i686.rpm
# rpm -Uvh samba-3.6.0-64pre1.fc15.1.i686.rpm
Preparing... ########################################### [100%]
1:samba ########################################### [100%]
When you install a package, the rpm file must be in the working directory, or you
must use a pathname that points to the rpm file. If you specify an FTP or HTTP
URL, rpm will download the package before installing it (but it will not download
or install dependencies):
# rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/updates/15/i386/bind-9.8.0-5.P2.fc15.i686.rpm
Removing a
package
The following command removes the samba package. You can give the command
from any directory:
# rpm -e samba
error: Failed dependencies:
samba is needed by (installed) system-config-samba-1.2.91-2.fc15.noarch
When you run this command, rpm reports that another package, system-configsamba,
is dependent on the samba package. To remove the samba package, you have
two choices: You can ignore the dependency by including the rpm ––nodeps option or
you can remove the dependent package and then remove the samba package.
# rpm -e system-config-samba
# rpm -e samba
If you remove the samba package without removing the package that is dependent
on it, the utilities within the dependent package will not work. In the preceding
example, the system-config-samba utility will not work.
When you use rpm to remove a package, rpm queries package database to find the
information it needs to uninstall the package and removes links, unloads device drivers,
and stops daemons as necessary. Refer to the rpm man page for more rpm options.
Installing a Linux Kernel Binary
The following steps install a Linux kernel binary from an RPM package. If you simply
want to install the latest kernel for the local system, give the command yum
install kernel instead. Refer to Chapter 15 when you want to configure and rebuild
a kernel from source files, rather than installing a new, prebuilt kernel binary.
1. Run rpm with the –i option to install the new kernel. Do not use the –U
option: You are installing a new kernel that has a different name than the
old kernel; you are not upgrading the existing kernel.
2. Make sure the new kernel works before you remove the old kernel. To verify the new kernel
works, reboot the system using the new kernel. You might want to wait a while before removing
the old kernel to make sure that no problems arise with the new one.
3. When you are satisfied with the new kernel, remove the old kernel using rpm with the –e
option; you must specify the kernel version number. If necessary, you can manually remove an
old kernel by removing files whose names contain the release number from /boot or / (root).
Remove information about the old kernel from grub.conf. Removing the kernel manually is not
recommended because it is too easy to miss a file and because it does not remove the kernel
from the RPM database.

More Related Content

PDF
Shell scripting
PPTX
Yum (Linux)
PPTX
RPM (Red Hat Package Manager)
PDF
PPTX
U-Boot Porting on New Hardware
PPTX
Linux file system
PDF
Course 102: Lecture 26: FileSystems in Linux (Part 1)
PPTX
Linux Boot Process
Shell scripting
Yum (Linux)
RPM (Red Hat Package Manager)
U-Boot Porting on New Hardware
Linux file system
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Linux Boot Process

What's hot (20)

PDF
Linux basic commands with examples
PDF
Course 102: Lecture 22: Package Management
PDF
Linux Networking Explained
PDF
Lesson 2 Understanding Linux File System
PDF
package mangement
PDF
Users and groups in Linux
PDF
PPTX
Linux commands
PDF
Block Drivers
PPTX
Linux standard file system
PDF
File System Hierarchy
PPTX
Software management in linux
PPTX
File permissions
PDF
Part 02 Linux Kernel Module Programming
PPT
Basic 50 linus command
PPT
Linux booting procedure
PDF
Part 01 Linux Kernel Compilation (Ubuntu)
PDF
U-Boot - An universal bootloader
ODP
Introduction to Shell script
Linux basic commands with examples
Course 102: Lecture 22: Package Management
Linux Networking Explained
Lesson 2 Understanding Linux File System
package mangement
Users and groups in Linux
Linux commands
Block Drivers
Linux standard file system
File System Hierarchy
Software management in linux
File permissions
Part 02 Linux Kernel Module Programming
Basic 50 linus command
Linux booting procedure
Part 01 Linux Kernel Compilation (Ubuntu)
U-Boot - An universal bootloader
Introduction to Shell script
Ad

Viewers also liked (8)

TXT
Logrotate sh
PPT
Comparison of Unix and Linux Log File Management Tools by Dusan Baljevic
PDF
syslog-ng: from log collection to processing and information extraction
PDF
Bundling Packages and Deploying Applications with RPM
PPTX
Syslog
PPTX
Open Source Mini Concert-Session 3-Tizen
PDF
Mobile Hacking using Linux Drivers
PDF
RPM Building
Logrotate sh
Comparison of Unix and Linux Log File Management Tools by Dusan Baljevic
syslog-ng: from log collection to processing and information extraction
Bundling Packages and Deploying Applications with RPM
Syslog
Open Source Mini Concert-Session 3-Tizen
Mobile Hacking using Linux Drivers
RPM Building
Ad

Similar to RPM (LINUX) (20)

PPT
101 2.5 use rpm and yum package management
PPTX
6 - Package Management in Red Hat
PPT
2.5 use rpm and yum package management
ODP
Rpm Introduction
PPT
101 2.5 use rpm and yum package management
PPT
101 2.5 use rpm and yum package management
PPS
Linux16 RPM
PPT
Linux Troubleshooting
PPT
Unix Administration 2
PDF
Yum package manager
PPT
Linux16 RPM
PPTX
Building a linux kernel
PDF
$ make install
DOCX
6 stages of linux boot process
PPTX
RHEL Log-files, RPM, Backup & Recovery
PDF
Snort296x centos6x 2
DOC
6 stages of linux boot process
PDF
Oracle11g on fedora14
PDF
Oracle11g On Fedora14
TXT
Easy install
101 2.5 use rpm and yum package management
6 - Package Management in Red Hat
2.5 use rpm and yum package management
Rpm Introduction
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
Linux16 RPM
Linux Troubleshooting
Unix Administration 2
Yum package manager
Linux16 RPM
Building a linux kernel
$ make install
6 stages of linux boot process
RHEL Log-files, RPM, Backup & Recovery
Snort296x centos6x 2
6 stages of linux boot process
Oracle11g on fedora14
Oracle11g On Fedora14
Easy install

More from Raghu nath (20)

PPTX
Mongo db
PDF
Ftp (file transfer protocol)
PDF
MS WORD 2013
PDF
Msword
PDF
Ms word
PDF
Javascript part1
PDF
Regular expressions
PDF
Selection sort
PPTX
Binary search
PPTX
JSON(JavaScript Object Notation)
PDF
Stemming algorithms
PPTX
Step by step guide to install dhcp role
PPTX
Network essentials chapter 4
PPTX
Network essentials chapter 3
PPTX
Network essentials chapter 2
PPTX
Network essentials - chapter 1
PPTX
Python chapter 2
PPTX
python chapter 1
PPTX
Linux Shell Scripting
PPTX
Mongo db
Ftp (file transfer protocol)
MS WORD 2013
Msword
Ms word
Javascript part1
Regular expressions
Selection sort
Binary search
JSON(JavaScript Object Notation)
Stemming algorithms
Step by step guide to install dhcp role
Network essentials chapter 4
Network essentials chapter 3
Network essentials chapter 2
Network essentials - chapter 1
Python chapter 2
python chapter 1
Linux Shell Scripting

Recently uploaded (20)

PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Classroom Observation Tools for Teachers
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
RMMM.pdf make it easy to upload and study
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
01-Introduction-to-Information-Management.pdf
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
Updated Idioms and Phrasal Verbs in English subject
PPTX
Microbial diseases, their pathogenesis and prophylaxis
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Supply Chain Operations Speaking Notes -ICLT Program
Classroom Observation Tools for Teachers
LDMMIA Reiki Yoga Finals Review Spring Summer
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
What if we spent less time fighting change, and more time building what’s rig...
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
RMMM.pdf make it easy to upload and study
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Cell Structure & Organelles in detailed.
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Microbial disease of the cardiovascular and lymphatic systems
01-Introduction-to-Information-Management.pdf
Yogi Goddess Pres Conference Studio Updates
Updated Idioms and Phrasal Verbs in English subject
Microbial diseases, their pathogenesis and prophylaxis
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc

RPM (LINUX)

  • 1. RPM: The RPM Package Manager
  • 2. RPM (RPM Package Manager; www.rpm.org) works only with software packages built for processing by RPM; it can download, install, uninstall, upgrade, query, and verify RPM packages. The files that hold these packages have a filename extension of .rpm. RPM uses the local RPM installation database to track the locations where software packages are installed, the versions of the installed packages, and the dependencies between the packages. RPM uses the Berkeley Database (Berkeley DB or BDB) and stores the database files in /var/lib/rpm. RPM forms the basis for yum: yum finds packages, downloads them from repositories, and then calls RPM to install/upgrade/remove the packages.
  • 3. Querying Packages and Files The following rpm command displays a list of one-line summaries of all packages installed on the system: $ rpm -qa mtools-4.0.15-2.fc15.i686 iwl6000-firmware-9.221.4.1-2.fc15.noarch gnome-desktop3-2.91.93-1.fc15.i686 libmusicbrainz3-3.0.3-3.fc15.i686 dejavu-fonts-common-2.32-2.fc15.noarch pptp-1.7.2-12.fc15.i686
  • 4. The –q option queries the package database; the –a option specifies all packages. Without –a, –q takes the name of a package as an argument and displays information about that package only. For instance, rpm –q ypserv tells you whether the ypserv package is installed and, if so, which version is installed. Use the –ql options to list the files in a package.
  • 5. $ rpm -q ypserv package ypserv is not installed $ rpm -ql logrotate /etc/cron.daily/logrotate /etc/logrotate.conf /etc/logrotate.d /usr/sbin/logrotate /usr/share/doc/logrotate-3.7.9 /usr/share/doc/logrotate-3.7.9/CHANGES /usr/share/doc/logrotate-3.7.9/COPYING /usr/share/man/man5/logrotate.conf.5.gz /usr/share/man/man8/logrotate.8.gz /var/lib/logrotate.status With the –qi options, rpm displays information about a package:
  • 6. $ rpm -qi logrotate Name : logrotate Version : 3.7.9 Release : 8.fc15 Architecture: i686 Install Date: Wed 23 Mar 2011 05:37:59 PM PDT Group : System Environment/Base Size : 84226 License : GPL+ Signature : RSA/SHA256, Mon 21 Mar 2011 03:05:16 PM PDT, Key ID b4ebf579069c8460 Source RPM : logrotate-3.7.9-8.fc15.src.rpm
  • 7. Build Date : Mon 21 Mar 2011 06:28:12 AM PDT Build Host : x86-06.phx2.fedoraproject.org Relocations : (not relocatable) Packager : Fedora Project Vendor : Fedora Project Summary : Rotates, compresses, removes and mails system log files
  • 8. Description : The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files. Logrotate allows for the automatic rotation compression, removal and mailing of log files. Logrotate can be set to handle a log file daily, weekly, monthly or when the log file gets to a certain size. Normally, logrotate runs as a daily cron job.
  • 9. Install the logrotate package if you need a utility to deal with the log files on your system. You can use the –qf options to determine which package a file belongs to; it works with installed packages only. Use the yum whatprovides command (page 537) to search repositories for the same information. The following command shows that more is part of the util-linux package: $ rpm -qf /bin/more util-linux-2.19-3.fc15.i686 Include the –p option with other options to query an uninstalled RPM package file:
  • 10. $ ls ypser* ypserv-2.24-2.fc15.i686.rpm $ rpm -qip ypserv-2.24-2.fc15.i686.rpm Name : ypserv Version : 2.24 Release : 2.fc15
  • 11. Installing, Upgrading, and Removing Packages Although it is frequently easier to use yum or gpk-application, you can use rpm to download, install, upgrade, or remove a package. Run rpm with root privileges; although you can run rpm as a nonprivileged user, you will not have permission to write to the necessary directories during an install or uninstall, and the procedure will fail. During a query, you do not need to work with root privileges, so you can and should work as a nonprivileged user. Give the –U (upgrade) option, followed by the name of the file that contains the RPM version of the package you want to install. The –U option upgrades existing packages and installs new packages (as though you had used the –i option). For kernels, use –i (not –U) to leave the old kernel intact when you install a new kernel. Add the –v (verbose) option to display more information about what is happening and the –h (or ––hash) option to display hash marks as the package is unpacked and installed.
  • 12. Installing a package For example, the following command installs the samba package on the local system: # ls samba* samba-3.6.0-64pre1.fc15.1.i686.rpm # rpm -Uvh samba-3.6.0-64pre1.fc15.1.i686.rpm Preparing... ########################################### [100%] 1:samba ########################################### [100%] When you install a package, the rpm file must be in the working directory, or you must use a pathname that points to the rpm file. If you specify an FTP or HTTP URL, rpm will download the package before installing it (but it will not download or install dependencies):
  • 13. # rpm -Uvh http://download.fedora.redhat.com/pub/fedora/linux/updates/15/i386/bind-9.8.0-5.P2.fc15.i686.rpm Removing a package The following command removes the samba package. You can give the command from any directory: # rpm -e samba error: Failed dependencies: samba is needed by (installed) system-config-samba-1.2.91-2.fc15.noarch When you run this command, rpm reports that another package, system-configsamba, is dependent on the samba package. To remove the samba package, you have two choices: You can ignore the dependency by including the rpm ––nodeps option or you can remove the dependent package and then remove the samba package. # rpm -e system-config-samba # rpm -e samba
  • 14. If you remove the samba package without removing the package that is dependent on it, the utilities within the dependent package will not work. In the preceding example, the system-config-samba utility will not work. When you use rpm to remove a package, rpm queries package database to find the information it needs to uninstall the package and removes links, unloads device drivers, and stops daemons as necessary. Refer to the rpm man page for more rpm options.
  • 15. Installing a Linux Kernel Binary The following steps install a Linux kernel binary from an RPM package. If you simply want to install the latest kernel for the local system, give the command yum install kernel instead. Refer to Chapter 15 when you want to configure and rebuild a kernel from source files, rather than installing a new, prebuilt kernel binary. 1. Run rpm with the –i option to install the new kernel. Do not use the –U option: You are installing a new kernel that has a different name than the old kernel; you are not upgrading the existing kernel.
  • 16. 2. Make sure the new kernel works before you remove the old kernel. To verify the new kernel works, reboot the system using the new kernel. You might want to wait a while before removing the old kernel to make sure that no problems arise with the new one. 3. When you are satisfied with the new kernel, remove the old kernel using rpm with the –e option; you must specify the kernel version number. If necessary, you can manually remove an old kernel by removing files whose names contain the release number from /boot or / (root). Remove information about the old kernel from grub.conf. Removing the kernel manually is not recommended because it is too easy to miss a file and because it does not remove the kernel from the RPM database.