Alien magic: mutual conversion between RPM and DEB
As I'm sure you know, there are a variety of software installation methods in Linux: You can use the package management system (aptitude, yum, or zypper) provided by the release ), compile from the source code (although rarely used, it is the only available method in the early development of Linux), or use their respective low-level tool dpkg. deb, and rpm. rpm, pre-compiled package, and so on.
Use Alien to convert RPM to DEB and DEB to RPM
In this article, we will introduce you to alien, a tool for conversion between different Linux package formats. The most common usage is. rpm. deb (or vice versa ).
If you need a specific type of package and you can only find packages in other formats, this tool will be useful sooner or later-even if the author does not maintain it and declares on its website: alien may remain in the lab state forever.
For example, once I was looking for a. deb driver for an ink jet printer, but I couldn't find it. The manufacturer only provided the. rpm package. At this time, alien saved me. I installed alien and converted the package. Soon I will be able to use my printer, no problem.
Even so, we must clarify that this tool should not be used to convert important system files and libraries because they have different configurations in Different releases. Alien can be used as the final method only when the recommended installation method is not suitable.
The last point is that we must note that, although we use CentOS and Debian in this article, apart from the first two releases and their respective family systems, as far as we know, alien can work in Slackware or even Solaris.
Step 1: Install Alien and its dependent packages
To install alien to CentOS/RHEL 7, you need to enable EPEL and Nux Dextop (yes, Dextop -- not Desktop) repositories in the following order:
# yum install epel-release
The latest version of The Nux Dextop repository package is 0.5 (released on April 9, August 10, 2015). Before installation, you can view the latest version at http://li.nux.ro/download/nux/dextop/el7/x86_64.
# rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Then,
# yum update && yum install alien
In Fedora, you only need to run the above command.
In Debian and its derivative versions, you only need:
# aptitude install alien
Step 2: Convert. deb to. rpm package
For this test, we chose the date tool, which provides a series of date and time tools for processing a large amount of financial data. We will download the. deb package to our CentOS 7 machine, convert it to. rpm, and install:
Check CentOS Version
Check CentOS version
# 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
Convert. deb to. rpm in Linux
Important: (note how alien adds the next version number of the target package. If you want to ignore this behavior, add the-keep-version identifier ).
If we try to install the package immediately, we will encounter some problems:
# rpm -Uvh dateutils-0.3.1-2.1.x86_64.rpm
Install the RPM package
To solve this problem, we need to enable the epel-testing repository, and then install the rpmbuild tool to edit the configuration of the package to recreate the package:
# yum --enablerepo=epel-testing install rpmrebuild
Then run,
# rpmrebuild -pe dateutils-0.3.1-2.1.x86_64.rpm
It will open your default text editor. Go%files
Delete the rows in the directory mentioned in the error message, save the file, and exit:
Convert. deb to Alien
However, after you exit the file, you will be prompted to continue refactoring. If you select "Y", the file will be restructured to the specified directory (different from the current working directory ):
# rpmrebuild –pe dateutils-0.3.1-2.1.x86_64.rpm
Build an RPM package
Now you can continue to install and verify the installation package as before:
# rpm -Uvh /root/rpmbuild/RPMS/x86_64/dateutils-0.3.1-2.1.x86_64.rpm
# rpm -qa | grep dateutils
Install and build an RPM package
Finally, you can list all the tools included in the date tool, or view their respective manual pages:
# ls -l /usr/bin | grep dateutils
Verify the installed RPM package
Step 3: Convert. rpm to A. deb package
In this section, we will demonstrate how to convert. rpm to. deb. On a 32-bit Debian Wheezy machine, let's download the. rpm package for zsh shell from the CentOS 6 operating system repository. Note that this shell is unavailable in the default installation of Debian and its derivative versions.
# cat /etc/shells
# lsb_release -a | tail -n 4
Check the Shell and Debian operating system versions
# 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 ignore the information about signature loss:
Convert. rpm to. deb package
After a while, the. deb package should have been generated and can be installed:
# dpkg -i zsh_4.3.11-5_i386.deb
Install the Deb package converted by RPM
After installation, check whether zsh has been added to the legal shell list:
# cat /etc/shells
Confirm the Zsh package to be installed
Summary
In this article, we have explained how to convert. rpm to. deb and its reverse conversion, which can be used as the final installation means that such programs cannot be obtained from the repository or as distributable source code. You must add this article to the bookmarks because we all need alien.
Please share your thoughts on this article and write them to the form below.
You may also like the following content about RPM package creation:
How to quickly customize the binary kernel RPM package in CentOS
Getting started with creating an RPM package
In Linux, how does one create an RPM package?
Create your own rpm package
Directory structure and configuration after rpm installation in Linux
Brief Introduction and demo of rpm and yum
RedHat Linux --- rpm command details
Use FPM to easily create an RPM package
Via: http://www.tecmint.com/convert-from-rpm-to-deb-and-deb-to-rpm-package-using-alien/
Author: Gabriel cánepa Translator: GOLinux Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: