Linux deb文件与rpm文件
linux系统的分类 :
一般来说,我们常见的linux分为两大类,分别是RedHat和Debian(全称为Debian GNU/Linux)。在RedHat系列中,最出名的莫过于RedHat和CentOs了,当然还有很多。Debian系列最出名的为Debian和Ubuntu,作为一个优秀的个人开发者,Ubuntu简直必不可少。
正是由于Linux有不同系统(我们常叫的Linux其实是一种系统内核),所以它们很多具有相同功能的文件的后缀名有所不同。在linux中,以deb和rpm为后缀名的文件都是一个安装包文件,因为为不同的系统服务,所有才有了不同的后缀。
deb
deb文件是Debian系列系统的安装包文件。
| 安装软件包,如果提示错误,可以加参数 --force-all强制安装,但不推荐这样做 |
| 列出安装包中包含的文件 |
| 从安装包中提取信息,包括安装包的名称,版本,大小,介绍等等信息 |
| 卸载安装包,但保留配置文件 |
| 完全卸载安装包,包括清除配置文件 |
| 列出安装后包的名称和版本,注:这里是安装后包的名称,不是安装包的名称,可以使用dpkg-deg -I 命令查看安装后包的名称或输入几个字母后按tab键查看 |
| 显示安装后包的信息 |
|
|
|
|
|
|
| |
deb包的数据组成:
DEBIAN目录 和
软件具体安装目录(模拟安装目录)(如etc, usr, opt, tmp等)。
在DEBIAN目录中:
至少有control()文件,还可能有
postinst(postinstallation)、
postrm(postremove)、
preinst(preinstallation)、
prerm(preremove)、
copyright (版权)、
changlog (修订记录)、
conffiles等。
控制文件 | 描述 |
control | 用了记录软件标识,版本号,平台,依赖信息等数据 |
preinst | 在解包data.tar.gz前运行的脚本 |
postinst | 在解包数据后运行的脚本 |
prerm | 卸载时,在删除文件之前运行的脚本 |
postrm | 在删除文件之后运行的脚本 |
备注:
inst是install(安装)的缩写
pre是表示XX之前的前缀
post是表示XX之后的前缀
rm是remove(移除)的缩写
control文件
描述软件包的名称(Package),版本(Version),描述(Description)等,是deb包必须具备的描述性文件,以便于软件的安装管理和索引。
为了能将软件包进行充分的管理,可能还具有以下字段,以kdump-tools为例:
root@hikvision-PC:/home/hikvision/kdump/DEBIAN# cat control
Package: kdump-tools
Source: makedumpfile
软件包的源代码名称;
Version: 1:1.6.8-2kylin2
Architecture: arm64
软件包支持平台架构,如基于`i386′, ‘amd64’, `powerpc’ ,’all’等;
Maintainer: Louis Bouchard louis.bouchard@ubuntu.com
打包人和联系方式
Installed-Size: 113
大小
Depends: debconf (>= 0.5) | debconf-2.0, kexec-tools (>= 1:2.0.10-2), makedumpfile, debconf, bsdmainutils, lsb-base (>= 3.0-6), file, ucf, linux-base
软件所依赖的其他软件包和库文件。如果是依赖多个软件包和库文件,彼此之间采用逗号隔开;
Recommends: initramfs-tools-core
这个字段表明推荐安装的其他软件包和库文件;
Section: devel
申明软件的类别,常见的有`utils’, `net’, `mail’, `text’, `x11′ 等;
Priority: optional
申明软件对于系统的重要程度,如`required’, `standard’, `optional’, `extra’ 等;
Description: scripts and tools for automating kdump (Linux crash dumps)
kdump-tools provides an init script and a configuration script for
automating the use of kdump. It uses the makedumpfile utility to
reduce the size of the /proc/vmcore file based on user preferences.
.
After installing, please see /usr/share/doc/kdump-tools/README.Debian
for information on enabling and configuring kdump.
额外描述:
Essential:是否是系统最基本的软件包 yes/no,若为yes,则不允许卸载(除非强制性卸载)。
Pre-Depends:软件安装前必须安装、配置依赖性的软件包和库文件,它常常用于必须的预运行脚本需求;
Suggests:建议安装的其他软件包和库文件。
control文件完整示例:
Package: mysoftware
Version: 2016-02-26
Section: free
Priority: optional
Depends: libssl.0.0.so, libstdc++2.10-glibc2.2
Suggests: Openssl
Architecture: i386
Installed-Size: 66666
Maintainer: Simon @ newdivide7037#gmail.com
Provides: mysoftware
Description: just for test
(此处必须空一行再结束)
软件包命名:
rpm
rpm文件是Redhat系列系统的安装包文件。(后续补充!)
| 安装软件包 |
| 卸载安装包 |
| 升级软件包,先卸载后升级 |
| 查询软件包 |