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 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
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:
ravi@linuxforfreshers.com:~$ 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:
ravi@linuxforfreshers.com:~/Downloads$ 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:

ravi@linuxforfreshers.com:~$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