RPM是RedHat Package Manager(RedHat软件包管理工具)的缩写,这一文件格式名称虽然打上了RedHat的标志,但是其原始设计理念是开放式的,现在包括OpenLinux、S.u.S.E.以及Turbo Linux等Linux的分发版本都有采用,可以算是公认的行业标准了。
本文讲解如何管理RPM包。
#安装:i:install v:view h:进度条
[root@serv01 Packages]# rpm -ivh mysql-5.1.52-1.el6_0.1.x86_64.rpm i:install v:view进度条
#rpm -qa query all
#查看mysql-server安装包
[root@serv01 Packages]# rpm -qa | grep mysql-server
mysql-server-5.1.52-1.el6_0.1.x86_64
#查看mysql-server安装包生成的文件 l:list
[root@serv01 Packages]# rpm -ql mysql-server
/etc/rc.d/init.d/mysqld
#其余文件略
/usr/share/mysql/mysql_test_data_timezone.sql
/var/lib/mysql
/var/log/mysqld.log
/var/run/mysqld
#查看安装包生成的文件属于哪个安装包
[root@serv01 ~]# ls /usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-medium.cnf
[root@serv01 ~]# rpm -qf /usr/share/mysql/my-medium.cnf
mysql-server-5.1.52-1.el6_0.1.x86_64
#查看mysql-server安装包的详细信息
[root@serv01 ~]# rpm -qi mysql-server
Name : mysql-server Relocations: (not relocatable)
Version : 5.1.52 Vendor: Red Hat, Inc.
Release : 1.el6_0.1 Build Date: Tue 21 Dec 2010 02:56:53 AM CST
Install Date: Sat 27 Jul 2013 12:39:09 AM CST Build Host: x86-006.build.bos.redhat.com
Group : Applications/Databases Source RPM: mysql-5.1.52-1.el6_0.1.src.rpm
Size : 24481725 License: GPLv2 with exceptions
Signature : RSA/8, Mon 17 Jan 2011 09:48:19 PM CST, Key ID 199e2f91fd431d51
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://www.mysql.com
Summary : The MySQL server and related files
Description :
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package contains
the MySQL server and some accompanying files and directories.
[root@serv01 Packages]# rpm --help
Usage: rpm [OPTION...]
--quiet
Query/Verify package selection options:
-a, --all query/verify all packages
-f, --file query/verify package(s) owning file
-g, --group query/verify package(s) in group
-p, --package query/verify a package file
-W, --ftswalk query/verify package(s) from TOP file tree walk
--pkgid query/verify package(s) with package identifier
--hdrid query/verify package(s) with header identifier
--fileid query/verify package(s) with file identifier
--specfile query a spec file
--triggeredby query the package(s) triggered by the package
--whatrequires query/verify the package(s) which require a dependency
--whatprovides query/verify the package(s) which provide a dependency
--nomanifest do not process non-package files as manifests
Query options (with -q or --query):
-c, --configfiles list all configuration files
-d, --docfiles list all documentation files
--dump dump basic file information
-l, --list list files in package
--queryformat=QUERYFORMAT use the following query format
-s, --state display the states of the listed files
Verify options (with -V or --verify):
--nofiledigest don't verify digest of files
--nomd5 don't verify digest of files
--nofiles don't verify files in package
--nodeps don't verify package dependencies
--noscript don't execute verify script(s)
File tree walk options (with --ftswalk):
--comfollow follow command line symlinks
--logical logical walk
--nochdir don't change directories
--nostat don't get stat info
--physical physical walk
--seedot return dot and dot-dot
--xdev don't cross devices
--whiteout return whiteout information
Signature options:
--addsign sign package(s) (identical to --resign)
-K, --checksig verify package signature(s)
--delsign delete package signatures
--import import an armored public key
--resign sign package(s) (identical to --addsign)
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
Database options:
--initdb initi