命令格式:rpm [option] package_name
常用选项说明:-e: 卸载程序
--nodeps:忽略依赖关系,强行卸载,其他依赖于此包的程序可能无法正常运行
[root@CentOS6 Packages]# rpm -e zsh
warning: /etc/zshrc saved as /etc/zshrc.rpmsave #对/etc/zshrc做过修改,提示文件不会被删会被保存为/etc/zshrc.rpmsave
[root@CentOS6 Packages]# rpm -e httpd #卸载httpd,提示有其他程序依赖于该程序,无法卸载,如需卸载先卸载相依赖的程序
error: Failed dependencies:
httpd >= 2.2.0 is needed by (installed) gnome-user-share-2.28.2-3.el6.i686
[root@CentOS6 Packages]# rpm -e httpd --nodeps #忽略依赖关系,强行卸载
[root@CentOS6 Packages]#
[注意]:如果包的配置文件安装后曾被改动过,卸载时,此文件将不会卸载,而是被重命名并保留,例如
warning: /etc/zshrc saved as /etc/zshrc.rpmsave
RPM-升级程序包
命令格式:rrpm [-Uvh | -Fvh] /path/to/package_file
常用选项说明:-Uvh: 升级或安装,后面的程序安装此电脑已安装则进行升级,如没有安装则现在安装;
-Fvh: 升级,只对电脑上已安装的程序进行升级,如没有安装则不进行安装;
--force:强制升级
[注意]:为了保证系统的正常运行,不要对内核进行升级操作,而应该对内核进行安装,系统允许多个内核共存。
RPM-查询操作
命令格式:rpm [option] package_name|file
常用选项说明:
-q: 查询某包是否安装,可以一次查询多个,彼此间用空格隔离;
[root@CentOS6 cd]# rpm -q zsh
zsh-4.3.10-7.el6.i686
-qa: 查询所有已经安装的包,可以通过管道按条件进行过滤(rpm -qa | grep 'PATTERN')
[root@CentOS6 cd]# rpm -qa
libaio-0.3.107-10.el6.i686
perl-URI-1.40-2.el6.noarch
kbd-1.15-11.el6.i686
gnome-speech-0.4.25-3.1.el6.i686
cas-0.15-1.el6.1.noarch
tzdata-2013g-1.el6.noarch
libsss_autofs-1.9.2-129.el6.i686
.........
[root@CentOS6 cd]# rpm -qa | grep "zs.*"
zsh-4.3.10-7.el6.i686
-qi: 查询包的描述信息(只能查询已经安装的包的描述信息);
[root@CentOS6 cd]# rpm -qi zsh
Name : zsh Relocations: (not relocatable)
Version : 4.3.10 Vendor: CentOS
Release : 7.el6 Build Date: Sun 24 Nov 2013 12:37:44 PM EST
Install Date: Tue 21 Apr 2015 11:29:57 AM EDT Build Host: c6b9.bsys.dev.centos.org
Group : System Environment/Shells Source RPM: zsh-4.3.10-7.el6.src.rpm
Size : 4777026 License: BSD
Signature : RSA/SHA1, Sun 24 Nov 2013 02:30:40 PM EST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <>
URL :
Summary : A powerful interactive shell
Description :
The zsh shell is a command interpreter usable as an interactive login
shell and as a shell script command processor. Zsh resembles the ksh
shell (the Korn shell), but includes many enhancements. Zsh supports
command line editing, built-in spelling correction, programmable
command completion, shell functions (with autoloading), a history
mechanism, and more.
[root@CentOS6 cd]#