RPM全称 RedHat Package Manager 的缩写,是有红帽开发
用于软件包的安装,升级卸载使用的。用rpm安装软件之前必须要找到指
定的安装包,一种是挂载光盘,另一种是去源码网站下载rpm包,用绝对
路径进行安装。
格式:xxx.rpm
命令:rpm
i 安装软件包
v 显示安装过程
h 显示安装进度条
[root@oldchen ~]# mount /dev/cdrom /mnt/ ---->先挂载光盘
mount: /dev/sr0 写保护,将以只读方式挂载
[root@oldchen ~]# rpm -ivh /mnt/Packages/zip-3.011.el7.x86_64.rpm
准备中... ################################# [100%]
软件包 zip-3.0-11.el7.x86_64 已经安装
[root@oldchen ~]# wget https://mirrors.aliyun.com/zabbix/zabbix/5.4/rhel/7/x86_64/zabbix-agent- 5.4.0-8.el7.x86_64.rpm
--2021-07-26 17:44:00--https://mirrors.aliyun.com/zabbix/zabbix/5.4/rhel/7/x86_64/zabbix-agent-5.4.0-8.el7.x86_64.rpm
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 119.188.121.241, 119.188.121.239, 221.196.251.240, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|119.188.121.241|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:484920 (474K) [application/x-redhat-package-manager]
正在保存至: “zabbix-agent-5.4.0-8.el7.x86_64.rpm”
100%[==========================================>] 484,920 --.-K/s 用时 0.1s
2021-07-26 17:44:01 (4.24 MB/s) - 已保存 “zabbix-agent-5.4.0-8.el7.x86_64.rpm” [484920/484920])
最后用rpm命令进行安装
[root@oldchen ~]# rpm -ivh zabbix-agent-5.4.0-8.el7.x86_64.rpm
[root@oldchen ~]# rpm -ivh
/mnt/Packages/samba-4.8.3-4.el7.x86_64.rpm
error: Failed dependencies:
libxattr-tdb-samba4.so()(64bit) isneeded by samba-0:4.8.3-4.el7.x86_64
libxattr-tdb-samba4.so(SAMBA_4.8.3)(64bit) is needed by samba-0:4.8.3-4.el7.x86_64
samba-common-tools = 4.8.3-4.el7 isneeded by samba-0:4.8.3-4.el7.x86_64
samba-libs = 4.8.3-4.el7 is neededby samba-0:4.8.3-4.el7.x86_64
[root@oldchen ~]# rpm -ivh/mnt/Packages/samba-common-
tools4.8.3-4.el7.x86_64.rpm
[root@oldchen ~]# rpm -ivh/mnt/Packages/samba-libs-4.8.3-
4.el7.x86_64.rpm
[root@oldxu ~]# rpm -ivh/mnt/Packages/samba-4.8.3-4.el7.x
86_64.rpm
[root@oldchen ~]#wget https://mirrors.aliyun.com/zabbix/zabbix
/3.0/rhel/7/x86_64/zabbix-agent-3.0.9-1.el7.x86_64.rpm
[root@oldchen ~]# wget https://mirrors.aliyun.com/zabbix/zabbix
/4.2/rhel/7/x86_64/zabbix-agent-4.2.0-1.el7.x86_64.rpm
[root@oldchen ~]# rpm -ivh zabbix-agent3.0.9-1.el7.x86_64.rpm
[root@oldchen ~]# rpm -ivh zabbix-agent4.2.0-1.el7.x86_64.rpm
[root@oldchen ~]# rpm -Uvh zabbix-agent4.2.0-1.el7.x86_64.rpm
1.使用 rpm -q 查询软件包是否存在系统
[root@oldchen ~]# rpm -q zsh
2.使用 rpm -e 卸载软件包
[root@oldchen ~]# rpm -e zsh
-q 查看指定软件包是否安装
-qa 查看系统中已安装的所有RPM软件包列表
-qi 查看指定软件的详细信息
-ql 查询指定软件包所安装的目录、文件列表
-qc 查询指定软件包的配置文件
-qf 查询文件或目录属于哪个RPM软件
[root@oldchen ~]# rpm -q vim
未安装软件包 vim
[root@oldchen ~]# rpm -qa
dracut-network-033-463.el7.x86_64
filesystem-3.2-21.el7.x86_64
ebtables-2.0.10-15.el7.x86_64
bind-license-9.9.4-37.el7.noarch
libsoup-2.48.1-6.el7.x86_64
NetworkManager-1.4.0-12.el7.x86_64
........................
[root@oldchen ~]# rpm -qi bash
Name : bash
Version : 4.2.46
Release : 20.el7_2
Architecture: x86_64
Install Date: 2021年07月23日 星期五 18时46分41秒
Group : System Environment/Shells
Size : 3663634
License : GPLv3+
Signature : RSA/SHA256, 2016年08月03日 星期三 04时36分07秒,
Key ID 24c6a8a7f4a80eb5
Source RPM : bash-4.2.46-20.el7_2.src.rpm
Build Date : 2016年08月03日 星期三 00时02分28秒
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.gnu.org/software/bash
Summary : The GNU Bourne Again shell
[root@oldchen ~]# rpm -ql bash
/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
/usr/bin/alias
/usr/bin/bash
/usr/bin/bashbug
/usr/bin/bashbug-64
...........
[root@oldchen ~]# rpm -qc bash
/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
[root@oldchen ~]# rpm -qf /usr/bin/ls
coreutils-8.22-18.el7.x86_64
[root@oldchen ~]# rpm -qlp/mnt/Packages/samba-3.6.23-
41.el6.x86_64.rpm
原文:https://blog.51cto.com/u_15295582/3190831