Friday, June 9, 2017

how to convert rpm to deb and deb to rpm using alien command on linux ?

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.

Install alien command on Debian / Ubuntu

Install alien command on Ubuntu as shown below.
# sudo apt-get install alien
Install alien command on RHEL
 You should check to see whether there’s a newer version before proceeding further:
#rpm -Uvh
then do,
# yum update && yum install alien
1. Convert RPM to DEB
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.
Example:$ sudo alien -d --script -k anydesk-2.9.1-2.x86_64.rpm
anydesk_2.9.1-2_amd64.deb generated

Note: You'll also notice that alien has counted up the version number. If you want to keep the original version number, you must use the -k switch:
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.
Example:$ sudo alien -r anydesk_2.9.1-1_amd64.deb
Warning: Skipping conversion of scripts in package anydesk: postinst postrm
Warning: Use the --scripts parameter to include the scripts.
anydesk-2.9.1-2.x86_64.rpm generated

In above example i am not used -k so it will update the version automatically.

Example2:$sudo  alien -r --scripts -k anydesk_2.9.1-3_amd64.deb
anydesk-2.9.1-3.x86_64.rpm generated
Where  -r, --to-rpm                Generate a Red Hat rpm package
             --scripts                        Include scripts in package.
              -d, --to-deb                  Generate a Debian deb package (default).
             -k, --keep-version        Do not change version of generated package.

If u want more help check man alien.

No comments:

Post a Comment