此内容没有您所选择的语言版本。
8.2.4. Installing Packages
Yum allows you to install both a single package and multiple packages, as well as a package group of your choice.
Installing Individual Packages
To install a single package and all of its non-installed dependencies, enter a command in the following form:
yum
install
package_name
You can also install multiple packages simultaneously by appending their names as arguments:
yum
install
package_name package_name
If you are installing packages on a multilib system, such as an AMD64 or Intel 64 machine, you can specify the architecture of the package (as long as it is available in an enabled repository) by appending .arch to the package name. For example, to install the sqlite package for
i686
, type:
~]# yum install sqlite.i686
You can use glob expressions to quickly install multiple similarly-named packages:
~]# yum install perl-Crypt-\*
In addition to package names and glob expressions, you can also provide file names to
yum install
. If you know the name of the binary you want to install, but not its package name, you can give yum install
the path name:
~]# yum install /usr/sbin/named
yum
then searches through its package lists, finds the package which provides /usr/sbin/named
, if any, and prompts you as to whether you want to install it.
Note
If you know you want to install the package that contains the
named
binary, but you do not know in which bin
or sbin
directory is the file installed, use the yum provides
command with a glob expression:
~]# yum provides "*bin/named"
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
32:bind-9.7.0-4.P1.el6.x86_64 : The Berkeley Internet Name Domain (BIND)
: DNS (Domain Name System) server
Repo : rhel
Matched from:
Filename : /usr/sbin/named
yum provides "*/file_name"
is a common and useful trick to find the package(s) that contain file_name.
Installing a Package Group
A package group is similar to a package: it is not useful by itself, but installing one pulls a group of dependent packages that serve a common purpose. A package group has a name and a groupid. The
yum grouplist -v
command lists the names of all package groups, and, next to each of them, their groupid in parentheses. The groupid is always the term in the last pair of parentheses, such as kde-desktop
in the following example:
~]# yum -v grouplist kde\*
Loading "product-id" plugin
Loading "refresh-packagekit" plugin
Loading "subscription-manager" plugin
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Config time: 0.123
Yum Version: 3.2.29
Setting up Group Process
Looking for repo options for [rhel]
rpmdb time: 0.001
group time: 1.291
Available Groups:
KDE Desktop (kde-desktop)
Done
You can install a package group by passing its full group name (without the groupid part) to
groupinstall
:
yum
groupinstall
group_name
You can also install by groupid:
yum
groupinstall
groupid
You can even pass the groupid (or quoted name) to the
install
command if you prepend it with an @-symbol (which tells yum
that you want to perform a groupinstall
):
yum
install
@group
For example, the following are alternative but equivalent ways of installing the
KDE Desktop
group:
~]#yum groupinstall "KDE Desktop"
~]#yum groupinstall kde-desktop
~]#yum install @kde-desktop