Linux+: Applications 08 – Managing Yum Repositories

J

Jarret W. Buse

Guest
Linux+: Applications 08 – Managing Yum Repositories

Repositories are links to a storage site which contains packages for download. Packages are an archived set of files needed to install an application. Maintaining your repository list is crucial to keep your packages up to date. These subcommands can help you manage a large number of packages for installation, removal and updating. Be aware that the packages in a repository can be managed as if they were a single group.

The “yum” command has four subcommands used to manage the repository list:

  • repolist – displays the enabled repositories in the list
  • repoinfo – shows information on specific enabled repository
  • repo-pkgs – deals with packages from a specific repository
  • makecache – downloads repository data to the local cache

To see all the repositories which are enabled use the “repolist” subcommand. Repositories can be disabled, but still kept in the repository list.

There are three subcommands that can be used with “repolist”.

  • enabled – lists only enabled repositories (default)
  • disabled – shows the list of disabled repositories in the repository list
  • all – displays all repositories in the list whether enabled or disabled

To see a list of only disabled repositories, use the command “yum repolist disabled”.

Another option to use with “repolist” is the “-v” option to shows more verbose information. With the “-v” option, the following is listed:

  • repo-id
  • repo-name
  • repo-revision
  • repo-tags
  • repo-updated
  • repo-pkgs
  • repo-size
  • repo-metalink
  • updated metalink
  • repo-baseurl
  • repo-expire
  • repo-filename

Once you have the list of repositories, you can see more information on the individual repositories with the subcommand “repoinfo”.

It is also possible to pass the repo-id or repo-name to the “repolist” subcommand to gain information on a specific repository. You may also use a wildcard to get data on multiple repositories.

The “repoinfo” subcommand works identical to the “repolist” subcommand. All options work in the same manner.

The “repo-pckgs” subcommand is used to manage the packages from a specific repository. The packages from the repository are treated as a group so all packages from a repository can be installed or removed as one.

The syntax for “repo-pkgs” is:

repo-pkgs <repoid> <list|info|install|remove|upgrade|reinstall*|remove-or-*> [pkg(s)]

The “repo-id” is found from the “repolist” or repoinfo” subcommands. The options are as follows:

  • list – lists packages from the specified repository
  • info – shows package information from specified repository
  • check-update – determines if there are any package updates from the specified repository
  • install – installs all packages from the specified repository
  • remove – removes all packages from the specified repository
  • upgrade – updates all packages in the specified repository
  • upgrade-to – updates packages in repository to the specified version
  • reinstall-old – reinstalls all packages from the repository which are currently installed
  • reinstall – performs a reinstall-old and if it fails it will try move-to
  • move-to – reinstalls all packages in the repository even if they are installed or not
  • remove-or-reinstall – removes any package without same version in a repository or reinstalls the package if version if the same
  • remove-or-distro-sync – removes a package which does not exist in another repository or performs a distro-sync

For example, to see the packages hosted by the repository “fedora/20/x86_64” you can use the command “yum repo-pkgs fedora/20/x86_64 list”.

NOTE: The lists of packages by some repositories can be quite lengthy and you should probably pipe through less (“| less”).

The “info” option will give the following information on each package:

  • name
  • architecture
  • version
  • release
  • size
  • repository
  • summary
  • URL
  • license
  • description

The “makecache” subcommand is used to download the repository metadata to the local drive for the enabled repositories. The option “fast” can be used to update only the expired repository metadata.

The repository metadata is similar in nature to the listing given by the subcommand “repoinfo”. In this manner, locally installed packages can be compared to the repository information to determine if an update exists. When an update exists, it can be updated when using the “upgrade” subcommand.

These subcommands may need more practice than some of the other subcommands for “yum”. Be aware of these subcommands to help with repository management since they can be useful.
 

Attachments

  • slide.jpg
    slide.jpg
    32.9 KB · Views: 175,311

Members online


Latest posts

Top