8.2. Working with Packages
8.2.1. Searching Packages
Example 8.4. Searching for packages matching a specific string
yum search vim gvim emacsLoaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager ============================= N/S matched: vim ============================== vim-X11.x86_64 : The VIM version of the vi editor for the X Window System vim-common.x86_64 : The common files needed by any version of the VIM editor [output truncated] ============================ N/S matched: emacs ============================= emacs.x86_64 : GNU Emacs text editor emacs-auctex.noarch : Enhanced TeX modes for Emacs [output truncated] Name and summary matches mostly, use "search all" for everything. Warning: No matches found for: gvim
yum searchcommand is useful for searching for packages you do not know the name of, but for which you know a related term. Note that by default,
yum searchreturns matches in package name and summary, which makes the search faster. Use the
yum search allcommand for a more exhaustive but slower search.
Filtering the Results
*(which expands to match any character subset) and
?(which expands to match any single character).
yumcommand, otherwise the Bash shell will interpret these expressions as pathname expansions, and potentially pass all files in the current directory that match the global expressions to
yum. To make sure the glob expressions are passed to
yumas intended, use one of the following methods:
- escape the wildcard characters by preceding them with a backslash character
- double-quote or single-quote the entire glob expression.
8.2.2. Listing Packages
yum list glob_expression…
Example 8.5. Listing ABRT-related packages
yum list abrt-addon\* abrt-plugin\*Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager Installed Packages abrt-addon-ccpp.x86_64 2.1.11-35.el7 @rhel-7-server-rpms abrt-addon-kerneloops.x86_64 2.1.11-35.el7 @rhel-7-server-rpms abrt-addon-pstoreoops.x86_64 2.1.11-35.el7 @rhel-7-server-rpms abrt-addon-python.x86_64 2.1.11-35.el7 @rhel-7-server-rpms abrt-addon-vmcore.x86_64 2.1.11-35.el7 @rhel-7-server-rpms abrt-addon-xorg.x86_64 2.1.11-35.el7 @rhel-7-server-rpms
installedkeyword. The rightmost column in the output lists the repository from which the package was retrieved.
Example 8.6. Listing all installed versions of the krb package
yum list installed "krb?-*"Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager Installed Packages krb5-libs.x86_64 1.13.2-10.el7 @rhel-7-server-rpms
Example 8.7. Listing available gstreamer plug-ins
yum list available gstreamer\*plugin\*Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager Available Packages gstreamer-plugins-bad-free.i686 0.10.23-20.el7 rhel-7-server-rpms gstreamer-plugins-base.i686 0.10.36-10.el7 rhel-7-server-rpms gstreamer-plugins-good.i686 0.10.31-11.el7 rhel-7-server-rpms gstreamer1-plugins-bad-free.i686 1.4.5-3.el7 rhel-7-server-rpms gstreamer1-plugins-base.i686 1.4.5-2.el7 rhel-7-server-rpms gstreamer1-plugins-base-devel.i686 1.4.5-2.el7 rhel-7-server-rpms gstreamer1-plugins-base-devel.x86_64 1.4.5-2.el7 rhel-7-server-rpms gstreamer1-plugins-good.i686 1.4.5-2.el7 rhel-7-server-rpms
-voption. With this option enabled, information including the file name, overall size, date of the last update, and base URL are displayed for each listed repository. As an alternative, you can use the
repoinfocommand that produces the same output.
disabledas a first argument, you can reduce the command output to disabled repositories. For further specification you can pass the ID or name of repositories or related glob_expressions as arguments. Note that if there is an exact match between the repository ID or name and the inserted argument, this repository is listed even if it does not pass the enabled or disabled filter.
8.2.3. Displaying Package Information
Example 8.8. Displaying information on the abrt package
yum info abrtLoaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager Installed Packages Name : abrt Arch : x86_64 Version : 2.1.11 Release : 35.el7 Size : 2.3 M Repo : installed From repo : rhel-7-server-rpms Summary : Automatic bug detection and reporting tool URL : https://fedorahosted.org/abrt/ License : GPLv2+ Description : abrt is a tool to help users to detect defects in applications and : to create a bug report with all information needed by maintainer to fix : it. It uses plugin system to extend its functionality.
yum info package_namecommand is similar to the
rpm -q --info package_namecommand, but provides as additional information the name of the yum repository the RPM package was installed from (look for the
From repo:line in the output).
userindicates it was installed by the user, and
depmeans it was brought in as a dependency).
Example 8.9. Querying yumdb for information on the yum package
yumdb info yumLoaded plugins: langpacks, product-id yum-3.4.3-132.el7.noarch changed_by = 1000 checksum_data = a9d0510e2ff0d04d04476c693c0313a11379053928efd29561f9a837b3d9eb02 checksum_type = sha256 command_line = upgrade from_repo = rhel-7-server-rpms from_repo_revision = 1449144806 from_repo_timestamp = 1449144805 installed_by = 4294967295 origin_url = https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/Packages/yum-3.4.3-132.el7.noarch.rpm reason = user releasever = 7Server var_uuid = 147a7d49-b60a-429f-8d8f-3edb6ce6f4a1
yumdbcommand, see the yumdb(8) manual page.
8.2.4. Installing Packages
Example 8.10. Installing packages on multilib system
Example 8.11. Installing all audacious plugins
yum install. If you know the name of the binary you want to install, but not its package name, you can give
yum installthe path name. As
yum install /usr/sbin/named
/usr/sbin/named, if any, and prompts you as to whether you want to install it.
yum installcommand does not require strictly defined arguments. It can process various formats of package names and glob expressions, which makes installation easier for users. On the other hand, it takes some time until yum parses the input correctly, especially if you specify a large number of packages. To optimize the package search, you can use the following commands to explicitly define how to parse the arguments:
install-n, yum interprets name as the exact name of the package. The
install-nacommand tells yum that the subsequent argument contains the package name and architecture divided by the dot character. With
install-nevra, yum will expect an argument in the form name-epoch:version-release.architecture. Similarly, you can use
yum remove-na, and
yum remove-nevrawhen searching for packages to be removed.
namedbinary, but you do not know in which
sbin/directory the file is installed, use the
yum providescommand with a glob expression:
yum provides "*bin/named"Loaded plugins: langpacks, product-id, search-disabled-repos, subscription- : manager 32:bind-9.9.4-14.el7.x86_64 : The Berkeley Internet Name Domain (BIND) DNS : (Domain Name System) server Repo : rhel-7-server-rpms Matched from: Filename : /usr/sbin/named
yum provides "*/file_name"is a useful way to find the packages that contain file_name.
Example 8.12. Installation Process
yum install httpdLoaded plugins: langpacks, product-id, subscription-manager Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-12.el7 will be updated ---> Package httpd.x86_64 0:2.4.6-13.el7 will be an update --> Processing Dependency: 2.4.6-13.el7 for package: httpd-2.4.6-13.el7.x86_64 --> Running transaction check ---> Package httpd-tools.x86_64 0:2.4.6-12.el7 will be updated ---> Package httpd-tools.x86_64 0:2.4.6-13.el7 will be an update --> Finished Dependency Resolution Dependencies Resolved
================================================================================ Package Arch Version Repository Size ================================================================================ Updating: httpd x86_64 2.4.6-13.el7 rhel-x86_64-server-7 1.2 M Updating for dependencies: httpd-tools x86_64 2.4.6-13.el7 rhel-x86_64-server-7 77 k Transaction Summary ================================================================================ Upgrade 1 Package (+1 Dependent package) Total size: 1.2 M Is this ok [y/d/N]:
N(no) options, you can choose
d(download only) to download the packages but not to install them directly. If you choose
y, the installation proceeds with the following messages until it is finished successfully.
Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : httpd-tools-2.4.6-13.el7.x86_64 1/4 Updating : httpd-2.4.6-13.el7.x86_64 2/4 Cleanup : httpd-2.4.6-12.el7.x86_64 3/4 Cleanup : httpd-tools-2.4.6-12.el7.x86_64 4/4 Verifying : httpd-2.4.6-13.el7.x86_64 1/4 Verifying : httpd-tools-2.4.6-13.el7.x86_64 2/4 Verifying : httpd-tools-2.4.6-12.el7.x86_64 3/4 Verifying : httpd-2.4.6-12.el7.x86_64 4/4 Updated: httpd.x86_64 0:2.4.6-13.el7 Dependency Updated: httpd-tools.x86_64 0:2.4.6-13.el7 Complete!
8.2.5. Downloading Packages
... Total size: 1.2 M Is this ok [y/d/N]: ...
doption, yum downloads the packages without installing them immediately. You can install these packages later offline with the
yum localinstallcommand or you can share them with a different device. Downloaded packages are saved in one of the subdirectories of the cache directory, by default
/var/cache/yum/$basearch/$releasever/packages/. The downloading proceeds in background mode so that you can use yum for other operations in parallel.
8.2.6. Removing Packages
Example 8.13. Removing several packages
yum remove totem
removecan take these arguments:
- package names
- glob expressions
- file lists
- package provides