RPM全称是“RedHatPackageManager”是由RedHat公司发发展起来的,本质是将软件源码包经过编译并且打包成rpm的格式,rpm文件包含的有二进制文件,配置文件,库文件等,同时RPM以一种数据库记录的方式将所需要的软件安装到linux系统上,优点是安装方便,缺点是只能安装在编译时默认的硬件与操作系统版本。
1.rpm包的版本说明
httpd-2.2.3-74.el5.centos.i386.rpm
#以此软件为例说明
httpd :软件名
2.2.3 :分别表示:主版本号-次版本号-修正版本号
74 :编译的次数
i386 :硬件平台
.rpm :扩展名
httpd-2.2.3-74.el5.centos.i386.rpm
格式:
软件名-版本号-编译次数-支持平台-.rpm
常见的硬件平台:
i386 i586 i686:32位 x86_64:64位 noarck:没有硬件等级的限制
2.rpm包的安装
#1.rpm包的安装需要是root用户才能进行
#2.rpm包安装后,该软件的相关信息会写入/var/lib/rpm下的数据库档案中,在版本升级,安装查询,数字签名等信息都会在这里查询
安装时常用的选项:
rpm -ivh package-name
-i :安装
-v :显示详细的安装信息
-h :显示安装进度
-vv :显示更详细的安装过程
--nodeps:忽略安装时软件的依赖性,也就是强制进行安装,往往造成软件安装后不可用
--replacepkgs :重新安装某个已经安装过的软件包,使用rpm -ivh *.rpm 时不会因个别软件包已安装过而中断
--test:测试某个软件包是否能安装在linux环境中
--justdb :更新软件在数据库内的信息
--prefix 目录 :指定安装路径,一般不用该参数,rpm默认安装
--force 强制安装
-K :验证软件包的签名
[root@zhu2 ~]# rpm -ivh a.rpm b.rpm c.rpm *.rpm
#同时安装多个软件包,当分不清软件包安装的先后顺序使用
3.rpm包的升级
-Uvh:后面接的软件即使没有安装过,则系统将予以直接安装,后面接的软件有安装过旧版,则系统自动更新至新版. rpm -Uivh *.rpm     
-Fvh:如果后面接的软件没有安装过,则系统不会安装该软件;
后面接的软件有安装过旧版,则系统自动更新至新版
4.rpm包的查看
rpm的查询功能非常强大,查询的依据就是/var/lib/rpm目录下的数据库文件,不仅可以查询已安装的软件的信息,未安装的软件的信息也可查询。
rpm -q name :仅查询后面接的软件名称是否安装
rpm -qa :列出所有的已经安装在本机系统上面的所有软件名称
rpm -qa | grep name :查询某软件是否安装
rpm -qc name :列出该软件的配置文件(config)
rpm -qd :列出该软件的所有说明文件,即是与man有关的档案
rpm -qi name :列出软件的详细信息(information)
rpm -ql name :列出软件所有的档案与目录所在的完整文件名(list)
rpm -qf 文件名 :由后面接的文件名来找出该档案属于哪个已安装的软件(find)
rpm -qR name :列出与该软件有依赖行的软件所包含的档案
rpm -qpl :查找某个rpm软件包中所包含的文件

5.rpm包删除与数据库重建
5.1rpm包的删除
[root@zhu1 ~]# rpm -e vsftpd
warning: /etc/vsftpd/vsftpd.conf saved as /etc/vsftpd/vsftpd.conf.rpmsave
[root@zhu1 ~]# rpm -q vsftpd
package vsftpd is not installed
# -e :删除软件
--nodeps :强制删除
5.2rpm包的数据库重建
[root@zhu1 ~]# rpm --rebuilddb
--initdb #初始化rpm包的数据库
--rebuilddb # 重建数据库

原文出处:http://caisangzi.blog.51cto.com/6387416/1303924

======================

RPM常用查询命令

rpm -qa   列出所有已安装的rpm软件

rpm -qf filename  查询指定文件属于哪个rpm包

[root@rusky Packages]# rpm -qf /etc/vsftpd/
vsftpd-3.0.2-10.el7.x86_64

rpm -qi packagename  查询已软件包的信息

[root@rusky Packages]# rpm -qi vsftpd
Name : vsftpd
Version : 3.0.2
Release : 10.el7
Architecture: x86_64
Install Date: Sun 16 Oct 2016 10:25:32 PM CST
Group : System Environment/Daemons
Size : 355788
License : GPLv2 with exceptions
Signature : RSA/SHA256, Fri 28 Aug 2015 06:15:12 PM CST, Key ID 199e2f91fd431d51
Source RPM : vsftpd-3.0.2-10.el7.src.rpm
Build Date : Mon 03 Aug 2015 08:06:28 PM CST
Build Host : x86-021.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor : Red Hat, Inc.
URL : https://security.appspot.com/vsftpd.html
Summary : Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.

rpm -ql packagename  查询指定软件包包含的文件

[root@rusky /]# rpm -ql zip
/usr/bin/zip
/usr/bin/zipcloak
/usr/bin/zipnote
/usr/bin/zipsplit
/usr/share/doc/zip-3.0
/usr/share/doc/zip-3.0/CHANGES
/usr/share/doc/zip-3.0/LICENSE
/usr/share/doc/zip-3.0/README
/usr/share/doc/zip-3.0/README.CR
/usr/share/doc/zip-3.0/TODO
/usr/share/doc/zip-3.0/WHATSNEW
/usr/share/doc/zip-3.0/WHERE
/usr/share/doc/zip-3.0/algorith.txt
/usr/share/man/man1/zip.1.gz
/usr/share/man/man1/zipcloak.1.gz
/usr/share/man/man1/zipnote.1.gz
/usr/share/man/man1/zipsplit.1.gz

rpm -qip software.rpm 查询rpm文件的信息

[root@rusky Packages]# rpm -qip vsftpd-3.0.2-10.el7.x86_64.rpm
Name : vsftpd
Version : 3.0.2
Release : 10.el7
Architecture: x86_64
Install Date: (not installed)
Group : System Environment/Daemons
Size : 355788
License : GPLv2 with exceptions
Signature : RSA/SHA256, Fri 28 Aug 2015 06:15:12 PM CST, Key ID 199e2f91fd431d51
Source RPM : vsftpd-3.0.2-10.el7.src.rpm
Build Date : Mon 03 Aug 2015 08:06:28 PM CST
Build Host : x86-021.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor : Red Hat, Inc.
URL : https://security.appspot.com/vsftpd.html
Summary : Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.

rpm -qilp software.rpm  查询rpm文件包含的文件

[root@rusky Packages]# rpm -qilp vsftpd-3.0.-.el7.x86_64.rpm
Name : vsftpd
Version : 3.0.
Release : .el7
Architecture: x86_64
Install Date: (not installed)
Group : System Environment/Daemons
Size :
License : GPLv2 with exceptions
Signature : RSA/SHA256, Fri Aug :: PM CST, Key ID 199e2f91fd431d51
Source RPM : vsftpd-3.0.-.el7.src.rpm
Build Date : Mon Aug :: PM CST
Build Host : x86-.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor : Red Hat, Inc.
URL : https://security.appspot.com/vsftpd.html
Summary : Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
/usr/lib/systemd/system-generators/vsftpd-generator
/usr/lib/systemd/system/vsftpd.service
/usr/lib/systemd/system/vsftpd.target
/usr/lib/systemd/system/vsftpd@.service
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-3.0.
/usr/share/doc/vsftpd-3.0./AUDIT
/usr/share/doc/vsftpd-3.0./BENCHMARKS
/usr/share/doc/vsftpd-3.0./BUGS
/usr/share/doc/vsftpd-3.0./COPYING
/usr/share/doc/vsftpd-3.0./Changelog
/usr/share/doc/vsftpd-3.0./EXAMPLE
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE/README.configuration
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE_NOINETD/README.configuration
/usr/share/doc/vsftpd-3.0./EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-3.0./EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-3.0./EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-3.0./EXAMPLE/PER_IP_CONFIG/README.configuration
/usr/share/doc/vsftpd-3.0./EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-3.0./EXAMPLE/README
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_USERS/README.configuration
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-3.0./EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-3.0./FAQ
/usr/share/doc/vsftpd-3.0./INSTALL
/usr/share/doc/vsftpd-3.0./LICENSE
/usr/share/doc/vsftpd-3.0./README
/usr/share/doc/vsftpd-3.0./README.security
/usr/share/doc/vsftpd-3.0./REWARD
/usr/share/doc/vsftpd-3.0./SECURITY
/usr/share/doc/vsftpd-3.0./SECURITY/DESIGN
/usr/share/doc/vsftpd-3.0./SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-3.0./SECURITY/OVERVIEW
/usr/share/doc/vsftpd-3.0./SECURITY/TRUST
/usr/share/doc/vsftpd-3.0./SIZE
/usr/share/doc/vsftpd-3.0./SPEED
/usr/share/doc/vsftpd-3.0./TODO
/usr/share/doc/vsftpd-3.0./TUNING
/usr/share/doc/vsftpd-3.0./vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf..gz
/usr/share/man/man8/vsftpd..gz
/var/ftp
/var/ftp/pub
[root@rusky Packages]#

 将RPM包安装到指定目录下:

#rpm -ivh --prefix=/home/lxj/java  jdk-8u60-linux-x64.rpm

将 jdk-8u60-linux-x64.rpm 安装到 /home/lxj/java 目录下。

rpm包安装的更多相关文章

  1. CentOS使用yum源中自带的rpm包安装LAMP环境

    CentOS使用yum源中自带的rpm包安装LAMP环境.这是Linux下安装LAMP的环境一种最基本最简便的方式.新手可以从容安装使用. 1. 安装基础包(可选安装)yum install -y w ...

  2. rpm包安装过程中依赖问题“libc.so.6 is needed by XXX”解决方法

    rpm包安装过程中依赖问题"libc.so.6 is needed by XXX"解决方法 折腾了几天,终于搞定了CentOS上的Canon LBP2900打印机驱动.中间遇到了一 ...

  3. linux下rpm包安装、配置和卸载mysql

    WIN10下虚拟机:VMware workstation 12 PRO 安装 # 1.查看系统版本 [root@vm-xiluhua][/home/xiluhua]$ cat /etc/redhat- ...

  4. yum --rpm包安装

    rpm -ivh  package -i 表示安装install -v表示显示详细信息, -vv更详细些 -h表示显示安装进度 --force:表示强制安装 --nodeps:忽略依赖关系安装 --r ...

  5. 注意:rsyslog 源码安装 会出现日志重复发的情况,需要rpm包安装

    cd /etc/yum.repos.d;wget http://rpms.adiscon.com/v8-stable/rsyslog.repo uat-web02:/etc/yum.repos.d# ...

  6. zabbix安装及配置(rpm包安装mysql,php,apache,zabbix)

    zabbix安装及配置 一.安装mysql.php.apache.zabbix 安装环境: 操作系统:rhel6.3-x86-64  mysql:5.6.23   --官网下载rpm包安装php:5. ...

  7. ubuntu rpm 包安装使用

    ubuntu安装rpm的方法RED HAT系列用rpm包安装软件,Debian系列得用deb包.毕竟red hat历史悠久,有很多rpm软件包还未对应deb格式.(对应的地方现在是越来越多)在网上找了 ...

  8. 使用RPM包安装、配置和拆卸MySQL

    通过rpm包安装.配置及卸载mysql的详细过程. 以MySQL-server-4.0.14-0.i386.rpm为例,放在/usr/src目录下 cd /usr/src rpm -ivh MySQL ...

  9. CentOS7使用rpm包安装MySQL

    说明 本文写于2017-05-20,使用MySQL-5.7.18.操作系统为64位CentOS Linux release 7.2.1511 (Core),以桌面形式安装. 卸载MariaDB Cen ...

随机推荐

  1. C# LINQ 基本操作实例

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. 配置CAS错误No Certificate file specified or invalid file format

    配置tomcat证书 keystore文件后启动一直报错:(tomcat版本:apache-tomcat-6.0.43) tomcat配置: <Connector port="8443 ...

  3. hdu4430 枚举+二分

    Yukari's Birthday Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  4. 你好,C++(17)0.1*10不等于1.0——4.1.4 关系操作符4.1.5 逻辑操作符

    4.1.4  关系操作符 在C++中,除了需要用算术操作符对数据进行加减乘除的算术操作之外,我们有时候还需要对数据之间的关系进行操作,也就是对两个数据进行大小比较,得出它们之间的大小关系.在现实世界中 ...

  5. IntelliJ IDEA 12 创建Web项目 教程 超详细版

    IntelliJ IDEA 12 新版本发布 第一时间去官网看了下  黑色的主题 很给力 大体使用了下  对于一开始就是用eclipse的童鞋们 估计很难从eclipse中走出来 当然 我也很艰难的走 ...

  6. 3D 灯光介绍

    光特性 参考OpenGL的光照模型,把光分成4种独立的成分: 环境光 散射光 镜面光 发散光 环境光:ambient light 环境光是那些在环境中进行了充分的散射,无法分辨其方向的光.它会均匀的照 ...

  7. 转 常用JQuery插件整理

    虽然自己也写过插件,但JQuery插件种类的繁多,大多时候,我还是使用别人写好的插件,这些都是我用了同类插件里较为不错的一些,今天就整理一下公开放出来. UI: jquery.HooRay(哈哈,自己 ...

  8. IE兼容HTML5

    <!--[if lt IE9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js" ...

  9. How To install FFMPEG, FLVTOOL2, MP4Box on CentOS server 2015 easy method

    for i386:wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpmrpm ...

  10. Python3 如何优雅地使用正则表达式(详解二)

    使用正则表达式 现在我们开始来写一些简单的正则表达式吧.Python 通过 re 模块为正则表达式引擎提供一个接口,同时允许你将正则表达式编译成模式对象,并用它们来进行匹配. 小甲鱼解释:re 模块是 ...