1.几个不错的rpm包资源网站
http://rpm.pbone.net
http://ftp.redhat.com
http://mirrors.kernel.org
http://freshrpms.net
2.查询rpm软件包数据库(已经安装与可安装)
[root@localhost ~]# rpm -qi gcc
Name : gcc Relocations: (not relocatable)
Version : 4.1.2 Vendor: Red Hat, Inc.
Release : 46.el5 Build Date: Fri 15 May 2009 01:23:20 AM CST
Install Date: Mon 03 Sep 2012 04:59:09 PM CST Build Host: hs20-bc1-5.build.redhat.com
Group : Development/Languages Source RPM: gcc-4.1.2-46.el5.src.rpm
Size : 10424701 License: GPL
Signature : DSA/SHA1, Fri 31 Jul 2009 07:07:56 PM CST, Key ID 5326810137017186
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://gcc.gnu.org
Summary : Various compilers (C, C++, Objective-C, Java, ...)
Description :
The gcc package contains the GNU Compiler Collection version 4.1.
You'll need this package in order to compile C code.
如上,当使用-qi组合参数查询某个软件包时,rpm将从其维护的软件包数据库查询出这个软件包的
详细信息【记录】,而在上面输出中类似Name,Version等标签可以理解成是一行记录的列值,使
用--qf(query field且注意,是--qf而非-qf)来查询指定列值:
[root@localhost ~]# rpm -q --qf '%{NAME}"s version is %{VERSION} \n' gcc
gcc"s version is 4.1.2
3.rpm查询软件包相关文件
1):查询随软件包生成的文件(所有)
[root@localhost ~]# rpm -ql rpm
/bin/rpm
...
/var/lib/rpm/__db.009
/var/spool/repackage
2):查询随软件包生成的配置文件
[root@localhost ~]# rpm -qc rpm
/etc/logrotate.d/rpm
...
/var/lib/rpm/__db.009
4.rpm数据库重建
[root@localhost ~]# rpm --rebuilddb
5.rpm检验功能
1):验证软件包
[root@localhost rpm]# rpm -V rpm
2):验证软件包相关的文件
[root@localhost rpm]# which rpm
/bin/rpm
[root@localhost rpm]# rpm -Vf /bin/rpm
正常情况下应该没有返回信息的,具体的返回值含义如下:
S 文件大小验证有出入
M 文件类型或者权限验证有出入5 MD5验证有出入
D 设备主次号有验证有出入L readLink-path mismatch
U User ownership
G group ownership
T Modified time
应该定期执行rpm -Va命令来验证所有已经安装的软件包相关命令本身及其配置
文件的检验值结果,以防范非法入侵带来的系统文件篡改。
6.rpm数字签证
使用 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-*导入,数字签证概念不是很清楚。
PS1:rpm分节帮助信息
[root@localhost ~]# rpm --help
Usage: rpm [OPTION...]
--quiet
Query options (with -q or --query):
-c, --configfiles list all configuration files
...
--nomanifest do not process non-package files as
manifests
Verify options (with -V or --verify):
--nomd5 don't verify MD5 digest of files
...
--nomanifest do not process non-package files as
manifests
File tree walk options (with --ftswalk):
--comfollow FTS_COMFOLLOW: follow command line symlinks
...
--whiteout FTS_WHITEOUT: return whiteout information
Signature options:
--addsign sign package(s) (identical to --resign)
...
--nosignature don't verify package signature(s)
Database options:
--initdb initialize database
--rebuilddb rebuild database inverted lists from
installed package headers
Install/Upgrade/Erase options:
--aid add suggested packages to transaction
...
not
-U, --upgrade=<packagefile>+ upgrade package(s)
Common options for all rpm modes and executables:
-D, --define='MACRO EXPR' define MACRO with value EXPR
...
--version print the version of rpm being used
Options implemented via popt alias/exec:
--scripts list install/erase scriptlets from
...
--without=<option> disable configure <option> for build
Help options:
-?, --help Show this help message
--usage Display brief usage message
PS2:rpm命令加强工具 - yum(Yellowdog Updater Modified) 配置与使用
RHEL yum源配置文件:/etc/yum.repos.d/rhel-debuginfo.repo
CentOS : /etc/yum.repos.d/CentOS-Media.repo
配置信息:
[localrepo] --名称
name=localrepo --理解成nick name吧
baseurl=http://192.168.1.12/RedHat5.4/64/Server/ --repodata所在父目录,repodata目录下有repomd.xml文件,yum核心配置文件
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release --key ring(签证),一般默认即可
使用:
yum --disablerepo=\* --enablerepo=localrepo install readline
[root@localhost yum.repos.d]# yum grouplist --disablerepo=\* --enablerepo=localrepo
Installed Groups:
Administration Tools
...
X Window System
Available Groups:
Authoring and Publishing
...
Windows File Server
Done
当然,你在配置好yum源后,如果以后只使用这一个yum源,完全可以创建一个alias。