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架构、系统版本及依赖包等,转换后的包能不能用需要进一步实践

Logo

更多推荐