Michael Trojanek (relativkreativ) — Bootstrapper and creator of things

This article was published on November 17th 2014 and takes about 4 minutes to read.

Use it with caution — it is probably still valid, but it has not been updated for over a year.

CentOS or Ubuntu?

An outline of the differences between the two major Linux distributions in the Rails world.

The number one question on my mailing list is "Should I use CentOS or Ubuntu to build a server for hosting my Rails applications?".

According to rough numbers found on the Internet, CentOS is the most popular Linux distribution for web servers (with almost 30% of all Linux webservers using it), Ubuntu is used on 20% of Linux webservers.

But since these numbers probably will not help you to make your decision, I have compiled a list with the most obvious differences between these two distributions (if you think I have missed something important, please drop me a line).

Release cycles

In accordance with the RedHat Enterprise Linux life cycle, CentOS distrbutions are supported for 10 years – version 6 until 30th of November 2020 and version 7 until 30th of June 2024.

Ubuntu's LTS branch ("Long Term Support" – the one you'll choose for servers) has a support life of 5 years. The version current as I write this article is 14.04.1 and will be supported until April 2019.

Up-to-dateness

CentOS privileges consistency and security over being on the cutting edge and thus is fairly conservative when it comes to upgrading software – up to a point where it begins to hurt (they finally packaged Ruby 2.0 with CentOS 7, but version 6.5 still comes with Ruby 1.8.7).

Ubuntu is less conservative, so if you rely on your system's package manager to install new software, Ubuntu will almost certainly get new software before CentOS.

Of course you would not want to use the system's Ruby to run your applications. I just used these packages to illustrate.

Package manager

As CentOS is binary-compatible with RedHat Enterprise Linux, they both use yum to install and manage .rpm packages (in case you are wondering, RPM formerly meant "RedHat Package Manager" and now means "RPM Package Manager").

Since Ubuntu is a Debian-based release, it uses .deb packages and apt-get.

They both basically provide the same functionality, but if you need some special tools, you may want to check if they are available prepackaged for the platform you want to use.

Security philosophy

As opposed to CentOS, Ubuntu disables the root account and forces use of sudo by default.

As it has been co-developed by RedHat, SELinux comes preinstalled and configured with every CentOS system since version 4, which is a huge security benefit (if you know how to use it correctly).

SELinux is more of a second-class citizen on Ubuntu systems which on the other hand come with AppArmor, a similar (but in my opinion inferior) system for mandatory access control.

Runlevel management

CentOS/RedHat used traditional init scripts to manage runlevels up until version 6 but switched to systemd (and now uses systemd targets) with the release of version 7.

Ubuntu contains Upstart as a replacement for the traditional init-process since version 6.10, but it still uses the traditional init scripts and Upstart's SysV-rc compatibility tools to start most services and emulate runlevels.

Default shell

Ubuntu uses dash as its default shell, whereas CentOS uses bash.

This is no big deal most of the time. However, there are some slight differences between the two (dash does not support hashes for example) so you may have to take this into account.

Which one should I use?

If you have no personal experience with managing a Linux server, I would suggest you choose CentOS for its longer support life and its enterprise level reliability.

If you have been an Ubuntu user for some time (maybe using it on your desktop) then by all means stick with it.

For the average Rails application, the operating system does not make that much of a difference. And should you choose to switch later, you will not run into too many problems if you already know your way on one distribution – at their core, they are basically the same Linux.

Get in the loop

Join my email list to get new articles delivered straight to your inbox and discounts on my products.

No spam — guaranteed.

You can unsubscribe at any time.

Got it, thanks a lot!

Please check your emails for the confirmation request I just sent you. Once you clicked the link therein, you will no longer see these signup forms.