Friday, February 15, 2013

The Basics of RPM – YUM Repositories Linux 101

The Basics of RPM – YUM Repositories [Linux 101]:
rpml-logoMuch like capabilities of APT we explored previously, users of RPM-based distributions are able to download a piece of software (including all its dependencies), install it, and keep it up to date with the latest versions. In fact, distributions such as PCLinuxOS and ALT Linux use APT directly with RPM packages.

For Red Hat-based distributions, the primary way to manage software is through YUM. YUM, or the Yellowdog Updater, Modified, is a rewrite of the Yellow Dog Linux updater tool that has since been adopted by major distros including Fedora, CentOS, and Red Hat itself.

YUM Repositories

Software available via YUM is kept in online repositories, either on a local machine, or network-accessible location (HTTP is most common, but the local file:/// or ftp:// are also supported). Each repository has a sub-directory called “/repodata” containing information about the repository. This information is kept in a range of header files, including the following:
  • primary
  • other
  • filelists
Each of these headers is in Gzipped XML format as well as BZ2-compressed SQLite format. A “repomd.xml” file contains info on the repository as a whole.

Configuring a YUM Repository

Getting set up with a new YUM repository involves downloading the repository’s .repo file, and copying into the “/etc/yum/yum.repos.d/” directory, or creating this file if it is not provided. Alternately, the changes can also be included in the “/etc/yum.conf” file, although this is not recommended. Once the repository is configured, you can freely install or update software from it.
Note two main differences between the operation of RPM/YUM and DEB/APT:
  • Firstly, once a new repository is configured, YUM doesn’t require the equivalent of APT’s *apt-get update* command. Rather, when the request to install a package is made, YUM will check the available repositories for that package when the command is executed.
  • In addition, in contrast to Ubuntu’s *add-apt-repository* command, which automatically downloads, installs, and configures (such as the signature key for the packages in the repository), the command-line YUM commands don’t include this functionality. However, this is something that a GUI package manager likely makes easy.

Useful YUM Commands

The following are some of the more common operations that utilize the YUM commands:
  • yum search [search term]: This command, as it would appear, will search any existing configured repositories for packages that contain the search term.
  • yum install [package name]: This will install the specified package and its dependencies.
  • yum check-updates: This command will present a list of package for which an update is available.
  • yum update: If this command is issued without a package name as an argument, it will update all packages in the system. Otherwise a package name can be supplied to update that package only.
  • yum remove [package name]: This command will uninstall the specified package, and any packages that depend on it.
While in structure there are differences between the RPM- and DEB-based distributions, in practice it is largely a matter of command-line syntax. So if your boss is nervous about deploying an Ubuntu server, and likes the warm fuzzies that Red Hat provides, rest assured that you’ll be managing software with the best of them in no time with YUM.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.