3

I'm moving a product from Ubuntu 12.04 to Centos 6.6. I have ~500 deb files. (for example 'dpkg -i libaio1_0.3.109-2ubuntu1_amd64.deb'). I need these debs on Centos .

  1. Is there a viable way to install deb packages on Centos?

  2. A reliable way to convert deb files to a Centosable format? (I tried the package "alien" and it didn't work, gave errors, fails at every turn)

  3. Also, what does the dpkg command do with the deb files? I know that rpm packages use a spec file and triggers from the rpm command to use it. couldn't find a similar file in .debs though.

  • 1
    Do you have access to sources? I suspect it'd actually be more time efficient to create source RPMs from the sources (possibly based on the practices used in creating the original debs) than to convert .deb to .rpm files. – Dani_l Oct 8 '15 at 12:27
  • According to wikipedia en.wikipedia.org/wiki/Deb_%28file_format%29 it should be possible to untar the files. Sorry, not much experience with deb files myself. Debian faq suggest using dpkg-deb to manipulate .deb files as internal format might vary debian.org/doc/manuals/debian-faq/ch-pkg_basics#s-deb-format – Dani_l Oct 8 '15 at 12:36
  • 3
    I suspect the main issue alien has is not with decompression of the archive but with target paths, as those might vary between debian and rhel - any dependencies which rely on lib or kernel version and don't take into account redhat's practice of backporting features into older version might cause unnecessary errors. Really, rebuilding from source is probably your best bet. – Dani_l Oct 8 '15 at 12:39
  • 1
    it might be simpler to put your product inside a ubuntu VM, on work on simple wrapper scripts to access the VM. just an idea. – meuh Oct 8 '15 at 13:08
  • If I'm looking for sources I might as well look for RPMs already compiled for Centos... We already have a Ubuntu VM and it's slowly killing us with a million little errors when integrating several products between Centos and Ubuntu :-( – Nahshon paz Oct 8 '15 at 13:42
4

The problems you've had with alien are most likely not due to a bug or limitation in alien, but to an intrinsic problem of your approach. Converting a deb package into an rpm package is easy, and alien does it well. Converting a package for Ubuntu into a package for CentOS is much more difficult. This means not only repacking the files in a different format, but also moving files around to be in the directories where CentOS expects them, modifying configuration files so that they work on CentOS (e.g. with a different init system), declaring dependencies on packages that have different names (or might not even be present in the distribution at all), etc.

With 500 packages, you're probably going to encounter some difficult cases. Whether it's worth the effort to make dummy packages, create symbolic links and wrapper scripts, tweaking the system configuration, etc. is up to you, but I'd definitely be looking for another solution. In particular, note that there's a good chance that the Debian binariesare compiled against different library versions than what's present in CentOS.

If you want to run programs built for Debian on a CentOS machine, the least effort solution would be to install Debian in a chroot (this guide about installing Debian on another Debian version may be useful, as there's not much dependency on the host side).

If you want to have “proper” CentOS packages then building them from source will be far easier than converting the Debian packages.

2

alien is the tool to convert deb to rpm or inverse... example :

sudo alien -r /var/cache/apt/archives/alien_8.90_all.deb /home/ubuntu/
  • I tried the package "alien" and it didn't work, gave errors, fails at every turn – Nahshon paz Oct 8 '15 at 13:47
  • what kind of errors you are getting ? for me the conversion works for the same file, i just tried it with the following command : sudo alien -r libaio1_0.3.109-2ubuntu1_amd64.deb, and i got a libaio1-0.3.109-3.x86_64.rpm genereated in the directory where i was – mazs Oct 8 '15 at 13:57
  • some packages fail conversion, some (like liaio) convert but fail to install (did you try installing?) with multiple errors - no lib found, wrong kernel version. what Dani_l said above reg target paths seems valid. The problem doesn't seem to be with the actual RPM creation (mostly), but with dependencies for different OS versions. – Nahshon paz Oct 8 '15 at 14:07
1

Be careful if you're thinking a simple conversion will do it: converting a deb to an RPM and vice versa, due to vast differences in filesystem layout, is like dressing up an American in French clothing and expecting him to fit in. Differences in filesystem layout, kernel, libraries and tunings are like cultural differences; and you can't expect a smooth fit AT ALL.

FPM is great if you never ever want to package something properly, just need a payload delivery method and also don't mind never getting a source RPM. Since FPM packages something after it's spraypainted onto the filesystem (make install or similar pre-2000 methods of 'installation'), you're also not packaging in a clean isolated location with all the intrinsic benefits.

Ultimately, you will save a small amount of time and understand a lot more about the process, methods and logic if you just package it. The 'small' amount of time is like the difference between 90 days and 91, but the 'day two' problem after delivery, where small changes need to be made due to unforeseen problems in delivery, is solved trivially.

Before you consider fpm or other hacks, if you can't/won't learn to package on enterprise linux, just hire someone. The right nerd will do it properly, and while you won't know how or why something was done a certain way at least you'll have the SPEC files to tune quickly.

  • Dressing up an American in French clothing and expecting him to fit in :-) I came up with some nifty metaphors for this, but I'll definitely quote you. – Nahshon paz Jun 4 '16 at 19:59
0

Check fpm to convert deb packages to rpm. I haven't tried converting between deb and rpm yet.

https://www.digitalocean.com/community/tutorials/how-to-use-fpm-to-easily-create-packages-in-multiple-formats

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.