Unix/LINUX rpm 命令示例

RPM - Red Hat 的软件管理工具 Rpm是Linux中管理系统软件的。rpm命令可以用来安装、管理、卸载软件包。这里列一些常用的rpm管理命令:

列出说有安装的软件包

#rpm -qa

示例:

[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

你可能感兴趣的:(Unix/LINUX rpm 命令示例)