建立集中数据库,记录软件包的变化信息,分析软件包依赖关系。
rpm包文件名特征:软件名-版本信息.操作系统.硬件架构.rpm
rpm安装位置:
普通执行程序 | /usr/bin、/bin |
服务器程序、管理工具 | /usr/bin、/sbin |
配置文件 | /etc、/etc/软件名 |
日志文件 | /var/log、/var/log/软件名 |
程序文档、Man手册 | /usr/share/doc、/usr/share/man |
(1)查询软件信息:
rpm -q子选项 软件名
-a:列出已经安装的软件。
-i:查看指定软件的信息。
-l:查看软件的安装文件清单。
-c:列出清单的位置。
-f:rpm -qf 命令的绝对路径:查询某个文件或目录是哪个软件带来的,即使删除也可以查询到。
-pi:查看指定本地软件的详细信息
[root@node0 ~]# rpm -qpi ./elasticsearch-2.3.4.rpm
warning: ./elasticsearch-2.3.4.rpm: Header V4 RSA/SHA1 Signature, key ID d88e42b4: NOKEY
Name : elasticsearch
Relocations: /usr
Version : 2.3.4 Vendor: (none)
Release : 1
Build Date: Thu 30 Jun 2016 07:32:30 PM CST
Install Date: (not installed)
Build Host: vagrant-ubuntu-trusty-64
Group : Application/Internet
Source RPM: elasticsearch-2.3.4-1.src.rpm
Size : 30797293
License: (c) 2009
Signature : RSA/SHA1, Thu 30 Jun 2016 07:32:32 PM CST, Key ID d27d666cd88e42b4
Packager : Elasticsearch
Summary : Distribution: RPM
Description :
Elasticsearch is a distributed RESTful search engine built for the cloud. Reference documentation can be found at https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html and the 'Elasticsearch: The Definitive Guide' book can be found at https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
-pl:查看本地软件的安装清单
[root@node0 ~]# rpm -qpl ./elasticsearch-2.3.4.rpm
warning: ./elasticsearch-2.3.4.rpm: Header V4 RSA/SHA1 Signature, key ID d88e42b4: NOKEY
/etc/elasticsearch
/etc/elasticsearch/elasticsearch.yml
/etc/elasticsearch/logging.yml
/etc/elasticsearch/scripts
/etc/init.d/elasticsearch
/etc/sysconfig/elasticsearch
/usr/lib/sysctl.d
/usr/lib/sysctl.d/elasticsearch.conf
/usr/lib/systemd/system/elasticsearch.service
/usr/lib/tmpfiles.d
/usr/lib/tmpfiles.d/elasticsearch.conf
.......
-pc:仅列出本地软件的配置文件清单
[root@node0 ~]# rpm -qpc ./elasticsearch-2.3.4.rpm
warning: ./elasticsearch-2.3.4.rpm: Header V4 RSA/SHA1 Signature, key ID d88e42b4: NOKEY
/etc/elasticsearch/elasticsearch.yml
/etc/elasticsearch/logging.yml
/etc/init.d/elasticsearch
/etc/sysconfig/elasticsearch
/usr/lib/sysctl.d/elasticsearch.conf
/usr/lib/systemd/system/elasticsearch.service
/usr/lib/tmpfiles.d/elasticsearch.conf
(2)安装软件:
rpm -i rpm文件
[root@node0 ~]# rpm -ivh ./elasticsearch-2.3.4.rpm
warning: ./elasticsearch-2.3.4.rpm: Header V4 RSA/SHA1 Signature, key ID d88e42b4: NOKEY
Preparing... ########################################### [100%]
Creating elasticsearch group... OK
Creating elasticsearch user... OK
1:elasticsearch ########################################### [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using chkconfig
sudo chkconfig --add elasticsearch
### You can start elasticsearch service by executing
sudo service elasticsearch start
(3)升级软件:
rpm -U rpm包文件
rpm -F rpm包文件
-v:显示安装细节
-h:使用#显示进度
--forece:强制安装
--test:测试安装
(4)卸载软件:
rpm -e 软件名称(支持通配符)
--nodeps:忽略依赖关系
[root@node0 ~]# rpm -qa | grep ela
elasticsearch-2.3.4-1.noarch
[root@node0 ~]# rpm -e elasticsearch-2.3.4-1.noarch
Stopping elasticsearch service... OK
[root@node0 ~]# rpm -qa | grep ela
(5)rpm软件包验证:
验证待安装的软件是否破损:
rpm -K --nosignature rpm包文件
[root@node0 ~]# rpm -K --nosignature elasticsearch-2.3.4.rpm
elasticsearch-2.3.4.rpm: sha1 md5 OK
验证rpm包文件是否是官方版本:
[root@node0 ~]# rpm --import /dvd/RPM-GPG-KEY-CentOS-6 # 导入公钥文件
[root@node0 ~]# rpm -K /dvd/Packages/yajl-1.0.7-3.el6.x86_64.rpm # 验证
/dvd/Packages/yajl-1.0.7-3.el6.x86_64.rpm: rsa sha1 (md5) pgp md5 OK
原文地址:http://blog.51cto.com/xvjunjie/2044312