必须选择下面的基本模式:Query, Verify, Signature Check, Install/Upgrade/Freshen, Uninstall, Initialize Database, Rebuild Database, Resign, Add Signature, Set Owners/Groups, Show Querytags, and Show Configuration。
rpm一般选项:可以用于所有的不同的模式中。
-vv
rpm查询选项的通用格式:
rpm {-q|--query} [select-options] [query-options]
有两个查询的子集选项:包选择和包查询选择。即[select-options]和[query-options]
包选择选项:[select-options]
rpm -q tcpdump
rpm -qa
rpm -qf /usr/bin/bash
rpm -qg 组包名
包查询选择:[query-options]
rpm -q pam --changelog 查询包更改历史
rpm -qc pam 只列出配置文件
rpm -qc pam -vv
rpm -qd pam 只列出帮助文件
rpm -qi pam 显示包信息
rpm -qa --last|more 以包安装的顺序来列出包内容,结果是最后一个安装的包在最上层列出。
rpm -ql pam
rpm -q pam --provides
rpm -qR pam 列出依赖的包
rpm -q pam --scripts
rpm安装的通用命令如下:
rpm {-i|--install} [install-options] PACKAGE_FILE ...
PACKAGE_FILE 形如oracle-instantclient-sqlplus-10.2.0.3-1.x86_64.rpm
PACKAGE_NAME 形如oracle-instantclient-sqlplus
yum [options] COMMAND package_name
其中的[options]是可选的,选项包括-h(帮助),-y(当安装过程提示选择全部为"yes"),-q(不显示安装的过程)等等。[command]为所要进行的操作,[package ...]是操作的对象。
安装最快镜像插件: yum install yum-fastestmirror
安装yum图形窗口插件: yum install yumex
显示所有已经安装和可以安装的程序包 yum list 蓝色已安装,白色未安装
显示库 yum repolist
安装额外的软件仓库:
rpm.livna.org 的软件包仓库:
rpm -ivh http://livna-dl.reloumirrors.net … ease-7-2.noarch.rpm
freshrpms.net 的软件包仓库:
rpm –ivh http://ftp.freshrpms.net/pub/fre … 1.1-1.fc.noarch.rpm
[root@localhost dd]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name status
base CentOS-6 - Base 6,367
repolist: 6,367
[root@localhost dd]# yum clean
Loaded plugins: fastestmirror
Error: clean requires an option: headers, packages, metadata, dbcache, plugins, expire-cache, rpmdb, all
[root@localhost dd]# yum history
Loaded plugins: fastestmirror
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
9 | root <root> | 2014-09-20 00:23 | Install | 2
8 | root <root> | 2014-09-20 00:21 | Install | 2
7 | root <root> | 2014-09-20 00:20 | Install | 1
6 | root <root> | 2014-09-20 00:06 | Erase | 1
5 | root <root> | 2014-09-20 00:02 | Install | 1
4 | root <root> | 2014-09-20 00:01 | Erase | 1
3 | root <root> | 2014-09-19 23:46 | Install | 1
2 | root <root> | 2014-09-18 17:46 | Install | 7
1 | System <unset> | 2014-09-18 17:32 | Install | 205
history list
[root@localhost dd]# yum --help |egrep "remove|erase"
erase Remove a package or packages from your system
groupremove Remove the packages in a group from your system
[root@localhost dd]# yum deplist gcc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Finding dependencies:
package: gcc.x86_64 4.4.7-4.el6
dependency: libgcc >= 4.4.7-4.el6
provider: libgcc.i686 4.4.7-4.el6
provider: libgcc.x86_64 4.4.7-4.el6
dependency: /sbin/install-info
provider: info.x86_64 4.13a-8.el6
dependency: libgomp.so.1()(64bit)
provider: libgomp.x86_64 4.4.7-4.el6
dependency: cloog-ppl >= 0.15
provider: cloog-ppl.x86_64 0.15.7-1.2.el6
provider: cloog-ppl.i686 0.15.7-1.2.el6
dependency: glibc-devel >= 2.2.90-12
provider: glibc-devel.x86_64 2.12-1.132.el6
provider: glibc-devel.i686 2.12-1.132.el6
dependency: cpp = 4.4.7-4.el6
provider: cpp.x86_64 4.4.7-4.el6
dependency: binutils >= 2.19.51.0.14-33
provider: binutils.x86_64 2.20.51.0.2-5.36.el6
dependency: libgomp = 4.4.7-4.el6
provider: libgomp.x86_64 4.4.7-4.el6
provider: libgomp.i686 4.4.7-4.el6
dependency: rtld(GNU_HASH)
provider: glibc.i686 2.12-1.132.el6
provider: glibc.x86_64 2.12-1.132.el6
dependency: libc.so.6(GLIBC_2.7)(64bit)
provider: glibc.x86_64 2.12-1.132.el6
dependency: /bin/sh
provider: bash.x86_64 4.1.2-15.el6_4
dependency: libgcc_s.so.1()(64bit)
provider: libgcc.x86_64 4.4.7-4.el6
[root@localhost dd]# yum search w3m
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
====================================================================== N/S Matched: w3m ======================================================================
w3m-img.x86_64 : A helper program to display the inline images for w3m
w3m.x86_64 : A pager with Web browsing abilities
Name and summary matches only, use "search all" for everything.