Linux命令之rpm篇
作业五:rpm命令
1) 挂载光盘文件到/media目录
[root@localhost 桌面]# mount /dev/sr0 /media
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost 桌面]# df
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/sda3 18351104 3495804 14855300 20% /
devtmpfs 493268 0 493268 0% /dev
tmpfs 501716 140 501576 1% /dev/shm
tmpfs 501716 7180 494536 2% /run
tmpfs 501716 0 501716 0% /sys/fs/cgroup
/dev/sda1 508588 118196 390392 24% /boot
/dev/sr0 4050860 4050860 0 100% /media
[root@localhost 桌面]#
2) 进去/media目录下的Packages目录
[root@localhost 桌面]# cd /media
[root@localhost media]# ls
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
[root@localhost media]# cd Packages
3) 查看系统已安装的所有rpm包
[root@localhost Packages]# rpm -qa
4) 查看系统是否安装dhcp软件包
[root@localhost Packages]# rpm -qa |grep dhcp
dhcp-common-4.2.5-27.el7.centos.x86_64
dhcp-libs-4.2.5-27.el7.centos.x86_64
[root@localhost Packages]# rpm -q dhcp
未安装软件包 dhcp
5) 安装dhcp软件包
[root@localhost Packages]# rpm -ivh dhcp-4.2.5-27.el7.centos.x86_64.rpm
警告:dhcp-4.2.5-27.el7.centos.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:dhcp-12:4.2.5-27.el7.centos ################################# [100%]
6) 查看dhcp软件包的信息
[root@localhost Packages]# rpm -qi dhcp
Name : dhcp
Epoch : 12
Version : 4.2.5
Release : 27.el7.centos
Architecture: x86_64
Install Date: 2017年03月17日 星期五 17时31分36秒
Group : System Environment/Daemons
Size : 1443881
License : ISC
Signature : RSA/SHA256, 2014年07月04日 星期五 09时08分00秒, Key ID 24c6a8a7f4a80eb5
Source RPM : dhcp-4.2.5-27.el7.centos.src.rpm
Build Date : 2014年06月19日 星期四 05时19分50秒
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://isc.org/products/DHCP/
Summary : Dynamic host configuration protocol software
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 dhcp package provides
the ISC DHCP service and relay agent.
7) 查看dhcp软件包中所包含的所有文件
[root@localhost Packages]# rpm -ql tar dhcp
/usr/bin/gtar
/usr/bin/tar
/usr/share/doc/tar-1.26
/usr/share/doc/tar-1.26/AUTHORS
/usr/share/doc/tar-1.26/COPYING
/usr/share/doc/tar-1.26/ChangeLog
/usr/share/doc/tar-1.26/ChangeLog.1
/usr/share/doc/tar-1.26/NEWS
/usr/share/doc/tar-1.26/README
/usr/share/doc/tar-1.26/THANKS
/usr/share/doc/tar-1.26/TODO
/usr/share/info/tar.info-1.gz
/usr/share/info/tar.info-2.gz
/usr/share/info/tar.info.gz
/usr/share/locale/bg/LC_MESSAGES/tar.mo
/usr/share/locale/ca/LC_MESSAGES/tar.mo
/usr/share/locale/cs/LC_MESSAGES/tar.mo
/usr/share/locale/da/LC_MESSAGES/tar.mo
/usr/share/locale/de/LC_MESSAGES/tar.mo
/usr/share/locale/el/LC_MESSAGES/tar.mo
/usr/share/locale/es/LC_MESSAGES/tar.mo
/usr/share/locale/et/LC_MESSAGES/tar.mo
/usr/share/locale/eu/LC_MESSAGES/tar.mo
/usr/share/locale/fi/LC_MESSAGES/tar.mo
/usr/share/locale/fr/LC_MESSAGES/tar.mo
/usr/share/locale/ga/LC_MESSAGES/tar.mo
/usr/share/locale/gl/LC_MESSAGES/tar.mo
/usr/share/locale/hr/LC_MESSAGES/tar.mo
/usr/share/locale/hu/LC_MESSAGES/tar.mo
/usr/share/locale/id/LC_MESSAGES/tar.mo
/usr/share/locale/it/LC_MESSAGES/tar.mo
/usr/share/locale/ja/LC_MESSAGES/tar.mo
/usr/share/locale/ko/LC_MESSAGES/tar.mo
/usr/share/locale/ky/LC_MESSAGES/tar.mo
/usr/share/locale/ms/LC_MESSAGES/tar.mo
/usr/share/locale/nb/LC_MESSAGES/tar.mo
/usr/share/locale/nl/LC_MESSAGES/tar.mo
/usr/share/locale/pl/LC_MESSAGES/tar.mo
/usr/share/locale/pt/LC_MESSAGES/tar.mo
/usr/share/locale/pt_BR/LC_MESSAGES/tar.mo
/usr/share/locale/ro/LC_MESSAGES/tar.mo
/usr/share/locale/ru/LC_MESSAGES/tar.mo
/usr/share/locale/sk/LC_MESSAGES/tar.mo
/usr/share/locale/sl/LC_MESSAGES/tar.mo
/usr/share/locale/sv/LC_MESSAGES/tar.mo
/usr/share/locale/tr/LC_MESSAGES/tar.mo
/usr/share/locale/uk/LC_MESSAGES/tar.mo
/usr/share/locale/vi/LC_MESSAGES/tar.mo
/usr/share/locale/zh_CN/LC_MESSAGES/tar.mo
/usr/share/locale/zh_TW/LC_MESSAGES/tar.mo
/usr/share/man/man1/gtar.1.gz
/usr/share/man/man1/tar.1.gz
/etc/NetworkManager
/etc/NetworkManager/dispatcher.d
/etc/NetworkManager/dispatcher.d/12-dhcpd
/etc/dhcp
/etc/dhcp/dhcpd.conf
/etc/dhcp/dhcpd6.conf
/etc/openldap/schema/dhcp.schema
/etc/sysconfig/dhcpd
/usr/bin/omshell
/usr/lib/systemd/system/dhcpd.service
/usr/lib/systemd/system/dhcpd6.service
/usr/lib/systemd/system/dhcrelay.service
/usr/sbin/dhcpd
/usr/sbin/dhcrelay
/usr/share/doc/dhcp-4.2.5
/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example
/usr/share/doc/dhcp-4.2.5/dhcpd6.conf.example
/usr/share/doc/dhcp-4.2.5/ldap
/usr/share/doc/dhcp-4.2.5/ldap/README.ldap
/usr/share/doc/dhcp-4.2.5/ldap/dhcp.schema
/usr/share/doc/dhcp-4.2.5/ldap/dhcpd-conf-to-ldap
/usr/share/man/man1/omshell.1.gz
/usr/share/man/man5/dhcpd.conf.5.gz
/usr/share/man/man5/dhcpd.leases.5.gz
/usr/share/man/man8/dhcpd.8.gz
/usr/share/man/man8/dhcrelay.8.gz
/usr/share/systemtap/tapset/dhcpd.stp
/var/lib/dhcpd
/var/lib/dhcpd/dhcpd.leases
/var/lib/dhcpd/dhcpd6.leases
8) 查看/bin/ls文件是由哪个软件包产生
[root@localhost Packages]# rpm -qf /bin/ls
coreutils-8.22-11.el7.x86_64
9) 卸载dhcp软件包
[root@localhost Packages]# rpm -e dhcp
[root@localhost Packages]# rpm -qa dhcp