0% found this document useful (0 votes)
55 views

LPI 101 - Use Red Hat Package Management (5) : (Linux Professional Institute Certification)

Candidates should be able to perform package management under Linux distributions that use RPMs for package distribution. This objective includes being able to install, re-install, upgrade, and remove packages, as well as obtain status and version information on packages.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

LPI 101 - Use Red Hat Package Management (5) : (Linux Professional Institute Certification)

Candidates should be able to perform package management under Linux distributions that use RPMs for package distribution. This objective includes being able to install, re-install, upgrade, and remove packages, as well as obtain status and version information on packages.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

LPI 101 Use Red Hat Package Management [5]

(Linux Professional Institute Certication)


a .. /V\ // \\ @._.@ by: Andrew Eager [email protected]

$Id: gl1.102.6.slides.tex,v 1.4 2003/05/30 05:09:04 waratah Exp $

c 2002 Andrew Eager, Geoffrey Robertson. Permission is granted to make and distribute verbatim copies or modied versions of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundationeither version 2 of the License or (at your option) any later version.

a Copyright

Use Red Hat Package Management


Objective
Candidates should be able to perform package management under Linux distributions that use RPMs for package distribution. This objective includes being able to install, re-install, upgrade, and remove packages, as well as obtain status and version information on packages. This objective also includes obtaining package information such as version, status, dependencies, integrity, and signatures. Candidates should be able to determine what les a package provides, as well as nd which package a specic le comes from.

Use Red Hat Package Management


Key les, terms, and utilities
/etc/rpmrc /usr/lib/rpm/*

Use Red Hat Package Management


Resources of interest
:

RPM - RedHat Package Manager


RPM works with RedHat, SuSE & Mandrake (among others) and can do the following:

RPM - RedHat Package Manager


RPM works with RedHat, SuSE & Mandrake (among others) and can do the following: Build an RPM package

5-a

RPM - RedHat Package Manager


RPM works with RedHat, SuSE & Mandrake (among others) and can do the following: Build an RPM package Install an RPM package

5-b

RPM - RedHat Package Manager


RPM works with RedHat, SuSE & Mandrake (among others) and can do the following: Build an RPM package Install an RPM package Update an already installed RPM package

5-c

RPM - RedHat Package Manager


RPM works with RedHat, SuSE & Mandrake (among others) and can do the following: Build an RPM package Install an RPM package Update an already installed RPM package Query an RPM package

5-d

RPM - RedHat Package Manager


RPM works with RedHat, SuSE & Mandrake (among others) and can do the following: Build an RPM package Install an RPM package Update an already installed RPM package Query an RPM package Erase an RPM package

5-e

RPM - RedHat Package Manager


RPM works with RedHat, SuSE & Mandrake (among others) and can do the following: Build an RPM package Install an RPM package Update an already installed RPM package Query an RPM package Erase an RPM package Verify an RPM package.

5-f

RPM Packages
RPM package les consist of a single compressed le much like a tarball. Package les can be sourced from: Local media (hard disk, cdrom etc) An ftp site An http site

RPM Packages
RPM package les consist of a single compressed le much like a tarball. Package les can be sourced from: Local media (hard disk, cdrom etc) An ftp site An http site Packages sourced from local media are specied using just their lename. For example: acroread-4.05-1.i686.rpm

6-a

RPM Packages
RPM package les consist of a single compressed le much like a tarball. Package les can be sourced from: Local media (hard disk, cdrom etc) An ftp site An http site Packages sourced from local media are specied using just their lename. For example: acroread-4.05-1.i686.rpm Packages sourced from ftp or http sites are specied using the following syntax: ftp://USER:PASSWORD@HOST:PORT/path/to/package.rpm

6-b

RPM Filenames
RPM Filenames use a standard naming scheme: package -version-patch.arch.rpm package - The name of the package version - The version number patch - patch number of this package arch - The architecture this package is for (i386, i586, i686, alpha, sparc) Example: kernel -2.4.9-21.i686.rpm

RPM Filenames
RPM Filenames use a standard naming scheme: package- version -patch.arch.rpm package - The name of the package version - The version number patch - patch number of this package arch - The architecture this package is for (i386, i586, i686, alpha, sparc) Example: kernel- 2.4.9 -21.i686.rpm

RPM Filenames
RPM Filenames use a standard naming scheme: package-version- patch .arch.rpm package - The name of the package version - The version number patch - patch number of this package arch - The architecture this package is for (i386, i586, i686, alpha, sparc) Example: kernel-2.4.9- 21 .i686.rpm

RPM Filenames
RPM Filenames use a standard naming scheme: package-version-patch. arch .rpm package - The name of the package version - The version number patch - patch number of this package arch - The architecture this package is for (i386, i586, i686, alpha, sparc) Example: kernel-2.4.9-21. i686 .rpm

10

RPM Operating Modes


RPM operations are split up into 4 major modes:

11

RPM Operating Modes


RPM operations are split up into 4 major modes: Querying & Verifying

11-a

RPM Operating Modes


RPM operations are split up into 4 major modes: Querying & Verifying Installing, Upgrading or Removing

11-b

RPM Operating Modes


RPM operations are split up into 4 major modes: Querying & Verifying Installing, Upgrading or Removing Building Packages

11-c

RPM Operating Modes


RPM operations are split up into 4 major modes: Querying & Verifying Installing, Upgrading or Removing Building Packages RPM database administration functions

11-d

Verifying package Integrity


Having downloaded an rpm from the Internet, the very rst thing you want to do is verify its integrity. You do this with the -K or --checksig option to rpm: # rpm -K kernel-2.4.9-31.i586.rpm kernel-2.4.9-31.i586.rpm: md5 gpg OK NOTE: Some packages use PGP to check integrity while others use GnuPG.

12

Installing, Upgrading & Removing


Understanding the RPM terminology in relation to Installing, upgrading & removing rpm packages is essential:

13

Installing, Upgrading & Removing


Understanding the RPM terminology in relation to Installing, upgrading & removing rpm packages is essential: Install - Install a package. Good for Kernels

13-a

Installing, Upgrading & Removing


Understanding the RPM terminology in relation to Installing, upgrading & removing rpm packages is essential: Install - Install a package. Good for Kernels Upgrade - Upgrade a package if its installed, otherwise install the package

13-b

Installing, Upgrading & Removing


Understanding the RPM terminology in relation to Installing, upgrading & removing rpm packages is essential: Install - Install a package. Good for Kernels Upgrade - Upgrade a package if its installed, otherwise install the package Freshen - Upgrade a package only if its already installed.

13-c

Installing, Upgrading & Removing


Understanding the RPM terminology in relation to Installing, upgrading & removing rpm packages is essential: Install - Install a package. Good for Kernels Upgrade - Upgrade a package if its installed, otherwise install the package Freshen - Upgrade a package only if its already installed. Erase - Remove a package.

13-d

Installing, Upgrading & Removing - Options


The table below summarises the various options used for package installation, freshening and removal. Mode Install Upgrade Freshen Erase Short option -i -U -F -e Long option --install --upgrade --freshen --erase

14

Using RPM on the command line


Generally you use rpm in one of the following modes:

15

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ...

15-a

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ... rpm -U [install-options] package file ...

15-b

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ... rpm -U [install-options] package file ... rpm -F [install-options] package file ...

15-c

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ... rpm -U [install-options] package file ... rpm -F [install-options] package file ... rpm -e [erase-options] package name ...

15-d

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ... rpm -U [install-options] package file ... rpm -F [install-options] package file ... rpm -e [erase-options] package name ...

Commonly used options are:


-v Verbose

15-e

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ... rpm -U [install-options] package file ... rpm -F [install-options] package file ... rpm -e [erase-options] package name ...

Commonly used options are:


-v Verbose -h print progress hash marks

15-f

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ... rpm -U [install-options] package file ... rpm -F [install-options] package file ... rpm -e [erase-options] package name ...

Commonly used options are:


-v Verbose -h print progress hash marks --force Force RPM to overwrite existing packages or les

15-g

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ... rpm -U [install-options] package file ... rpm -F [install-options] package file ... rpm -e [erase-options] package name ...

Commonly used options are:


-v Verbose -h print progress hash marks --force Force RPM to overwrite existing packages or les --nodeps Bypass dependency checking

15-h

Using RPM on the command line


Generally you use rpm in one of the following modes: rpm -i [install options] package file ... rpm -U [install-options] package file ... rpm -F [install-options] package file ... rpm -e [erase-options] package name ...

Commonly used options are:


-v Verbose -h print progress hash marks --force Force RPM to overwrite existing packages or les --nodeps Bypass dependency checking --replacefiles Overwrite les owned by other packages
15-i

Example - install option


Install kernel-2.4.18-4 without removing the existing kernel: # rpm -q kernel kernel-2.4.9-21 # rpm -ivh kernel-2.4.18-4*.rpm Preparing... #################### [100%] 1:kernel-2.4.18-4 #################### [100%] # rpm -q kernel kernel-2.4.18-4 kernel-2.4.9-21 #

16

Example - Freshen option


Upgrade the existing kernel to kernel-2.4.18-4. # rpm -q kernel kernel-2.4.9-21 # rpm -Uvh kernel-2.4.18-4*.rpm Preparing... #################### [100%] 1:kernel-2.4.18-4 #################### [100%] # rpm -q kernel kernel-2.4.18-4 #

17

Example - Upgrade option:


What the upgrade option does will depend on whether or not the package is currently installed. If installed, it will perform a freshen, otherwise it will perform an install:

18

Example - Upgrade option:


What the upgrade option does will depend on whether or not the package is currently installed. If installed, it will perform a freshen, otherwise it will perform an install:
# rpm -q gocr package gocr is not installed

18-a

Example - Upgrade option:


What the upgrade option does will depend on whether or not the package is currently installed. If installed, it will perform a freshen, otherwise it will perform an install:
# rpm -q gocr package gocr is not installed # rpm -Uvh gocr-0.3.4-1.i386.rpm Preparing... ###################### [100%] 1:gocr-0.3.4-1.rpm ###################### [100%]

18-b

Example - Upgrade option:


What the upgrade option does will depend on whether or not the package is currently installed. If installed, it will perform a freshen, otherwise it will perform an install:
# rpm -q gocr package gocr is not installed # rpm -Uvh gocr-0.3.4-1.i386.rpm Preparing... ###################### [100%] 1:gocr-0.3.4-1.rpm ###################### [100%] # rpm -q gocr gocr-0.3.4-1

18-c

Example - Upgrade option:


What the upgrade option does will depend on whether or not the package is currently installed. If installed, it will perform a freshen, otherwise it will perform an install:
# rpm -q gocr package gocr is not installed # rpm -Uvh gocr-0.3.4-1.i386.rpm Preparing... ###################### [100%] 1:gocr-0.3.4-1.rpm ###################### [100%] # rpm -q gocr gocr-0.3.4-1 # rpm -Uvh gocr-0.3.6-1.i386.rpm Preparing... ###################### [100%] 1:gocr-0.3.6-1.rpm ###################### [100%]

18-d

Example - Upgrade option:


What the upgrade option does will depend on whether or not the package is currently installed. If installed, it will perform a freshen, otherwise it will perform an install:
# rpm -q gocr package gocr is not installed # rpm -Uvh gocr-0.3.4-1.i386.rpm Preparing... ###################### [100%] 1:gocr-0.3.4-1.rpm ###################### [100%] # rpm -q gocr gocr-0.3.4-1 # rpm -Uvh gocr-0.3.6-1.i386.rpm Preparing... ###################### [100%] 1:gocr-0.3.6-1.rpm ###################### [100%] # rpm -q gocr gocr-0.3.6-1

18-e

Example - Erase option


Remove the package gocr from the system # rpm -q gocr gocr-0.3.6-1 # rpm -e gocr # rpm -q gocr #

19

Querying Packages
RPM can be used to query a package (either installed or not). rpm -q|--query [select-options] [query-options]

20

Querying Packages
RPM can be used to query a package (either installed or not). rpm -q|--query [select-options] [query-options] Select options : Choose what it is you want to query -a Query all installed packages. -f Query package owning FILE. -p Query an (uninstalled) package le

20-a

Querying Packages
RPM can be used to query a package (either installed or not). rpm -q|--query [select-options] [query-options] Select options : Choose what it is you want to query -a Query all installed packages. -f Query package owning FILE. -p Query an (uninstalled) package le Query options : Choose what it is you want to see from the query: -i Show all information about the package -l Show what les are contained in the package -R List packages on which this package depends

20-b

Query - Example
Give a list of all packages with kern in their name:
$ rpm -qa | grep kern kernelcfg-0.5-5 glibc-kernheaders-2.4-7.14 kernel-2.4.9-21 kernel-source-2.4.18-4

21

Query - Example
Show a list of all les in kernel-2.4.9-21
$ rpm -ql kernel-2.4.9-21 /boot/System.map-2.4.9-21 /boot/module-info-2.4.9-21 /boot/vmlinuz-2.4.9-21 ....

22

Query - Example
Show package which owns /bin/ls:
$ rpm -qf /bin/ls $ fileutils-4.1-10

23

Show complete information about the leutils package:


$ rpm -qi fileutils

Name : fileutils Relocations: (not relocateable) Version : 4.1 Vendor: Red Hat, Inc. Release : 10 Build Date: Mon 25 Mar 2002 12:23:22 PM E Install date: Fri 24 May 2002 02:18:08 PM EST Build Host: daffy.perf.redhat.com Group : Applications/File Source RPM: fileutils-4.1-10.src.rpm Size : 1679468 License: GPL Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Summary : The GNU versions of common file management utilities. Description : The fileutils package includes a number of GNU versions of common and popular file management utilities. Fileutils includes the following tools: chgrp (changes a files group ownership), chown (changes a files ownership), chmod (changes a files permissions), cp (copies files), dd (copies and converts files), df (shows a filesystems disk usage), dir (gives a brief directory listing), dircolors (the setup program for the color version of the ls command), du (shows disk usage), install (copies files and sets permissions), ln (creates file links), ls (lists directory contents), mkdir (creates directories), mkfifo (creates FIFOs or named pipes), mknod (creates special files), mv (renames files), rm (removes/deletes files), rmdir (removes empty

24

Verifying package les


This option to rpm is used to verify the les installed on the system with those from the rpm package le. This is not to be confused with the integrity of the package le. The following table lists the characteristics veried:
5 - The MD5 checksum S - The le size L - Symbolic link T - Modication time D - Device major & minor number U - User owner G - Group owner M - Permission and/or le type

25

Example - Verify package


Verify the setup package against the originally installed version. $ rpm -V S.5....T S.5....T S.5....T S.5....T S.5....T S.5....T ..?..... .M...... setup c /etc/bashrc c /etc/csh.cshrc c /etc/csh.login c /etc/host.conf c /etc/printcap c /etc/profile c /etc/securetty c /etc/shadow

26

The End

27

You might also like