以后大家升级rpm包的时候,不要用Uvh了!
我推荐用Fvh
前者会把没有安装过得包也给装上,后者只会更新已经安装的包
总结:未安装的加上小写p,已安装的不需要加p 查询q
rpm {-q|--query} [select-options] [query-options]
RPM的查询功能是极为强大,是极为重要的功能之一;举几个常用的例子,更为详细的具体的,请参考#man rpm
1、对系统中已安装软件的查询;
1)查询系统已安装的软件;
语法:rpm -q 软件名
举例:
[root@localhost ~]# rpm -q php <=== rpm -qa |grep php
php-5.3.3-26.el6.x86_64
[root@localhost ~]# rpm -q ga
package ga is not installed
package ga is not installed
-q就是 --query ,中文意思是“问”,此命令表示的是,是不是系统安装了gaim ;如果已安装会有信息输出;如果没有安装,会输出gaim 没有安装的信息;
查看系统中所有已经安装的包,要加 -a 参数
3)查询已安装软件包都安装到何处;
语法:rpm -ql 软件名 或 rpm rpmquery -ql 软件名
举例:
[root@localhost ~]# rpm -ql php <==> rpmquery -ql lynx
/etc/httpd/conf.d/php.conf
/usr/lib64/httpd/modules/libphp5.so
/var/lib/php/session
/var/www/icons/php.gif
语法:rpm -ql 软件名 或 rpm rpmquery -ql 软件名
举例:
[root@localhost ~]# rpm -ql php <==> rpmquery -ql lynx
/etc/httpd/conf.d/php.conf
/usr/lib64/httpd/modules/libphp5.so
/var/lib/php/session
/var/www/icons/php.gif
4)查询一个已安装软件包的信息
语法格式: rpm -qi 软件名
举例:
[root@localhost RPMS]# rpm -qi php
语法格式: rpm -qi 软件名
举例:
[root@localhost RPMS]# rpm -qi php
[root@localhost ~]# rpmquery -qi php
Name : php Relocations: (not relocatable)
Version : 5.3.3 Vendor: CentOS
Release : 26.el6 Build Date: Fri 22 Nov 2013 03:07:55 AM PST
Install Date: Wed 21 Jan 2015 01:41:10 AM PST Build Host: c6b9.bsys.dev.centos.org
Group : Development/Languages Source RPM: php-5.3.3-26.el6.src.rpm
Size : 3700269 License: PHP
Signature : RSA/SHA1, Sun 24 Nov 2013 11:33:09 AM PST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <http://bugs.centos.org>
URL : http://www.php.net/
Summary : PHP scripting language for creating dynamic web sites
Description :
PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated webpages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts.
Name : php Relocations: (not relocatable)
Version : 5.3.3 Vendor: CentOS
Release : 26.el6 Build Date: Fri 22 Nov 2013 03:07:55 AM PST
Install Date: Wed 21 Jan 2015 01:41:10 AM PST Build Host: c6b9.bsys.dev.centos.org
Group : Development/Languages Source RPM: php-5.3.3-26.el6.src.rpm
Size : 3700269 License: PHP
Signature : RSA/SHA1, Sun 24 Nov 2013 11:33:09 AM PST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <http://bugs.centos.org>
URL : http://www.php.net/
Summary : PHP scripting language for creating dynamic web sites
Description :
PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated webpages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts.
5)查看一下已安装软件的配置文件;
语法格式:rpm -qc 软件名
举例:
[root@localhost RPMS]# rpm -qc lynx
语法格式:rpm -qc 软件名
举例:
[root@localhost RPMS]# rpm -qc lynx
6)查看一个已经安装软件的文档安装位置:
语法格式: rpm -qd 软件名
举例:
[root@localhost RPMS]# rpm -qd lynx
语法格式: rpm -qd 软件名
举例:
[root@localhost RPMS]# rpm -qd lynx
7)查看一下已安装软件所依赖的软件包及文件;
语法格式: rpm -qR 软件名
举例:
语法格式: rpm -qR 软件名
举例:
[root@localhost ~]# rpmquery -qR php
config(php) = 5.3.3-26.el6
httpd
httpd-mmn = 20051115
libbz2.so.1()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.11)(64bit)
config(php) = 5.3.3-26.el6
httpd
httpd-mmn = 20051115
libbz2.so.1()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.11)(64bit)
........................................
========================================================
2、对于未安装的软件包的查看:
查看的前提是您有一个.rpm 的文件,也就是说对既有软件file.rpm的查看等;
1)查看一个软件包的用途、版本等信息;
语法: rpm -qpi file.rpm
举例:
[root@localhost RPMS]# rpm -qpi lynx-2.8.5-23.i386.rpm
语法: rpm -qpi file.rpm
举例:
[root@localhost RPMS]# rpm -qpi lynx-2.8.5-23.i386.rpm
2)查看一件软件包所包含的文件;
语法: rpm -qpl file.rpm
举例:
[root@localhost RPMS]# rpm -qpl lynx-2.8.5-23.i386.rpm
语法: rpm -qpl file.rpm
举例:
[root@localhost RPMS]# rpm -qpl lynx-2.8.5-23.i386.rpm
3)查看软件包的文档所在的位置;
语法: rpm -qpd file.rpm
举例:
[root@localhost RPMS]# rpm -qpd lynx-2.8.5-23.i386.rpm
语法: rpm -qpd file.rpm
举例:
[root@localhost RPMS]# rpm -qpd lynx-2.8.5-23.i386.rpm
4)查看一个软件包的依赖关系
语法: rpm -qpR file.rpm
举例:
[root@localhost archives]# rpm -qpR yumex_0.42-3.0.fc4_noarch.rpm
/bin/bash
/usr/bin/python
config(yumex) = 0.42-3.0.fc4
pygtk2
pygtk2-libglade
语法: rpm -qpR file.rpm
举例:
[root@localhost archives]# rpm -qpR yumex_0.42-3.0.fc4_noarch.rpm
/bin/bash
/usr/bin/python
config(yumex) = 0.42-3.0.fc4
pygtk2
pygtk2-libglade
5)查看一个软件包的配置文件;
语法: rpm -qpc file.rpm
举例:
[root@localhost RPMS]# rpm -qpc lynx-2.8.5-23.i386.rpm
语法: rpm -qpc file.rpm
举例:
[root@localhost RPMS]# rpm -qpc lynx-2.8.5-23.i386.rpm