Operating Systems and Systems Integration

Applying OS Updates

1 Aim

After successfully working through this exercise, You will:

• understand the importance of applying updates to the operating system of servers

• understand how to apply the updates to Red Hat Linux.

• understand how to use rpm and yum to resolve software package dependencies

• understand how to automate the update process

2 Background

All operating systems contain bugs. Even Microsoft’s OS, despite what Bill may say (See

http://www.cantrip.org/nobugs.html), contains bugs. See for example,
   http://www.gcn.com/archives/gcn/1998/july13/cov2.htm. And Linux contains

bugs. Now crackers are just waiting for a new bug to be uncovered. The company that provides the OS also will provide updates to their OS, thanks to cert: http://www.cert.org/, who eventually publish information about the bug even if the company does not. As a system administrator, it is a vitally important part of your duty to apply updates to important or sensitive computers in your company.

Here in the ict Department, I have implemented a system that automatically downloads the current updates for Red Hat Linux from the Internet every day. You will use these updates and apply them to your computer. The updates are software packages.

You will use the Network File System (nfs) to mount the network drive containing these updates, and then use the rpm Package Manager (rpm) to apply these updates to your machine.

The rpm package manager does far more than allow you to install updates. It can also check that the installed software packages are correctly installed, and verify that none of the programs have been changed by a cracker (as long as rpm itself is unchanged!) See chapter 25, Package Management with RPM, of the The Official Red Hat Linux Customization Guide, available from the Red Hat web site at

   http://www.redhat.com/docs/manuals/linux/, and also on the documentation

cdrom (burn a copy on our cd burner).

2.1 The RPM Package Manager

The rpm package manager has a number of basic capabilities: It can install software, update software packages, remove packages, build software packages, query and verify software packages.

Applying OS Updates Operating Systems and Systems Integration

2

Please see section 6.10 on page 185 in the Linux Training Materials Project (the workshop notes we have used in the lab) for more information about using rpm to query and verify software packages.

Building RPM Packages If anyone is interested in building your own rpm packages, you are very welcome to see Nick, he may even give you a book about it! The online book is called Maximum RPM, and is good reading for those who are interested.

If you find an rpm package for another version of Linux, it is a good idea to rebuild it, since that will solve library dependencies. For this, you use the source rpm package. To do this is simple. For example, suppose you download the latest Emacs package from

ftp://rawhide.redhat.com/pub/redhat/linux/rawhide/SRPMS/SRPMS/emacs-21.1-3.src.rpm

and want to use it in Red Hat 9 instead of the older version there. All you need do is:

$ sudo rpmbuild --rebuild emacs-21.3-6.src.rpm

The code compiles, and eventually creates the binary rpms, which you can then install:

$ sudo rpm -Uhv /usr/src/redhat/RPMS/i386/emacs-*21.3-6.i386.rpm

Table 1 on the next page shows the basic rpm operations that we will use today. Table 2 on page 4 shows more information about how to make queries using rpm.

Table 1: The rpm options that we use to install and upgrade software.

Command Action  Description
rpm -i  install  install the software package; do not uninstall any previous

version of the software. Use this when installing kernels; normally, use the upgrade action.

rpm -U upgrade if an older copy of the package has been installed, uninstall it and replace it with this newer package. Do not delete the configuration files from the old package. Otherwise, it is the same as the install action, and is what I use most often.

rpm -F freshen install this package only if an older version of this software package has already been installed. Otherwise, do nothing. Useful when upgrading software packages.

rpm -e  remove will completely erase the software package.

Useful “helper” options

-h  hashes  Print fifty hashes (‘#’) to show progress of installation

-v verbose print the name of each package as it is installed. Useful when installing more than one package at a time. In practice, I always use this option, as well as the -h option.

--force force :-) For updates, go ahead and force the update, even if the same package or a newer one is already installed. Be very careful in using this; understand what you are doing. It can also override dependencies, and you can end up with a system that does not work if you use this option carelessly.