rpm 包
选项 | 含义 |
---|---|
-i | 表示安装 |
-v | 表示可视化 |
-h | 表示显示安装进度 |
rpm包安装
[root@evan-01 ~]# cd /mnt/Packages/
[root@evan-01 Packages]# ll
...(省略很多内容)
-rw-rw-r--. 2 root root 266160 Nov 21 2016 zip-3.0-11.el7.x86_64.rpm
-rw-rw-r--. 3 root root 91872 Nov 21 2016 zlib-1.2.7-17.el7.x86_64.rpm
-rw-rw-r--. 2 root root 51044 Nov 21 2016 zlib-devel-1.2.7-17.el7.x86_64.rpm
-rw-rw-r--. 2 root root 2494444 Aug 11 2017 zsh-5.0.2-28.el7.x86_64.rpm
-rw-rw-r--. 2 root root 83176 Jul 4 2014 zziplib-0.13.62-5.el7.x86_64.rpm
[root@evan-01 Packages]# rpm -ivh zziplib-0.13.62-5.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:zziplib-0.13.62-5.el7 ################################# [100%]
[root@evan-01 Packages]#
rpm包升级
[root@evan-01 Packages]# rpm -Uvh zziplib-0.13.62-5.el7.x86_64.rpm
Preparing... ################################# [100%]
package zziplib-0.13.62-5.el7.x86_64 is already installed
[root@evan-01 Packages]#
rpm 包卸载
卸载的时候 -e 后面只写包的名字就行了,卸载后,什么都不显示,是正常的
[root@evan-01 Packages]# rpm -e zziplib
[root@evan-01 Packages]#
查询已安装的包
[root@evan-01 Packages]# rpm -qa
...(省略很多内容)
cronie-1.4.11-17.el7.x86_64
grub2-tools-minimal-2.02-0.64.el7.centos.x86_64
libpciaccess-0.13.4-3.el7_3.x86_64
plymouth-scripts-0.8.9-0.28.20140113.el7.centos.x86_64
pciutils-3.5.1-2.el7.x86_64
grub2-pc-2.02-0.64.el7.centos.x86_64
lvm2-libs-2.02.171-8.el7.x86_64
dracut-network-033-502.el7.x86_64
net-tools-2.0-0.22.20131004git.el7.x86_64
alsa-firmware-1.0.28-2.el7.noarch
libdnet-1.12-13.1.el7.x86_64
[root@evan-01 Packages]#
查询某个包是否安装
[root@evan-01 Packages]# rpm -q dhclient
dhclient-4.2.5-58.el7.centos.x86_64
[root@evan-01 Packages]#
随便编一个查询下
[root@evan-01 Packages]# rpm -q hahaha666
package hahaha666 is not installed
[root@evan-01 Packages]#
查看已安装包的相关信息
[root@evan-01 Packages]# rpm -qi dhclient
Name : dhclient
Epoch : 12
Version : 4.2.5
Release : 58.el7.centos
Architecture: x86_64
Install Date: Thu 08 Aug 2019 06:32:15 PM CST
Group : System Environment/Base
Size : 483094
License : ISC
Signature : RSA/SHA256, Thu 10 Aug 2017 11:36:17 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM : dhcp-4.2.5-58.el7.centos.src.rpm
Build Date : Fri 04 Aug 2017 02:07:15 PM CST
Build Host : c1bm.rdu2.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://isc.org/products/DHCP/
Summary : Provides the ISC DHCP client daemon and dhclient-script
Description :
DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
individual devices on an IP network to get their own network
configuration information (IP address, subnetmask, broadcast address,
etc.) from a DHCP server. The overall purpose of DHCP is to make it
easier to administer a large network.
To use DHCP on your network, install a DHCP service (or relay agent),
and on clients run a DHCP client daemon. The dhclient package
provides the ISC DHCP client daemon.
[root@evan-01 Packages]#
列出包的安装文件
[root@evan-01 Packages]# rpm -ql dhclient
/etc/NetworkManager
/etc/NetworkManager/dispatcher.d
/etc/NetworkManager/dispatcher.d/11-dhclient
/etc/dhcp/dhclient-exit-hooks.d
/etc/dhcp/dhclient-exit-hooks.d/azure-cloud.sh
/etc/dhcp/dhclient.d
/usr/lib64/pm-utils/sleep.d/56dhclient
/usr/sbin/dhclient
/usr/sbin/dhclient-script
/usr/share/doc/dhclient-4.2.5
/usr/share/doc/dhclient-4.2.5/README.dhclient.d
/usr/share/doc/dhclient-4.2.5/dhclient.conf.example
/usr/share/doc/dhclient-4.2.5/dhclient6.conf.example
/usr/share/man/man5/dhclient.conf.5.gz
/usr/share/man/man5/dhclient.leases.5.gz
/usr/share/man/man8/dhclient-script.8.gz
/usr/share/man/man8/dhclient.8.gz
/var/lib/dhclient
[root@evan-01 Packages]#
查看一个命令是由哪个包安装的
[root@evan-01 Packages]# rpm -qf /var/lib/dhclient
dhclient-4.2.5-58.el7.centos.x86_64
[root@evan-01 Packages]#
拓展:``号的用法
[root@evan-01 Packages]# which cd
/usr/bin/cd
[root@evan-01 Packages]# rpm -qf `which cd`
bash-4.2.46-28.el7.x86_64
[root@evan-01 Packages]#
等同于
[root@evan-01 Packages]# rpm -qf /usr/bin/cd
bash-4.2.46-28.el7.x86_64
[root@evan-01 Packages]#