Ubuntu vs. CentOS and Binary Compatibility
An executable compiled for a Linux distribution will work on another distribution if that other distribution has the required shared libraries. CentOS has pretty old library versions, so Ubuntu's versions may be too recent; but often if Ubuntu only has libfoo5
and libfoo6
and you need libfoo3
you can grab it from an earlier Ubuntu release.
CentOS and Ubuntu use different packaging systems: rpm vs. deb. You can convert a rpm to a deb with alien
. The resulting package may or may not be installable depending on whether you have the required dependencies. It may be easier to convert the rpm to a plain archive (again with alien
) and unpack that in a separate directory under /opt
or /usr/local
.
If the program doesn't come with a list of dependencies, you can run ldd /path/to/binary
to see what libraries it requires. You'll see output like libfoo.so.4 => not found
if something's missing.
CentOS is "100% binary compatible" with its commercial counterpart, RedHat Enterprise Linux. Because RHEL is a licensed system including support contracts and various enterprisey things, not everybody wants to run it. However in an open source world all development has to be shared, so while they charge for support contracts, media and whatever, they still have to share the source. CentOS is a re-packaging of that to provide it to the community, for free.
Furthermore, then "100% compatibility" is only between the equivalent versions of RHEL and CentOS. Library versions change with each major release, but since these projects release in sync you can exchange packages between them as long as they are both setup for the same major version.
The differences between distros, particularly RPM based distros like CentOS and Debian based ones like Ubuntu can be legion, and a given package will not be portable between them. However the overall systems are roughly the same, software developed for one can usually easily be compiled for the other, it just has to be compiled and packaged a little differently. If you care to pull in all the right library versions, the binaries from one will actually work on another. See Gilles's answer.
Linux Standard Base (LSB) binaries are supposed to be compatible between distros that support LSB. CentOS has LSB support. LSB support is available in Ubuntu as well, but I don't know if the relevant LSB-packages are installed by default or not. It is possible to test if an application is binary compatible.
Note that LSB is controversial, both the standard itself and whether/how much impact it has had.