Alien, a tool that converts between different Linux package formats, with .rpm to .deb (and vice versa). Here we will use CentOS and Debian, alien also known to work in Slackware and even in Solaris.
Step 1: Installing Alien and Dependencies
To install alien in CentOS/RHEL 7, you will need to enable the EPEL and the Nux Dextop (yes, it’s Dextop – not Desktop) repositories, in that order:
# yum install epel-release
# rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
The latest version of the package that enables this repository is currently 0.5 (published on Aug. 10, 2015). You should check http://li.nux.ro/download/nux/dextop/el7/x86_64/ to see whether there’s a newer version before proceeding further:
# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
# yum update && yum install alien
In Fedora, you will only need to run the last command.
In Debian and derivatives, simply do:
# aptitude install alien
Step 2: Converting from .deb to .rpm Package
For this test we have chosen dateutils, which provides a set of date and time utilities to deal with large amounts of financial data. We will download the .deb package to our CentOS 7 box, convert it to .rpm and install it:
# cat /etc/centos-release # wget http://ftp.us.debian.org/debian/pool/main/d/dateutils/dateutils_0.3.1-1.1_amd64.deb # alien --to-rpm --scripts dateutils_0.3.1-1.1_amd64.deb
To solve this issue, we will enable the epel-testing repository and install the rpm rebuild utility to edit the settings of the package to be rebuilt:
# yum --enablerepo=epel-testing install rpmrebuild
# rpmrebuild -pe dateutils-0.3.1-2.1.x86_64.rpm
Which will open up your default text editor. Go to the %files section and delete the lines that refer to the directories mentioned in the error message, then save the file and exit.
When you exit the file you will be prompted to continue with the rebuild. If you choose Y, the file will be rebuilt into the specified directory (different than the current working directory):
# rpmrebuild –pe dateutils-0.3.1-2.1.x86_64.rpm
Now you can proceed to install the package and verify as usual:
# rpm -Uvh /root/rpmbuild/RPMS/x86_64/dateutils-0.3.1-2.1.x86_64.rpm # rpm -qa | grep dateutils
Finally, you can list the individual tools that were included with dateutils and alternatively check their respective man pages:
# ls -l /usr/bin | grep dateutils
Step 3: Converting from .rpm to .deb Package
In this section we will illustrate how to convert from .rpm to .deb. In a 32-bit Debian Wheezy box, let’s download the .rpm package for the zsh shell from the CentOS 6 OS repository. Note that this shell is not available by default in Debian and derivatives.
# cat /etc/shells # lsb_release -a | tail -n 4
# wget http://mirror.centos.org/centos/6/os/i386/Packages/zsh-4.3.11-4.el6.centos.i686.rpm # alien --to-deb --scripts zsh-4.3.11-4.el6.centos.i686.rpm
You can safely disregard the messages about a missing signature. After a few moments, the .deb file should have been generated and be ready to install:
# dpkg -i zsh_4.3.11-5_i386.deb
After the installation, you can verify that zsh is added to the list of valid shells:
# cat /etc/shells