1. 如何检测一个RPM签名的软件包
在安装软件前经常检测PGP 签名是一个良好的习惯 选用Cchecksig 选项[root@tecmint]# rpm --checksig pidgin-2.7.9-5.el6.2.i686.rpm
pidgin-2.7.9-5.el6.2.i686.rpm: rsa sha1 (md5) pgp md5 OK
2. 安装一个rpm软件包:使用 -i 选项;例如:pidgin2.7.9-.el6.2.i686.rpm.包[root@tecmint]# rpm -ivh pidgin-2.7.9-5.el6.2.i686.rpm
Preparing... ########################################### [100%]
1:pidgin ########################################### [100%]
RPM 命令选项-i : 安装一个包
-v : 详细的显示
-h: 对rpm包列出hash标注
3. 在安装RPM 包前,检测依赖[root@tecmint]# rpm -qpR BitTorrent-5.2.2-1-Python2.4.noarch.rpm
/usr/bin/python2.4
python >= 2.3
python(abi) = 2.4
python-crypto >= 2.0
python-psyco
python-twisted >= 2.0
python-zopeinterface
rpmlib(CompressedFileNames) = 2.6
RPM command and options-q : 查询一个包
-p : 列出包内容
-R: 列出rpm包依赖内容
4. 安装RPM 包,不用依赖关系使用 Cnodeps[root@tecmint]# rpm -ivh --nodeps BitTorrent-5.2.2-1-Python2.4.noarch.rpm
Preparing... ########################################### [100%]
1:BitTorrent ########################################### [100%]
5. 检测一个已安装的RPM 包,使用-q选项[root@tecmint]# rpm -q BitTorrent
BitTorrent-5.2.2-1.noarch
6. 列出所有以安装的RPM包-ql(query[root@tecmint]# rpm -ql
/usr/bin/bittorrent
/usr/bin/bittorrent-console
/usr/bin/bittorrent-curses
/usr/bin/bittorrent-tracker
/usr/bin/changetracker-console
/usr/bin/launchmany-console
/usr/bin/launchmany-curses
/usr/bin/maketorrent
/usr/bin/maketorrent-console
/usr/bin/torrentinfo-console
7. 列出最近安装 RPM 包:使用 -qa(query all)与--last[root@tecmint]# rpm -qa --last
BitTorrent-5.2.2-1.noarch Tue 04 Dec 2012 05:14:06 PM BDT
pidgin-2.7.9-5.el6.2.i686 Tue 04 Dec 2012 05:13:51 PM BDT
cyrus-sasl-devel-2.1.23-13.el6_3.1.i686 Tue 04 Dec 2012 04:43:06 PM BDT
cyrus-sasl-2.1.23-13.el6_3.1.i686 Tue 04 Dec 2012 04:43:05 PM BDT
cyrus-sasl-md5-2.1.23-13.el6_3.1.i686 Tue 04 Dec 2012 04:43:04 PM BDT
cyrus-sasl-plain-2.1.23-13.el6_3.1.i686 Tue 04 Dec 2012 04:43:03 PM BDT
8. 列出所有 RPM 包 使用 -qa[root@tecmint]# rpm -qa
initscripts-9.03.31-2.el6.centos.i686
polkit-desktop-policy-0.96-2.el6_0.1.noarch
thunderbird-17.0-1.el6.remi.i686
9. 升级一个RPM包: -u 选项升级最后版本和维护备份[root@tecmint]# rpm -Uvh nx-3.5.0-2.el6.centos.i686.rpm
Preparing... ########################################### [100%]
1:nx ########################################### [100%]
10. 移除rpm包:-e (erase)选项[root@tecmint]# rpm -evv nx
11. 不用依赖关系移除 RPM 包:使用 --nodegs选项[root@tecmint]# rpm -ev --nodeps vsftpd
12. 查询一个RPM 包文件,使用-qf(query file) 选项[root@tecmint]# rpm -qf /usr/bin/htpasswd
httpd-tools-2.2.15-15.el6.centos.1.i686
13. 查询已安装 RPM 包的信息 使用-qi(query info) 选项[root@tecmint]# rpm -qi vsftpd
Name : vsftpd Relocations: (not relocatable)
Version : 2.2.2 Vendor: CentOS
Release : 11.el6 Build Date: Fri 22 Jun 2012 01:54:24 PM BDT
Install Date: Mon 17 Sep 2012 07:55:28 PM BDT Build Host: c6b8.bsys.dev.centos.org
Group : System Environment/Daemons Source RPM: vsftpd-2.2.2-11.el6.src.rpm
Size : 351932 License: GPLv2 with exceptions
Signature : RSA/SHA1, Mon 25 Jun 2012 04:07:34 AM BDT, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem
URL : http://vsftpd.beasts.org/
Summary : Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.
14. 获得RPM包的安装信息:-qip(query info package) 选项[root@tecmint]# rpm -qip sqlbuddy-1.3.3-1.noarch.rpm
Name : sqlbuddy Relocations: (not relocatable)
Version : 1.3.3 Vendor: (none)
Release : 1 Build Date: Wed 02 Nov 2011 11:01:21 PM BDT
Install Date: (not installed) Build Host: rpm.bar.baz
Group : Applications/Internet Source RPM: sqlbuddy-1.3.3-1.src.rpm
Size : 1155804 License: MIT
Signature : (none)
Packager : Erik M Jacobs
URL : http://www.sqlbuddy.com/
Summary : SQL Buddy Web based MySQL administration
Description :
SQLBuddy is a PHP script that allows for web-based MySQL administration.
15. 查询RPM安装包的文档-qdf[root@tecmint]# rpm -qdf /usr/bin/vmstat
/usr/share/doc/procps-3.2.8/BUGS
/usr/share/doc/procps-3.2.8/COPYING
/usr/share/doc/procps-3.2.8/COPYING.LIB
/usr/share/doc/procps-3.2.8/FAQ
/usr/share/doc/procps-3.2.8/NEWS
/usr/share/doc/procps-3.2.8/TODO
16. 效验一个 RPM 包 使用-Vp(verify package[root@tecmint downloads]# rpm -Vp sqlbuddy-1.3.3-1.noarch.rpm
S.5....T. c /etc/httpd/conf.d/sqlbuddy.conf
17. 效验所有 RPM 包 使用 -va选项[root@tecmint]# rpm -Va
S.5....T. c /etc/rc.d/rc.local
.......T. c /etc/dnsmasq.conf
.......T. /etc/ld.so.conf.d/kernel-2.6.32-279.5.2.el6.i686.conf
S.5....T. c /etc/yum.conf
S.5....T. c /etc/yum.repos.d/epel.repo
18. 输入一个 RPM GPG 键[root@tecmint]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
19. 列出所有已输入 RPM GPG 键[root@tecmint]# rpm -qa gpg-pubkey*
gpg-pubkey-0608b895-4bd22942
gpg-pubkey-7fac5991-4615767f
gpg-pubkey-0f2672c8-4cd950ee
gpg-pubkey-c105b9de-4e0fd3a3
gpg-pubkey-00f97f56-467e318a
gpg-pubkey-6b8d79e6-3f49313d
gpg-pubkey-849c449f-4cb9df30
20. 重建RPM包数据[root@tecmint]# cd /var/lib
[root@tecmint]# rm __db*
[root@tecmint]# rpm --rebuilddb
[root@tecmint]# rpmdb_verify Packages