linux alien命令将deb安装包和rpm安装包进行相互转换

alien是一个用于在Debian和Redhat系Linux之间转换包格式的工具,支持.rpm到.deb和反之的转换。通过alien,用户可以在不同Linux发行版中安装原本不兼容的软件包。转换过程可能涉及警告,例如忽略某些脚本,但转换后的包是否能正常安装还需考虑目标系统的架构、版本和依赖关系。示例展示了如何使用alien将.deb包转换为.rpm包,以及反之。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

alien命令作用

alien是一个用于在各种不同的Linux包格式相互转换的工具,其最常见的用法是将.rpm转换成.deb(或者反过来)

alien命令安装

Debian系linux可使用下面命令安装alien:

sudo apt-get install alien

redhat系linux可使用下面命令安装alien:

yum install epel-release
yum update && yum install alien
yum clean all   
yum makecache  

linux分类:
1、debian系主要有Debian,Ubuntu,Mint等及其衍生版本:
2、redhat系主要有RedHatFedora,CentOs等.
3、其它有Slackware,Gentoo,Arch linux,LFS,SUSE等。

alien命令使用说明

查看alien使用帮助可以看出如果使用

[root@MiWiFi-R4AC-srv 2]# alien --help
Usage: alien [options] file [...]
  file [...]                Package file or files to convert.
  -d, --to-deb              Generate a Debian deb package (default).
     Enables these options:
       --patch=<patch>      Specify patch file to use instead of automatically
                            looking for patch in /var/lib/alien.
       --nopatch            Do not use patches.
       --anypatch           Use even old version os patches.
       -s, --single         Like --generate, but do not create .orig
                            directory.
       --fixperms           Munge/fix permissions and owners.
       --test               Test generated packages with lintian.
  -r, --to-rpm              Generate a Red Hat rpm package.
      --to-slp              Generate a Stampede slp package.
  -l, --to-lsb              Generate a LSB package.
  -t, --to-tgz              Generate a Slackware tgz package.
     Enables these options:
       --description=<desc> Specify package description.
       --version=<version>  Specify package version.
  -p, --to-pkg              Generate a Solaris pkg package.
  -i, --install             Install generated package.
  -g, --generate            Generate build tree, but do not build package.
  -c, --scripts             Include scripts in package.
      --target=<arch>       Set architecture of the generated package.
  -v, --verbose             Display each command alien runs.
      --veryverbose         Be verbose, and also display output of run commands.
  -k, --keep-version        Do not change version of generated package.
      --bump=number         Increment package version by this number.
  -h, --help                Display this help message.
  -V, --version             Display alien's version number.

实例展示(RPM、DEB包相互转换)

下面以SunloginClient_11.0.1.44968_uos_amd64.deb为例(向日葵)
下面将.deb包转化为.rpm包

[root@MiWiFi-R4AC-srv 1]# alien -r SunloginClient_11.0.1.44968_uos_amd64.deb 
Warning: Skipping conversion of scripts in package com.oray.sunlogin.client: postinst postrm preinst prerm
Warning: Use the --scripts parameter to include the scripts.
com.oray.sunlogin.client-11.0.1.44968-2.x86_64.rpm generated
[root@MiWiFi-R4AC-srv 1]# ls
com.oray.sunlogin.client-11.0.1.44968-2.x86_64.rpm  SunloginClient_11.0.1.44968_uos_amd64.deb

下面将.rpm包转化为.deb包

[root@MiWiFi-R4AC-srv 2]# alien -d sunlogin.client-11.0.1.44968-2.x86_64.rpm 
com.oray.sunlogin.client_11.0.1.44968-3_amd64.deb generated
[root@MiWiFi-R4AC-srv 2]# ls
com.oray.sunlogin.client_11.0.1.44968-3_amd64.deb  sunlogin.client-11.0.1.44968-2.x86_64.rpm

思考

转换后的包能否正常安装在不同的终端机上,不光和包后缀有关,还和该终端一些其他因素有关,如cpu架构、系统版本及依赖包等,转换后的包能不能用需要进一步实践

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值