Yellowdog updater modified (YUM)
Yum is a yellowdog updater modified . Yum is an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm. Yum has a plugin interface for adding simple features. Yum can also be used from other python programs via its module inteface. It was developed by Duke University to improve the installation of RPMs. yum searches numerous repositories for packages and their dependencies so they may be installed together in an effort to alleviate dependency issues. Red Hat Enterprise Linux 5.2 uses yum to fetch packages and install RPMs
- Setting Up a yum Repository
Server end
-
Install the createrepo package.
-
Copy all the packages into one directory.
-
Run createrepo on that directory.This will create the necessary metadata for your yum repository.
Client end
Open the yum repository file in client end.
#vim /etc/yum.repos.d/rhel-debuginfo.repo
Edit this file & set the baseurl. Baseurl is yum server repodata patha & gpgcheck=0.
Yum Commands
yum commands are typically run as yum <command> <package name/s>. By default, yum will automatically attempt to check all configured repositories to resolve all package dependencies during an installation/upgrade.
The following is a list of the most commonly-used yum commands. For a complete list of available yum commands, refer to man yum.
yum install <package name/s>
Used to install the latest version of a package or group of packages. If no package matches the specified package name(s), they are assumed to be a shell glob, and any matches are then installed.
yum update <package name/s>
Used to update the specified packages to the latest available version. If no package name/s are specified, then yum will attempt to update all installed packages.
If the --obsoletes option is used (i.e. yum --obsoletes <package name/s>, yum will process obsolete packages. As such, packages that are obsoleted accross updates will be removed and replaced accordingly.
yum check-update
This command allows you to determine whether any updates are available for your installed packages. yum returns a list of all package updates from all repositories if any are available.
yum remove <package name/s>
Used to remove specified packages, along with any other packages dependent on the packages being removed.
Yum provides <file name>
Used to determine which packages provide a specific file or feature.
yum search <keyword>
This command is used to find any packages containing the specified keyword in the description, summary, packager and package name fields of RPMs in all repositories.
yum localinstall <absolute path to package name/s>
Used when using yum to install a package located locally in the machine.
- yum Options
yum options are typically stated before specific yum commands; i.e. yum <options> <command> <package name/s>. Most of these options can be set as default using the configuration file.
The following is a list of the most commonly-used yum options. For a complete list of available yum options, refer to man yum.
-y Answer "yes" to every question in the transaction.
-t Sets yum to be "tolerant" of errors with regard to packages specified in the transaction. For example, if you run yum update package1 package2 and package2 is already installed, yum will continue to install package1.
-
Configuring yum
By default, yum is configured through /etc/yum.conf. The following is an example of a typical /etc/yum.conf file:
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
metadata_expire=1800
[myrepo]
name=RHEL 5 $releasever - $basearch
baseurl=http://local/path/to/yum/repository/
enabled=1
A typical /etc/yum.conf file is made up of two types of sections: a [main] section, and a repository section. There can only be one [main] section, but you can specify multiple repositories in a single /etc/yum.conf.
[main] Options
The [main] section is mandatory, and there must only be one. For a complete list of options you can use in the [main] section, refer to man yum.conf.
The following is a list of the most commonly-used options in the [main] section.
Cachedir
This option specifies the directory where yum should store its cache and database files. By default, the cache directory of yum is /var/cache/yum.
keepcache=<1 or 0>
Setting keepcache=1 instructs yum to keep the cache of headers and packages after a successful installation. keepcache=1 is the default.
reposdir=<absolute path to directory of .repo files>
This option allows you to specify a directory where .repo files are located. .repo files contain repository information.
If reposdir is not set, yum uses the default directory /etc/yum.repos.d.
gpgcheck=<1 or 0>
This disables/enables GPG signature checking on packages on all repositories, including local package installation. The default is gpgcheck=0, which disables GPG checking.
If this option is set in the [main] section of the /etc/yum.conf file, it sets the GPG checking rule for all repositories. However, you can also set this on individual repositories instead; i.e., you can enable GPG checking on one repository while disabling it on another.
assumeyes=<1 or 0>
This determines whether or not yum should prompt for confirmation of critical actions. The default if assumeyes=0, which means yum will prompt you for confirmation.
If assumeyes=1 is set, yum behaves in the same way that the command line option -y does.
tolerant=<1 or 0>
When enabled (tolerant=1), yum will be tolerant of errors on the command line with regard to packages. This is similar to the yum command line option -t.
The default value for this is tolerant=0 (not tolerant).
-
Repository Options
The [repository] section of the /etc/yum.conf file contains information about a repository yum can use to find packages during package installation, updating and dependency resolution. A repository entry takes the following form:
You can also specify repository information in a separate .repo files (for example, rhel5.repo). The format of repository information placed in .repo files is identical with the [repository] of /etc/yum.conf.
.repo files are typically placed in /etc/yum.repos.d, unless you specify a different repository path in the [main] section of /etc/yum.conf with reposdir=. .repo files and the /etc/yum.conf file can contain multiple repository entries.
Each repository entry consists of the following mandatory parts:
[repository ID]
The repository ID is a unique, one-word string that serves as a repository identifier.
name=repository name
This is a human-readable string describing the repository.