table of Contents
01 RPM Package Manager
1.1RPM Overview
RPM is an RedHat Package Manager
acronym, developed by Redhat company.
RPM is will you need to install the software on your Linux box set of management procedures by way of database records. In other words, your linux system, there is a database of RPM, which records the installation package and the dependencies between packages relevance.
1. Package Type
classification | installation | version |
---|---|---|
rpm package | Pre-compiled package, easy to install | Software version lower |
Source Package | Manually compile the package, installation frequently | Software Version random |
Binary packages | Decompression can be used, simple installation | You can not modify the source code |
2. Common Packages
Note: Whether the source package, or binary package, may have dependencies during installation!
the system platform | Package Type | tool | Automatically resolve dependencies |
---|---|---|---|
RedHat/Centos | RPM | rpm | yum |
Ubuntu/Debian | DPKG | dpkg | apt |
3.RPM acquisition path
- RedHat CD or official website
- RPM queries Official Web site
- Nginx Software Official Web site
4.RPM package naming rules
RPM package named - if the software is divided into portions, dry bash-4.2.46-28.el7.x86_64.rpm
name: the name of the package
version: The version number, the major version, minor version updates zoomed weight, submenus feature updates the revision number, fix bug..
Release: release version EL6, EL7 (hostnamectl)
Arch: platform, i386, x86_64 (uname - m, hostnamectl)
rpm package consists of:
Installation release of the file
metadata package (version, release number, architecture, description, requirements, change the date magazines, etc.)
script: Perform post-installation script and installation script before
5. Review the system CD-ROM drive RPM package
If your system installation disk as well as the system, let us therefore especially first virtual machine links on our system installation disk, and then we can mount /dev/cdrom /mnt
order the CD-ROM mount / mnt of Contents under, then you will /mnt/Packages
see the next of Contents to many .rpm package files.
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# ls /mnt/
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
[root@localhost ~]# ls /mnt/Packages/ |head
1.2RPM package installation
-i: 安装
-v: 详细信息
-h: 安装进度
--test: 测试是否能够安装成功
--force: 强制重新安装
--nodeps: 忽略依赖关系
//安装软件包,需要指定软件包绝对路径
[root@xmh ~]# rpm -ivh /mnt/Packages/tree-1.6.0-10.el7.x86_64.rpm
[root@xmh ~]# rpm -ivh /mnt/Packages/vsftpd-3.0.2-22.el7.x86_64.rpm
//在软件包所在⽬录下,可以不指定绝对路径
[root@xmh ~]# cd /mnt/Packages/
[root@xmh Packages]# rpm -ivh zsh-5.0.2-28.el7.x86_64.rpm
//测试⼀个软件包是否能在该系统上安装
[root@xmh ~]# rpm -ivh --test /mnt/Packages/vsftpd-3.0.2-22.el7.x86_64.rpm
//如果软件包存在, 强制再次安装
[root@xmh ~]# rpm -ivh --force /mnt/Packages/tree-1.6.0-10.el7.x86_64.rpm
//安装samba服务需要依赖其他组件, 使⽤--nodeps可重新强制安装
[root@xmh ~]# rpm -ivh --nodeps /mnt/Packages/samba-4.6.2-8.el7.x86_64.rpm
1.3RPM package query
Use rpm
the command rpm query good package is installed, you need to know the following parameters:
rpm -q #查看指定软件包是否安装
rpm -qa #查看系统中已安装的所有RPM软件包列表
rpm -qi #查看指定软件的详细信息
rpm -ql #查询指定软件包所安装的⽬录、⽂件列表
rpm -qc #查询指定软件包的配置⽂件
rpm -qd #查询指定软件包的帮助⽂档
rpm -qf #查询⽂件或⽬录属于哪个RPM软件
rpm -q --scripts #查询rpm包安装前和安装后执⾏的脚本
//查询未安装的软件包信息
rpm -qip #查询未安装的rpm包详细信息
rpm -qlp #查询未安装的软件包会产⽣哪些⽂件
//查询vsftpd这个rpm包是否安装
[root@xmh ~]# rpm -q vsftpd
//模糊查找系统已安装的rpm包
[root@xmh ~]# rpm -qa |grep ftp
//查询vsftpd软件包的相关信息
[root@xmh ~]# rpm -qi vsftpd
//查询rpm包所安装的⽂件
[root@xmh ~]# rpm -ql vsftpd
//查询rpm包相关的配置⽂件
[root@xmh ~]# rpm -qc vsftpd
//查询配置⽂件或命令来⾃于哪个rpm包 (命令不存在系统则无法查询)
[root@xmh ~]# rpm -qf /etc/vsftpd/vsftpd.conf
[root@xmh ~]# rpm -qf /usr/sbin/vsftpd
//查询未安装的软件包会产⽣哪些⽂件
[root@xmh ~]# rpm -qlp /mnt/Packages/samba-3.6.23-41.el6.x86_64.rpm
//查询未安装的软件包会产⽣哪些⽂件
[root@xmh ~]# rpm -qip /mnt/Packages/samba-3.6.23-41.el6.x86_64.rpm
1.4RPM upgrade package
-U If ⽼ version does not exist, a new installation, if there is a new version that is upgraded
-f ⽼ version must exist before the upgrade
//如果有新版则升级, 软件升级不要跨操作系统主版本号
[root@xmh ~]# rpm -Uvh /mnt/Packages/tree-1.6.0-10.el7.x86_64.rpm
1.5RPM Pack Uninstall
Need to first uninstall dependent packages uninstall package, if the package is dependent on the system must be, it can not uninstall this package, otherwise it will cause the system to crash.
//先查询, 然后卸载
[root@xmh ~]# rpm -qa |grep zsh
[root@xmh ~]# rpm -e zsh --nodeps
[root@xmh ~]# rpm -e zsh
1.6RPM bag check
Related software stored in the database /var/lib/rpm
of Contents
[root@xmh ~]# rpm -V vsftpd
SM5....T. c /etc/vsftpd/user_list
S #⽂件的容量⼤⼩是否被改变
M #⽂件的类型或者⽂件的属性是否被修改
5 #MD5这⼀种指纹加密的内容已经不同
D #装置的主/次代码已经改变
L #路径已经被改变
U #⽂件的所属主已被修改
G #⽂件的所属组已被修改
T #⽂件的创建时间已被改变