Product SiteDocumentation Site

5.5. 与其它软件包系统共存

Debian 包格式并非唯一用于自由软件领域的软件包格式。主要竞争者是红帽 Linux 发行版的 RPM 格式以及其衍生格式。红帽是一个非常流行的商业化发行版。对于来自第三方的软件,常以 RPM 格式软件包提供,而非 Debian 格式。
这个情况下,你应该知道rpm程序是如何处理RPM软件包的,这种格式在Debian软件包中也可用。需要谨慎的使用,尽管如何,这些操作会限制从一个软件包中解压并且提取出信息以验证其完整性。实际上,不应该在Debian系统中使用rpm来安装一个RPM软件包;RPM使用了它自己的数据库以便和Debian的软件中分离(比如dpkg)。这也就是为什么不可能确保两个包管理系统共存在一个系统中,而这个系统还能保持稳定。
另一方面,alien 可以把 RPM 软件包转换成 Debian 软件包,反之亦然。
$ fakeroot alien --to-deb phpMyAdmin-5.2.1-2.fc39.src.rpm
[..]
Warning: Skipping conversion of scripts in package phpMyAdmin: postinst
Warning: Use the --scripts parameter to include the scripts.
[..]
phpmyadmin_5.2.1-3_all.deb generated
$ ls -sh phpmyadmin_5.2.1-3_all.deb
  7.2M phpmyadmin_5.2.1-3_all.deb
$ dpkg -c phpmyadmin_5.2.1-3_all.deb
drwxr-xr-x root/root         0 2024-05-21 20:49 ./
-rw-r--r-- root/root   7461668 2023-02-08 01:15 ./phpMyAdmin-5.2.1-all-languages.tar.xz
-rw-r--r-- root/root       833 2023-02-08 01:15 ./phpMyAdmin-5.2.1-all-languages.tar.xz.asc
-rw-r--r-- root/root      1077 2023-07-20 20:00 ./phpMyAdmin-bundled.php
-rw-r--r-- root/root       637 2023-07-20 20:00 ./phpMyAdmin-certs.patch
-rw-r--r-- root/root      1181 2023-07-20 20:00 ./phpMyAdmin.htaccess
-rw-r--r-- root/root       430 2023-07-20 20:00 ./phpMyAdmin.nginx
-rw-r--r-- root/root     38997 2023-07-20 20:00 ./phpMyAdmin.spec
-rw-r--r-- root/root     34198 2023-07-20 20:00 ./phpmyadmin.keyring
drwxr-xr-x root/root         0 2024-05-21 20:49 ./usr/
drwxr-xr-x root/root         0 2024-05-21 20:49 ./usr/share/
drwxr-xr-x root/root         0 2024-05-21 20:49 ./usr/share/doc/
drwxr-xr-x root/root         0 2024-05-21 20:49 ./usr/share/doc/phpmyadmin/
-rw-r--r-- root/root       214 2024-05-21 20:49 ./usr/share/doc/phpmyadmin/changelog.Debian.gz
-rw-r--r-- root/root      1303 2024-05-21 20:49 ./usr/share/doc/phpmyadmin/copyright
[..]
$ dpkg -I phpmyadmin_5.2.1-3_all.deb
 new Debian package, version 2.0.
 size 7500852 bytes: control archive=1092 bytes.
     583 bytes,    15 lines      control
     618 bytes,    10 lines      md5sums
     446 bytes,    11 lines   *  postinst             #!/bin/sh
 Package: phpmyadmin
 Version: 5.2.1-3
 Architecture: all
 Maintainer: debian <debian@debian>
 Installed-Size: 7377
 Section: alien
 Priority: extra
 Description: A web interface for MySQL and MariaDB
  phpMyAdmin is a tool written in PHP intended to handle the administration of
  MySQL over the Web. Currently it can create and drop databases,
  create/drop/alter tables, delete/edit/add fields, execute any SQL statement,
  manage keys on fields, manage privileges,export data into various formats and
  is available in 50 languages
  .
  (Converted from a rpm package by alien version 8.95.6.)
你会发现这个过程非常简单。不过,您必须知道,生成的软件包没有任何依赖信息,因为两种打包格式中的依赖关系并没有系统的对应关系。因此,管理员必须手动确保转换后的软件包能正常运行,这也是尽量避免使用这样生成的 Debian 软件包的原因。幸运的是,在所有发行版中,Debian 拥有最多的软件包,您所需要的东西很可能已经在其中了。
翻看alien命令的帮助页面,您会注意到该程序也可处理其他的包格式,特别是使用 Slackware 发行版所用的格式(它使用简单的tar.gz归档格式)。
The stability of the software deployed using the dpkg tool contributes to Debian's fame. The APT suite of tools, described in the following chapter, preserves this advantage, while relieving the administrator from managing the status of packages, a necessary but difficult task.