Managing Packages With Yum and email notification

8:07 PM

Managing Packages With Yum

 ==============================================

Getting E-mail notifications when new packages are available:


The process of managing packages is tedious, and having to manually check for updates is a pain. To simplify this process, We will usue yumnotifier shell script. Yumnotifier will process the output from the check-update command, and if it determines that updates are available, it will E-mail the address defined in the global $ADMIN variable. The script is designed to be run from cron, and will generate an E-mail similar to the following if updates are available:

From: root <root@localhost.localdomain>
To: smoorthy@opsource.net
Subject: Updates available for System

E-mail available yum updates

 Yumnotifier analyzes the 'yum check-update' output, and generates an E-mail if it determines that updates are available for the system the script is running on. The script is designed to be run from cron, and the address to send updates to is controlled by the global $ADMIN variable.

Listing installed packages:


Before you can update packages on a system, it is first useful to see which packages are installed. Yum contains a "list" option to display the list of installed packages. When invoked without arguments, list will show all packages installed:
$ yum list |more

If a string is passed as an argument to the list option, yum will look for all packages that match that string. The following example will list all packages with the name "sendmail":
$ yum list sendmail

Searching for packages:


One of yum's most powerful options is it's search capabilities. Yum allows you to query packages by keyword, package name and pathname. The following example uses the sendmail "search" option to locate all packages that contain the string "sendmail" in their name:
$ yum search sendmail

In addition to searching for package names, yum's "whatprovides" option can be used to locate the package that contains a specific executable:
$ yum whatprovides /etc/yum.conf

Viewing package dependencies:


Most packages that come with a Linux distributions contain one or more dependencies. A prefect example of this is the Apache web server. Apache depends on the openssl package to provide SSL support, the zlib package to deflate content, and the PHP package if PHP is in use. Managing packages and their dependencies is one area where yum really shines. Not only does yum automatically detect and resolve dependencies, but it allows you to view package dependencies with the "deplist" option:
$ yum deplist sendmail

Installing and removing packages with yum :


Up to this point we have shown how to use yum to view package metadata. The real heart of a package manager is it's ability to install packages, remove packages, and to handle the dependencies that are associated with a specific release of a package. Yum allows packages to be installed with the "install" option, which takes one or more packages to install as arguments. The following example show how to install the sendmail package and all of it's dependencies:
$ yum install sendmail

Packages can be removed just as easily as they can be added. To remove the sendmail package that we just installed, the package name can be passed as an argument to the "remove" option:
$ yum remove sendmail

Checking for new package versions:


One of yum's nicest features is it's ability to install packages from remote repositories, and to compare the currently installed packages with what is available remotely. To compare the currently installed packages with the versions that are available in one or more remote repositories, yum can be invoked with the "check-update" option:
$ yum check-update

In this example we can see that numerous packages are outdated by newer version. To update all of the outdated packages to newer versions, yum can be run with the "update" option:$ yum update

Cleaning up the yum cache:


The yum package manager maintains a cache of headers and files in /var/cache/yum. This cache can grow rather large over time, and can be cleaned with the yum "clean" option:
$ yum clean all

You Might Also Like

0 comments

Contact Form

Name

Email *

Message *

Translate

Wikipedia

Search results