Unix/LINUX rpm 命令示例

RPM - Red Hat 的軟件管理工具 Rpm是Linux中管理系統軟件的。rpm命令能夠用來安裝、管理、卸載軟件包。這裏列一些經常使用的rpm管理命令:html

列出說有安裝的軟件包

#rpm -qa

示例:mysql

[root@localhost]# rpm -qa
xorg-x11-drv-trident-1.3.6-4.el6.x86_64
m17n-contrib-assamese-1.1.10-4.el6_1.1.noarch
wqy-zenhei-fonts-0.9.45-3.el6.noarch
startup-notification-0.10-2.1.el6.x86_64
xml-common-0.6.3-32.el6.noarch
xorg-x11-drv-rendition-4.2.5-2.el6.x86_64
m17n-contrib-hindi-1.1.10-4.el6_1.1.noarch
paktype-tehreer-fonts-2.0-8.el6.noarch
ibus-libs-1.3.4-6.el6.x86_64
mozilla-filesystem-1.9-5.1.el6.x86_64
............
............

查看已安裝軟件總數

[root@localhost]# rpm -qa|wc -l
1094

查看是否安裝某軟件包

[root@localhost]# rpm -qa|grep -i mozilla
mozilla-filesystem-1.9-5.1.el6.x86_64

查看安裝包的相關信息

[root@localhost]# rpm -qi mozilla-filesystem-1.9-5.1.el6.x86_64
Name        : mozilla-filesystem           Relocations: (not relocatable)
Version     : 1.9                               Vendor: CentOS
Release     : 5.1.el6                       Build Date: Wed 18 Aug 2010 09:14:21 PM IST
Install Date: Thu 28 Mar 2013 01:37:47 PM IST      Build Host: c6b3.bsys.dev.centos.org
Group       : Applications/Internet         Source RPM: mozilla-filesystem-1.9-5.1.el6.src.rpm
Size        : 0                                License: MPLv1.1
Signature   : RSA/8, Sun 03 Jul 2011 10:15:46 AM IST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Summary     : Mozilla filesytem layout
Description :
This package provides some directories required by packages which use
Mozilla technologies such as NPAPI plugins or toolkit extensions.

查看軟件包的依賴

[root@localhost]\# which ls
alias ls='ls --color=auto'
    /bin/ls
----
[root@localhost]\# rpm -qf /bin/ls
coreutils-8.4-19.el6.x86_64

列出包全部的命令

[root@localhost TAR]# rpm -ql coreutils-8.4-19.el6.x86_64
/bin/arch
/bin/basename
/bin/cat
/bin/chgrp
/bin/chmod
/bin/chown
/bin/cp
/bin/cut
/bin/date
/bin/dd
/bin/df
/bin/echo

安裝一個軟件包

# rpm -ivh  MySQL-client-3.23.57-1.i386.rpm
Preparing...             ########################################### [100%]
1:MySQL-client           ########################################### [100%]

升級軟件

# rpm -Uvh MySQL-client-3.23.57-1.i386.rpm
Preparing...            ########################################### [100%]
1:MySQL-client          ########################################### [100%]

卸載軟件

# rpm -Vf /usr/bin/mysqlaccess
S.5....T c /usr/bin/mysql

列出軟件包的依賴關係

# rpm -qRp MySQL-client-3.23.57-1.i386.rpm
/bin/sh
/usr/bin/perl
相關文章
相關標籤/搜索