Alien magic: mutual conversion between RPM and DEB

Source: Internet
Author: User
Tags rpmbuild

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:

  1. # 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.

  1. # rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
  2. # rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

Then,

  1. # yum update && yum install alien

In Fedora, you only need to run the above command.

In Debian and its derivative versions, you only need:

  1. # 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

  1. # cat /etc/centos-release
  2. # wget http://ftp.us.debian.org/debian/pool/main/d/dateutils/dateutils_0.3.1-1.1_amd64.deb
  3. # 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:

  1. # 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:

  1. # yum --enablerepo=epel-testing install rpmrebuild

Then run,

  1. # rpmrebuild -pe dateutils-0.3.1-2.1.x86_64.rpm

It will open your default text editor. Go%filesDelete 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 ):

  1. # 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:

  1. # rpm -Uvh /root/rpmbuild/RPMS/x86_64/dateutils-0.3.1-2.1.x86_64.rpm
  2. # 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:

  1. # 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.

  1. # cat /etc/shells
  2. # lsb_release -a | tail -n 4

Check the Shell and Debian operating system versions

  1. # wget http://mirror.centos.org/centos/6/os/i386/Packages/zsh-4.3.11-4.el6.centos.i686.rpm
  2. # 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:

  1. # 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:

  1. # 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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.