Linux Exercise: Package Management with RPM/YUM

RPM

  1. Make a list of all RPM files on the system.
    • # rpm -qa
  2. Check which RPM created the file /bin/bash.
    • # rpm -qf /bin/bash
  3. List the information about the bash RPM, and list all files in the bash RPM.
    • # rpm -qi bash
    • # rpm -ql bash
  4. From the CentOS ISO, first retrieve information about -, and then install the ksh RPM. See if the Korn Shell is available, then deinstall ksh.
    Note: If you are using the "minimal" CentOS ISO, then the ksh will not be available on this ISO. Instead, you can use the yumdownloader program to download the ksh RPM without installing it. (The yumdownloader program is part of the yum-utils package.)
    If you have the full CentOS ISO:
    • # mount /dev/cdrom /mnt/cdrom
    • # cp /mnt/cdrom/Packages/ksh* /root
    If you have the minimal CentOS ISO:
    • # cd
    • # yum install yum-utils
    • # yumdownloader ksh
    In both cases continue with:
    • # rpm -qip ksh-version-release.rpm
    • # rpm -ivh ksh-version-release.rpm
    • # rpm -q ksh
    • # ksh
      You are now running the Korn Shell.
    • # exit
      You are now back in your login shell.
    • # rpm -e ksh
    • # ksh
      As ksh is no longer available, you will get an error message.

YUM

  1. Look in the directory /etc/yum.repos.d. Which repositories do you see? Compare this with the output of the yum repolist command.
    • # ls -l /etc/yum.repos.d
    • # yum repolist
  2. Retrieve information about the korn shell RPM, install it, verify it is installed and uninstall it again, but now using yum
    • # yum list "ksh*"
    • # yum info ksh
    • # yum install ksh
    • # ksh
    • # exit
    • # yum erase ksh
  3. Install the "epel-release" package. This CentOS package adds the files that are required to use the EPEL (Extra Packages for Enterprise Linux) repository. How many packages are in the base CentOS repository, versus the EPEL repository?
    • # yum install epel-release
    • # yum repolist
    • # ls -l /etc/yum.repos.d
  4. Perform a yum update of your system.
    Note: This may take a long time.
    • # yum update
  5. Once the installation has finished, take a look in your /boot directory. You should see two sets of kernel files here: The kernel is never upgraded, but always a fresh install. You can now reboot the system and then use yum erase or rpm -e to delete the old kernel RPM.
    • # rpm -qa | grep kernel
    • # ls /boot
    • # ls /lib/modules
    • # cat /proc/version
    • # reboot
    • # cat /proc/version
    • # yum erase kernel-oldversion
    • # rpm -qa | grep kernel
    • # ls /boot
    • # ls /lib/modules
End of exercise