0

Is there a way to deploy an application, that you built on Ubuntu, on CentOS? And if so, how?

EDIT: Sorry, I should have given some more info.

It's built on Ubuntu 15.10 with Qt 5.6, and besides Qt it has only one other dependency which is statically linked. I'm not sure if its dependencies are statically linked as well, but it's using some boost libs and nothing Ubuntu specific so I'm guessing that shouldn't be a problem.

  • 1
    Usually no problem, if the Ubuntu that was building the application has a matching or older libc6 (The CentOS libc name is glibc.) Please test this. ... Installing to CentOS : Build an rpm package with the app result : /usr/[??]/ – Knud Larsen Jul 23 '16 at 12:35
  • 1
    Same architecture I assume? Also relatively similar kernel versions? In that case static compiling should help but you should edit your question to be more specific before we can give you better and definitive answers. – phk Jul 23 '16 at 12:45
  • I'm not sure about kernel versions (I'll have to check that), and the architecture is the same. I also edited the original post with more info. – rndm Jul 23 '16 at 13:46
0

It depends on how the application was created and what dependencies it has. If it's written in for example Python then it can generally run as long as a compatible Python interpreter and modules are installed.

If it's an elf binary then it depends on if there are binary compatible libraries installed. Since some libraries might not be available, be available only as an incompatible version or have the wrong soname then you can either statically link your binary or distribute the missing libraries together with the application.

You can also use Flatpak to package your application and then use it on multiple distributions.

  • I'll take a look at Flatpak, thanks. Also, edited the original post with more info. – rndm Jul 23 '16 at 13:47
0

As others have mentioned, just installing/extracting the app straight onto the system may or may not work, depending on things like whether it's a script or compiled binary, statically vs dynamically linked, lib versions, etc.

In order to be sure that the application will run, the app needs to run within the context of the OS that it was built for. One of the simplest ways to do this is docker. It's a bit of a heavy solution, but it will essentially let you run one OS within another. So you could run an ubuntu container and put your app in it.
You could also just setup an ubuntu chroot, and execute the application in there. This is similar to what docker does, but a lot lighter.

The only thing these solutions won't solve is if the application depends on specific kernel features that are only in ubuntu. This is very unlikely though.

  • I would like to avoid docker if possible. Also, edited the original post with more info. – rndm Jul 23 '16 at 13:47
0

You can run an application compiled for one Linux distribution on any other distribution, as long as that other distribution has the required libraries available. The problem in practice is usually that different distributions ship different versions of libraries at a given point in time.

Linking libraries statically is a bad idea. It bloats the application file size (not much of a concern in most cases, except for people with little Internet bandwidth), bloats the application size in memory (that's more of a concern in practice), and means that your application will stay stuck with all the bugs from the version you linked with. Link your libraries dynamically so that your users will benefit from the bug fixes to the libraries, especially the security fixes.

Furthermore, while you can run applications, there's the problem of packaging. Installing applications manually is a pain. If you don't distribute an RPM package for CentOS, and a deb package for Ubuntu, you do your users a disservice.

So you should generate proper packages for all distributions. You can run an application built for Ubuntu on CentOS, with more or less effort depending on library requirements, but you can't deploy an application built for Ubuntu on CentOS.

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.