Alien 在包格式之间转换

时间:2020-03-21 11:42:38  来源:igfitidea点击:

Alien

正如Alien手册页所说,Alien是一个在Red Hat rpm,Debian deb,Stampede slp,Slackware tgz和Solaris pkg文件格式之间转换的程序。
这基本上意味着,如果我们在所选的Linux发行版上缺少某些软件包,则可以从另一个发行版转换该软件包,然后尝试在我们的发行版上安装它。

但是,不应使用Alien替换任何重要的系统软件包或者其他对系统功能至关重要的东西。

为了在不同格式之间进行转换,Alien需要同时安装RPM和Debian软件包系统。
这听起来并不可怕,因为Alien默认情况下不使用这些软件包的数据库功能。
只要我们不使用外国软件包管理器来安装软件,就不会有问题。

将Htop .deb软件包转换为.rpm并在CentOS上安装

当我安装了CentOS测试服务器时,所有这些异想天开的想法都变成了现实,并且当yum突然告诉我没有可用的htop软件包时,我正准备安装我最喜欢的htop进程查看器。

请记住,可以在Internet上下载htop .rmp软件包,因此它不太可能代表Alien的最佳用法,否则就不会很有趣。
简而言之,我们有两台测试服务器。

Debian Wheezy:

# uname -rv
3.2.0-4-686-pae #1 SMP Debian 3.2.51-1

和CentOS 6.3(最终版):

# uname -rv
2.6.32-279.el6.i686 #1 SMP Fri Jun 22 10:59:55 UTC 2012

我们已经在Debian机器上安装了htop。
我们现在要做的是变得陌生:

Hyman@theitroad:~# apt-get update && apt-get install rpm alien -y

无需安装即可下载htop软件包:

Hyman@theitroad:~# apt-get install -d htop

将htop .deb软件包转换为.rpm:

Hyman@theitroad:~# alien --to-rpm /var/cache/apt/archives/htop-1.0.1-2.i386.deb 
htop-1.0.1-2.i386.rpm generated

让我们检查:

Hyman@theitroad:~# ls 
htop-1.0.1-2.i386.rpm

看起来不错。
现在我们需要将.rpm文件从Debian服务器传输到CentOS:

Hyman@theitroad:~# scp -P12 Hyman@theitroad:/root/htop-1.0.1-2.i386.rpm ./
Hyman@theitroad's password:
htop-1.0.1-2.i386.rpm

100%   73KB  72.7KB/s   00:00

由于这两台机器都用于测试,并且没有启用公共ssh访问,因此为了方便起见,我们使用root用户。

让我们安装软件包:

Hyman@theitroad:~# rpm -ihv ./htop-1.0.1-2.i386.rpm
Preparing... ########################################### [100%]
1:htop ########################################### [100%]

软件包信息应标识正在使用的外来版本:

Hyman@theitroad:~# rpm -qi htop
 Name : htop Relocations: (not relocatable)
 Version : 1.0.1 Vendor: (none)
 Release : 2 Build Date: Sat 23 Nov 2013 07:02:44 PM GMT
 Install Date: Sat 23 Nov 2013 07:03:51 PM GMT Build Host: debian
 Group : Converted/utils Source RPM: htop-1.0.1-2.src.rpm
 Size : 149862 License: see /usr/share/doc/htop/copyright
 Signature : (none)
 Summary : interactive processes viewer
 Description :
 Htop is an ncursed-based process viewer similar to top, but it
 allows one to scroll the list vertically and horizontally to see
 all processes and their full command lines.
 Tasks related to processes (killing, renicing) can be done without
 entering their PIDs.
(Converted from a deb package by alien version 8.87.)

我们的Debian服务器上不再需要Alien sofwtare,因此可以将其删除:

Hyman@theitroad:~# apt-get remove alien rpm -y ; apt-get autoremove -y

我们还想清除本地检索到的包文件的存储库:

Hyman@theitroad:~# apt-get clean