Saturday, April 18, 2009

Convert Linux binaries with Alien

In Windows, installation packages generally come with either a .exe or .msi file extension. In Mac OS X, they come as either .app, .pkg or .mpkg. In Linux, most software packages you'll want to install are probably available in a repository. There are some software packages that are only available in source or binary form and are not found in a repository. The source packages get compiled at your local machine and installed. The binaries, however, are built specific to a distribution. For example, the most common ones seen are .rpm, for distributions like RHEL, Fedora, and CentOS or .deb, for distributions like Debian, Ubuntu, and Linux Mint.

But suppose there is a package you want to install available in binary form only as an rpm but you run Ubuntu? There is a tool called alien that will convert binaries into different formats. In Ubuntu, you can install it by typing:
sudo aptitude install alien
To convert a package binary to .deb:
sudo alien -d [package binary]
Converting to .deb is the default behavior so the -d flag is optional.

Convert to .rpm:
sudo alien -r [package binary]
Convert to .tgz:
sudo alien -t [package binary]
Convert, auto install, and delete the new binary when finished:
sudo alien -i [package binary]
Once you have converted a package, you can install it in Debian or Ubuntu with:
sudo dpkg -i [package].deb
Or in RPM based distros with:
sudo rpm -i [package].rpm

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.