Question: I have a *.deb file that I like to install on Red Hat. Is it possible to convert a *.deb to *.rpm package (and vice versa)?
Answer: You can use alien command to convert *.deb to *.rpm file. Also, if you have a *.rpm file that you want to install on a Debian or Ubuntu, you can convert the *.rpm to *.deb file using alien command as explained in this article.
1. Convert RPM to DEB
Install alien command on Debian / Ubuntu
Install alien command on Ubuntu as shown below.
# sudo apt-get install alien
Use alien command to convert rpm to deb file
The following example converts the linuxconf-devel rpm file to linuxconf-devel deb file. Once you generate the deb file, you can install it on Ubuntu or Debian.
# alien linuxconf-devel-1.16r10-2.i386.rpm linuxconf-devel_1.16r10-3_i386.deb generated
Install deb packages using the dpkg command — Debian: How to Install or Remove DEB Packages Using dpkg
2. Convert DEB to RPM
Use alien to convert deb to rpm file
Use alient -r option to convert a deb file to rpm file. The following example converts libsox deb file to libsox rpm file. Once you generate the rpm file, you can install it on Red Hat, or CentOS.
# sudo alien -r libsox1_14.2.0-1_i386.deb libsox1-14.2.0-2.i386.rpm generated
Install rpm packages using rpm command — RPM Command: 15 Examples to Install, Uninstall, Upgrade, Query RPM Packages
3. Convert to SLP, LSB, Slackware TGZ packages
You can also use alien command to convert files to Stampede slp package, LSB package, and Slackware tgz package. Do alien -h to see available options.
# alien -h Usage: alien [options] file [...] file [...] Package file or files to convert. -d, --to-deb Generate a Debian deb package (default). Enables these options: --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= Specify package description. --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. -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.
Comments on this entry are closed.
Realy helpful thx
Good informative article. :)Thanks
A nice touch to get strictly Red Hat stuff to work on Lenny. Or even the other way around. I wonder if I could make my kde 3 for Red Hat Vallhalla work in ubuntu 12?
this is oly when your on ubuntu tho…. ):