1、yum check-update:To see which installed packages on your system have updates available.
2、yum update package_name:To update a single package.
yum update:Updating All Packages and Their Dependencies
3、yum search term...:search all RPM package names, descriptions and summaries,useful for searching for packages you do not know the name of, but for which you know a related term. For example, to list all packages that match “meld” or“kompare”, type:yum search meld kompare
4、yum list glob_expression
...:Lists information on installed and available packages matching all glob expressions.Glob expressions are normal strings of characters which contain one or more of the wildcard characters *
(which expands to match any character multiple times) and ?
(which expands to match any one character).escape the wildcard characters by preceding them with a backslash character.
yum list all:Lists all installed and available packages.
yum list installed [glob_expression]:Lists all packages installed on your system.
yum list available[glob_expression]:List all available packages in all enabled repositories.
yum grouplist:Lists all package groups.
yum repolist:Lists the repository ID, name, and number of packages it provides for each enabled repository.
5、yum infopackage_name...:To display information about one or more packages (glob expressions are valid here as well).
yumdb info package_name:query the Yum database for alternative and useful information about a package.
6、yum install package_name...:To install a single package(s) and all of its non-installed dependencies.You can use glob expressions to quickly install multiple similarly-named packages, for example, yum install audacious-plugins-\*;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, for example:yum install /usr/sbin/named. 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". yum provides "*/file_name" is a common and useful trick to find the packages that contain file_name.
7、yum remove package_name...:To uninstall a particular package, as well as any packages that depend on it.Similar to install
, remove
can take these arguments: package names, glob expressions, file lists, package provides. Yum is not able to remove a package without also removing packages which depend on it. This type of operation can only be performed by RPM.
8、yum history list:To display a list of twenty most recent transactions.
yum history list all:To display all transactions, add the all
keyword.
yum history list start_id ... end_id:To display only transactions in a given range.
yum history list glob_expression:List only transactions regarding a particular package or packages.
9、
Configuring Yum and Yum Repositories
The configuration file for yum
and related utilities is located at /etc/yum.conf
. This file contains one mandatory [main]
section, which allows you to set Yum options that have global effect, and may also contain one or more [
sections, which allow you to set repository-specific options. However, best practice is to define individual repositories in new or existing repository
].repo
files in the /etc/yum.repos.d/
directory. The values you define in the [main]
section of the /etc/yum.conf
file may override values set in individual [
sections.repository
]
The /etc/yum.conf
configuration file contains exactly one [main]
section. The following are the most commonly-used options in the [main]
section:
assumeyes
=value
0
— yum
should prompt for confirmation of critical actions it performs. This is the default.
1
— Do not prompt for confirmation of critical yum
actions. If assumeyes=1
is set, yum
behaves in the same way that the command line option -y
does.
cachedir
=directory
where directory
is an absolute path to the directory where Yum should store its cache and database files. By default, Yum's cache directory is /var/cache/yum/$basearch/$releasever
.
- debuglevel=value
where value is an integer between 1 and 10. Setting a higher debuglevel value causes yum to display more detailed debugging output. debuglevel=0 disables debugging output, while debuglevel=2 is the default.
exactarch
=value
0
— Do not take into account the exact architecture when updating packages.
1
— Consider the exact architecture when updating packages. With this setting,
yum
will not install an i686 package to update an i386 package already installed on the system. This is the default.
-
gpgcheck
=value
0
— Disable GPG signature-checking on packages in all repositories, including local package installation.
1
— Enable GPG signature-checking on all packages in all repositories, including local package installation. gpgcheck=1
is the default, and thus all packages' signatures are checked.
gpgcheck=value
for an individual repository in its corresponding .repo
file overrides the default if it is present in /etc/yum.conf
.
10、yum-config-manager:To display the current values of global Yum options (that is, the options specified in the [main]
section of the /etc/yum.conf
file)
yum-config-manager section...:To list the content of a different configuration section or sections, You can also use a glob expression to display the configuration of all matching sections.
yum-config-manager --add-repo repository_url:Adding a Yum Repository. To define a new repository, you can either add a [
section to the repository
]/etc/yum.conf
file, or to a .repo
file in the /etc/yum.repos.d/
directory. All files with the .repo
file extension in this directory are read by yum
, and best practice is to define your repositories here instead of in /etc/yum.conf
. For example, yum-config-manager --add-repo http://www.example.com/example.repo
yum-config-manager --enable repository…:To enable a particular repository or repositories, where repository
is the unique repository ID (use yum repolist all
to list available repository IDs). Alternatively, you can use a glob expression to enable all matching repositories: yum-config-manager --enable glob_expression…
:To disable a Yum repository, you can use a glob expression to disable all matching repositories at the same time: yum-config-manager --disable glob_expression…yum-config-manager --disable repository…
12、Creating a Yum Repository
To set up a Yum repository, follow these steps:
(1)Install the createrepo package: yum install createrepo
(2)Copy all of the packages into one directory, such as /mnt/local_repo/
.
(3)Run the createrepo --database
command on that directory: createrepo --database /mnt/local_repo. This will create the necessary metadata for your Yum repository, as well as the sqlite database for speeding up yum
operations.You should see a lot of things fly by but it should finish without an error. In the end you should have a directory named /mnt/local_repo/repodata with at least 4 files in it. Maybe more.
(4)To make this repository known to yum you need to add a .repo file to your yum configuration. On the systems where you want to use this repo you need to make a new file in /etc/yum.repos.d/. The file can be named anything but the extension on the file has to be .repo. Let's call this one 'myrepo.repo'. In the file you just need to include the following:
[myrepo]
name = This is my repo
baseurl =file:///mnt/local_repo/
(5)Now, every time you modify, remove or add a new RPM package to /srv/my/repo you need to recreate the repository metadata. You do that by running createrepo the same way you did in step (3).
13、Yum Plug-ins
Yum provides plug-ins that extend and enhance its operations. Certain plug-ins are installed by default. Yum always informs you which plug-ins, if any, are loaded and active whenever you call any yum
command. To enable Yum plug-ins, ensure that a line beginning with plugins=
is present in the [main]
section of /etc/yum.conf
, and that its value is set to 1. Disabling all plug-ins is not advised because certain plug-ins provide important
Yum
services. Disabling plug-ins globally is provided as a convenience option, and is generally only recommended when diagnosing a potential problem with Yum
.
Every installed plug-in has its own configuration file in the
/etc/yum/pluginconf.d/
directory. You can set plug-in specific options in these files.
enabled=0
in
/etc/yum.conf
, then all plug-ins are disabled regardless of whether they are enabled in their individual configuration files.
yum
command, use the
--noplugins
option.
yum
command, add the
--disableplugin=plugin_name
option to the command.