Topics

1. The Problem of Software Installation 2. Package Management Systems CIT 470: Advanced Network and 3. Using RPM System Administration 4. Finding RPMs Package Management 5. Building RPMs

CIT 470: Advanced Network and System Administration Slide #1 CIT 470: Advanced Network and System Administration Slide #2

Software Installation What’s the problem? 1. Customization What prerequisites does your software have? Select options like language. What prereqs do your prereq packages have? Select file set. How do you handle conflicts? What if two programs install/modify same file? 2. Install new files in appropriate locations. Does your install work on every type of computer? 3. Modify existing configuration files. How do you handle upgrades? 4. Make software available to user. What if user has customized configuration? Shell configuration (PATH, etc.) What if ownerships/permissions have changed? GUI configuration (menu, icons, etc.) What if user needs old and new versions? How do you uninstall software?

CIT 470: Advanced Network and System Administration Slide #3 CIT 470: Advanced Network and System Administration Slide #4

Package Manager Features UNIX Package Management Systems

• Build management. : system uses and APT. • Dependency tracking. pkgadd: Solaris packaging system. • Querying. : Gentoo uses with emerge. • Reversibility. ports: BSD ports system. • Verification. RPM: Redhat packaging system. • Version control. tgz: Tarballs used by .

CIT 470: Advanced Network and System Administration Slide #5 CIT 470: Advanced Network and System Administration Slide #6

1 RPM RPM Package Names

RPM --..rpm – Originally stood for Package Manager – Came with Red Hat 2.0 in 1995. Name: name of the software . Distributions Version: version of the software package. – Red Hat Release: release version of the RPM. – (also CentOS) – Fedora Arch: architecture (i386, noarch, ppc, etc.) – Mandriva If Arch is src, RPM contains for – SUSE building the package. RPM on other OS – AIX – Novell Netware

CIT 470: Advanced Network and System Administration Slide #7 CIT 470: Advanced Network and System Administration Slide #8

RPM Package Contents Using RPM

Identification 1. Install Identifies package and RPM version. 2. Uninstall Signature Checksum and digital signature. 3. Upgrade Header 4. Query Package and version information. Specifies dependencies on other packages. 5. Verify Payload Actual files to install. Stored as archive compressed with . Use rpm2cpio to obtain cpio archive.

CIT 470: Advanced Network and System Administration Slide #9 CIT 470: Advanced Network and System Administration Slide #10

Installing a Package Upgrading a Package

1. Check the package and the files it wants to install. Uninstall + install, retaining configuration files. 2. Perform preinstallation tasks. Will install a package if no older version. 3. Uncompress the files and copy them in the proper Will remove all older versions. locations 4. Perform post-processing tasks > rpm -Uvh foo-1.0-1.i386.rpm 5. Update the RPM Database Preparing... ########################################### [100%] 1:foo ########################################### [100%]

> rpm -ivh foo-1.0-1.i386.rpm Preparing... ########################################### [100%] 1:foo ########################################### [100%]

CIT 470: Advanced Network and System Administration Slide #11 CIT 470: Advanced Network and System Administration Slide #12

2 Uninstalling a Package Dependencies

Completely removes package from system. Prevent install/removal if unfulfilled.

# rpm -e setup error: Failed dependencies: setup is needed by (installed) basesystem-8.0-1 > rpm -e foo-1.0-1 setup >= 2.0.3 is needed by (installed) initscripts-6.95-1 > rpm –q foo setup >= 2.5.4-1 is needed by (installed) package foo is not installed. filesystem-2.1.6-5 setup is needed by (installed) xinetd-2.3.7-2 setup is needed by (installed) dump-0.4b28-4 # rpm -q setup setup-2.5.20-1

CIT 470: Advanced Network and System Administration Slide #13 CIT 470: Advanced Network and System Administration Slide #14

Querying the RPM Database Querying the RPM Database

# rpm -q telnet # rpm -qc bash telnet-0.17-31.EL4.3 /etc/skel/.bash_logout # rpm -ql telnet /usr/bin/telnet /etc/skel/.bash_profile /usr/share/man/man1/telnet.1.gz /etc/skel/.bashrc # rpm -qi telnet # rpm -qd sendmail Name : telnet Relocations: (not) /usr/share/man/man1/mailq.sendmail.1.gz Version : 0.17 Vendor: CentOS Release : 31.EL4.3 Build Date: Tue 14 Jun 2005 /usr/share/man/man1/newaliases.sendmail.1.gz Install Date: Sat 11 Feb 2006 Build Host: build5 /usr/share/man/man5/aliases.sendmail.5.gz Group : Applications/Internet Src RPM: telnet-0.17.src.rpm /usr/share/man/man8/mailstats.8.gz Size : 87254 License: BSD /usr/share/man/man8/makemap.8.gz Signature : DSA/SHA1, Tue 14 Jun 2005, Key ID a53d0bab443e1821 Packager : Johnny Hughes /usr/share/man/man8/praliases.8.gz Summary : Client program for telnet remote login protocol. /usr/share/man/man8/rmail.8.gz Description : /usr/share/man/man8/sendmail.sendmail.8.gz Telnet is a popular protocol for logging into remote systems /usr/share/man/man8/smrsh.8.gz over the Internet. The telnet package provides a command line telnet client.

CIT 470: Advanced Network and System Administration Slide #15 CIT 470: Advanced Network and System Administration Slide #16

Searching all Packages Searching Packages

# rpm -qa | grep telnet telnet-0.17-31.EL4.3 Find recently installed packages # rpm -qa | grep py python-2.3.4-14.1 rpm -qa --last pyOpenSSL-0.6-1.p23 rpm-python-4.3.3-11_nonptl pygtk2-2.4.0-1 python-devel-2.3.4-14.1 Find packages that are disk hogs python-ldap-2.0.1-2 pyxf86config-0.3.19-1 rpm -qa --qf "%{size} %{name}\n" | sort –n libxml2-python-2.6.16-6 python-elementtree-1.2.6-4 python--1.1.6-1 dbus-python-0.22-12.EL.5 The --qf (queryformat) option can print pyparted-1.6.8-2 python-urlgrabber-2.9.6-2 arch, name, size, version, distribution, etc.

CIT 470: Advanced Network and System Administration Slide #17 CIT 470: Advanced Network and System Administration Slide #18

3 Querying Files and Packages Dependency Resolution

Find which package a file belongs to: Higher level tools handle dependencies # rpm -qf /usr/bin/telnet , , , telnet-0.17-31.EL4.3 Automatic resolution + downloading. # rpm -qf /etc/security/limits.conf pam-0.77-66.11 1. Find dependencies in RPM headers. Querying packages 2. Download dependencies, check their headers. Add –p to any query to apply it to a .rpm file instead of to 3. Repeat. an installed package. 4. Install after all RPMs downloaded.

CIT 470: Advanced Network and System Administration Slide #19 CIT 470: Advanced Network and System Administration Slide #20

Yum Installs

Yellow Dog Updater Modified yum install pkg: finds specified package, – Rewrite of YUP from . downloads it, and installs it. – Used by many RPM-based distributions. yum remove pkg: remove the specified Automatically syncs repo metadata. package from the system. – Prevents problems arising from out of data yum update : updates specified package package information on local system. or updates all packages if no package – Wastes time when local data up to date. specified.

CIT 470: Advanced Network and System Administration Slide #21 CIT 470: Advanced Network and System Administration Slide #22

yum list

Options: check-update: lists updates, returns 100 if any available: list packages available to be installed. updates available. installed: list installed packages like rpm –qa. extras: lists installed packages that are not available on any clean: removes yum cache files. currently configured repo. deplist: list all dependencies for a package. recent: lists packages added to repositories in last 7 days. updates: lists updates for any installed packages. info: list package data like rpm –qi Package Specifications: yum provides: find which package provides the bash specified command, i.e. yum provides \*bin/ls. bash-3.10 \*sh yum search: lists packages whose name, summary, \*.i386 description, or URL matches the specified search term.

CIT 470: Advanced Network and System Administration Slide #23 CIT 470: Advanced Network and System Administration Slide #24

4 Package Sources RPMForge

Sources RPMForge Repository provides non-official packages – Local files (CD/DVD or hard disk) http://dag.wieers.com/home-made/apt/ – commercial sites for RHEL Some packages don’t exist in RHEL Other packages are more up to date than RHEL – CentOS network official mirrors for CentOS Configure system to use RPMForge via – Unofficial network repositories like RPMforge rpm -Uhv Source configuration http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge- release-0.3.6-1.el5.rf.i386.rpm up2date: /etc/sysconfig/rhn/sources yum: /etc/yum.conf, /etc/yum/repos.d

CIT 470: Advanced Network and System Administration Slide #25 CIT 470: Advanced Network and System Administration Slide #26

References

1. Debian FAQ, “Debian Package Management Tools,” http://www.debian.org/doc/FAQ/ch-pkgtools.en.html 2. Eric Foster-Johnson, RPM Guide, http://fedora.redhat.com/docs/drafts/rpm-guide-en/, 2005. 3. Aeleen Frisch, Essential System Administration, 3rd edition, O’Reilly, 2002. 4. Evi Nemeth et al, UNIX System Administration Handbook, 3rd edition, Prentice Hall, 2001. 5. RedHat, Red Hat Enterprise Linux 4 System Administration Guide, http://www.redhat.com/docs/manuals/enterprise/RHEL-4- Manual/sysadmin-guide/, 2005.

CIT 470: Advanced Network and System Administration Slide #27

5