标签:rpm 命令
1 rpm软件包管理方式
也许现实中yum简单方便,但是有时候我们也还会用rpm包,yum用的也是rpm包,从安装,查询,卸载,升级多方面记住,当然还是多多实践才能记住。
NAME
rpm - RPM Package Manager
2 常用的命令,man文档好长
①安装
rpm -ivh PACKAGENAME
-i 安装install的意思
-h, --hash Print 50 hash marks as the package archive is unpacked. Use with -v|--verbose for a nicer display.显示50个#来标示当前安装进度
-v Print verbose information - normally routine progress messages will be displayed. 显示冗余信息
--nodeps Don’t do a dependency check before installing or upgrading a package.
不会在安装或升级前进行依赖检测
--replacepkgs Install the packages even if some of them are already installed on this system. 覆盖安装
--force Same as using --replacepkgs, --replacefiles, and --oldpackage.
--test Do not install the package, simply check for and report potential conflicts.
测试是否能安装,实际不安装
②查询
-q PACKAGENAME
[root@www ~]# rpm -q pidgin
pidgin-2.7.9-27.el6.x86_64
-qa 查询所有的已经安装的包,通常配合grep使用
[root@www ~]# rpm -qa|grep openssh
openssh-askpass-5.3p1-84.1.el6.x86_64
openssh-clients-5.3p1-84.1.el6.x86_64
openssh-5.3p1-84.1.el6.x86_64
openssh-server-5.3p1-84.1.el6.x86_64
-qi 显示安装包相关的信息
[root@www ~]# rpm -qi pidgin
Name : pidgin Relocations: (not relocatable)
Version 主版本 : 2.7.9 Vendor(供应商): CentOS
Release : 27.el6 Build Date: Thu 06 Feb 2014 02:17:15 AM CST
Install Date: Thu 23 Apr 2015 07:51:37 PM CST Build Host: c6b10.bsys.dev.centos.org
Group : Applications/Internet Source RPM: pidgin-2.7.9-27.el6.src.rpm
Size : 3142033 License: GPLv2+ and GPLv2 and MIT
Signature : RSA/SHA1, Thu 06 Feb 2014 03:43:36 AM CST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <http://bugs.centos.org>
URL : http://pidgin.im/
Summary : A Gtk+ based multiprotocol instant messaging client
Description :
...省略...
-ql 安装软件后的文件生成列表
[root@www ~]# rpm -ql openssh
/etc/ssh
/etc/ssh/moduli
/usr/bin/ssh-keygen
/usr/libexec/openssh
/usr/libexec/openssh/ssh-keysign
/usr/share/doc/openssh-5.3p1
/usr/share/doc/openssh-5.3p1/CREDITS
/usr/share/doc/openssh-5.3p1/ChangeLog
/usr/share/doc/openssh-5.3p1/INSTALL
/usr/share/doc/openssh-5.3p1/LICENCE证书
/usr/share/doc/openssh-5.3p1/OVERVIEW
/usr/share/doc/openssh-5.3p1/PROTOCOL
/usr/share/doc/openssh-5.3p1/PROTOCOL.agent
/usr/share/doc/openssh-5.3p1/README安装文档说明
/usr/share/doc/openssh-5.3p1/README.dns
/usr/share/doc/openssh-5.3p1/README.nss
/usr/share/doc/openssh-5.3p1/README.platform
/usr/share/doc/openssh-5.3p1/README.privsep
/usr/share/doc/openssh-5.3p1/README.smartcard
/usr/share/doc/openssh-5.3p1/README.tun
/usr/share/doc/openssh-5.3p1/TODO
/usr/share/doc/openssh-5.3p1/WARNING.RNG
/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man8/ssh-keysign.8.gz
-qf查询某个文件对应的安装包,通常可以看执行文件的安装包
[root@www ~]# rpm -qf /usr/sbin/sshd
openssh-server-5.3p1-84.1.el6.x86_64
注意几个常用的
rpm -qf `which 程序名` 返回软件包的全名rpm -qlf `which 程序名` 返回软件包的文件列表
根据file查询i l 或者软件包名
③升级、降级
rpm -Uvh /PATH/TO/NEW_PACKAGE有老版本则升级,否则就安装
适合安装包
rpm -Fvh /PATH/TO/NEW_PACKAGE有老版本则升级,没有就退出 智能升级
适合升级包
降级:
rpm -ivh --oldpackage PACKAGENAME
④卸载
rpm -e PACKAGE_NAME 注意依赖性
--nodeps
标签:rpm 命令
原文地址:http://qixue.blog.51cto.com/7213178/1654996