LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Articles > Jeremy's Magazine Articles
User Name
Password

Notices


By jeremy at 2005-02-06 18:01
TECH SUPPORT
Alien Packages and Linux Mirrors
by Jeremy Garcia

Do you administer multiple distributions and find it frustrating that you can find packages for some distros and not others? Have you ever tried looking for a .rpm only to find a .deb (or vice versa)? Sometimes, Linux can be maddening.

Luckily, there's a program that can help solve this problem: alien. alien is a script that converts between the Red Hat .rpm, Debian .dpkg, Stampede .slp, and Slackware .tgz file formats. alien can also handle Solaris' .pkg file format. alien lets you to take a package from a system with a different distribution than the one you are running, and makes it usable on your system. Written in Perl, alien is licensed under the GPL and is available from http://www.kitenet.net/programs/alien/.

Because alien is a Perl script, you must have Perl installed (version 5.004, at a minimum). To convert packages to or from .rpm, you will also need the Red Hat Package Manager, available from http://www.rpm.org/. Likewise, if you want to convert packages into .deb, you'll need the dpkg, dpkg-dev, and debhelper packages, available from http://packages.debian.org/. Conversion to .deb also requires gcc and make.

(While gcc and make have traditionally been found on most Linux systems, some newer distributions either put them in a development tools group that's not installed by default or don't offer the tools at all. If your system doesn't have gcc and make, make sure to download them, even building the packages from source, if necessary. You can't compile and install many programs without gcc and make.)

After downloading and unpacking the alien source tarball, use the following commands to build and install alien:

$ perl Makefile.PL
$ make
# make install

By default, the prefix used by the install is /usr, which puts the alien executable in /usr/bin. You can change this behavior by replacing the first command above with:

$ perl Makefile.PL \
PREFIX=/path/to/desired/prefix

Now, with alien installed, let's convert a package. Let's use Fedora (which is based on RPM) and convert a .deb to a .rpm.

(Remember that alien is really designed to convert foreign file formats to the packaging format used by the distribution you have installed. While you can also use it to convert from your distribution's native format to a foreign format, or even one foreign format to another foreign format, you may run into dependency issues when you go to install the converted package, especially when trying to convert a .rpm into a .deb on a Red Hat system.)

First, find the package you'd like to convert. For example, let's use xbill_2.0-14_i386.deb, a trivial package that consists of a single game. To convert the package from a .deb to a .rpm that you can install, use the following command:

# /usr/bin/alien --to-rpm --keep-version xbill_2.0--14_i386.deb

By default, alien adds one to the minor version number of each package it converts. The --keep-version option prevents this.

If everything was successful, you should see a confirmation message such as xbill-2.0-14.i386.rpm generated. You can now install xbill-2.0-14.i386.rpm as you'd normally install any other RPM.

Keep in mind that if alien isn't run as root, the files in the generated package will likely have incorrect owners and permissions. And if you're interested in seeing what alien is doing behind the scenes, add --verbose to the command line options.

Because different distributions configure core packages and subsystems much differently, you shouldn't use alien to replace important system packages, such as sysvinit, shared libraries, or any item that is essential to your system.

Finding Linux Distribution Mirrors

Although Google may know all, it can still be challenging to find fast and updated mirrors for your favorite Linux distributions. That's why LinuxQuestions.org (LQ) recently launched a site to help: LQ ISO. Available at http://iso.linuxquestions.org/, LQ ISO allows you to find and rate mirrors for Linux ISO images via a variety of protocols including HTTP, FTP, rsync, and BitTorrent. At the time of this writing, over fifty distributions and various versions are available for download from over 200 mirrors, and the list was growing rapidly.

If you need help deciding what to download, LQ ISO is also integrated with the LQ forums and the LQ distribution review section. You can also request notification when a new version of a distribution is released.


  



All times are GMT -5. The time now is 04:26 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration