≡ Menu

How to Convert DEB to RPM (RPM to DEB) Package Using Alien Command

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.
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Anubhav June 19, 2012, 12:54 am

    Realy helpful thx

  • Ankit September 26, 2012, 3:45 am

    Good informative article. :)Thanks

  • Johnny October 10, 2012, 11:50 am

    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?

  • Gip-Gip November 8, 2013, 5:32 am

    this is oly when your on ubuntu tho…. ):