Choosing a Linux distribution
By DevOps on Mon 13 January 2020in
Short answer: Use Ubuntu LTS
There are two main families, RedHat and Debian. RedHat traditionally comes from the corporate world, and Debian from the free software community. I have been using Linux since 1993, so I will give a bit of a history lesson to explain the motivation behind the popular distributions.
RedHat was one of the first major commercial Linux distributions, and is the most successful. They started by selling CDs which you could install on as many servers as you like, hoping that larger customers would buy support contracts. That didn't work, so they switched to a per-server licensing model. When that happened, volunteers took the source code from RedHat Enterprise Linux and made their own releases. Because they couldn't use the RedHat trademark, they called it something else. There was always a bit of a delay with releases, but it worked fine.
There are a couple of distributions like this, with more or less value add. CentOS is the most pure. A few years ago, RedHat bought CentOS, so it's now an official part of RedHat, formalizing the model and giving them more resources. RedHat also has a "bleeding edge" free distribution called Fedora. It's popular with enthusiasts to run on the desktop, but is not commonly run on servers.
Debian is one of the first non-commercial Linux distributions, and is the most popular. Traditionally many of the people who actually write open source packages ran Debian, and it was used by expert users who ran e.g. internet service providers. It is generally high quality, and has the most software packages. At one point, most of the core users were running a "rolling update" version of Debian. Since it is run by volunteers, and there was nobody who cared that much, it once went more than two years without a formal release. Ubuntu was started by a .com millionaire who wanted to give back to the open source community. Ubuntu was basically "Debian with regular releases."
RedHat focused on the kernel and making stable, supported releases for enterprise customers to run on their servers. They traditionally hire many of the core Linux kernel developers. Ubuntu focused on building a good Linux desktop experience. They offer predictable releases and commercial support, and work with partners to certify Debian.
With this background, you can see a bit of the strengths and weaknesses of the different distributions. Here is the current situation:
The majority of enterprise servers run CentOS. If an enterprise needs commercial support, then they pay for RedHat. Many commercial software packages like Oracle were certified and supported on RedHat. Most dedicated servers run CentOS by default, and it may be the only distribution a host supports. Oracle created their own version of RedHat, competing with RedHat for support contracts. Amazon Linux is based on RedHat. The specific differences between Amazon Linux and RedHat are unclear, and it's a bit of a moving target. You can't practically run Amazon Linux outside of Amazon.
Ubuntu made deals with various partners like Amazon. It is a first class supported distribution on AWS, and is very popular there. Ubuntu has largely abandoned its desktop ambitions and is focused on the server side. Rather than try to do proprietary development, it focuses on packaging upstream software in a way that works well.
I have personally run both distributions for many years, and my preferences have shifted back and forth over time. We manage hundreds of virtual and dedicated servers, and we are currently about 50% CentOS and 50% Ubuntu.
Until recently, my preference was CentOS 7, for these reasons:
- It is designed for servers, and has a long term support model so I don't have to upgrade frequently
- It doesn't cost money, but RedHat has a sustainable business model behind it
- RedHat employs many of the core kernel developers, making it solid from the bottom up. Ubuntu has traditionally been weaker at kernel support (and I have the scars from it)
- I can run it everywhere, on dedicated servers, cloud instances and in local dev environments
- Since Amazon Linux is based on RedHat, their software agents work well with it
CentOS has some disadvantages relative to Debian. It has fewer OS packages and relatively old versions. This is the downside of stability. RedHat supports fewer software packages, with fewer options. You may need to find third party repositories to get software or build your own. It's rare, though, as the packages you need for server use are generally there.
Over the long support life of the distro, packages can get pretty old. For most packages, e.g. mail server software, it doesn't matter. For things like the database, you may want newer features. Major projects like PostgreSQL have their own supported packages, which lets us stay up to date. We generally stick to the EPEL repo. You can often download random packages off the net, but it feels a bit questionable sometimes. Why run a "supported" enterprise distro then rely on packages from some random dude?
The long term support for a server is much more important in a bare-metal world, where upgrading can be traumatic. You want to be able to regularly install security packages without worrying that it will take down the server.
In the cloud, however, it's easy for us to set up a new instance with the latest OS, verify that it works, then switch. For that, I prefer Ubuntu.
It's a solid, well supported distro. The community is more friendly for beginners, partly coming from the community nature of Debian, partly from the desktop focus. It has access to all the Debian packages, with a commercial model and regular releases. Packages are generally more up to date than CentOS, and tend to have a more direct line from upstream projects.
We normally use Packer and Ansible to build an AMI specifically for an application. When we need to update the AMI, we can run it through the same CI/CD process that we use for the app, running tests and then deploying. If there is a problem, we can roll it back, same way we would with an application issue.
This works well for applications which are under continuous development. We can run the LTS (Long Term Support) versions of Ubuntu or more frequent releases. They are supported for long enough to keep things stable, but we get access to the latest versions of software.
Ubuntu is well supported in cloud environments. We generally run Minimal Ubuntu, which gives us a small install while still staying compatible with other software.
I prefer to run the community AMIs instead of marketplace AMIs, as it avoids licencing weirdness keeping me from being able to recover a machine when it won't boot.
Long term, the business model of selling Linux is questionable. Cloud providers want to "commoditize the common good", i.e. they sell you machine hours, so they want software to be free. Instead of running e.g. Oracle on RedHat, they would prefer us to use RDS.
RedHat recently sold to IBM. I would not be surprised if Ubuntu sells to Microsoft next. We will be left with a community support model, and Debian is the best working example of that right now. The community can occasionally be dysfunctional, driven by politics, the "United Nations" of free software. It works, though, and I expect it to continue.
The future is containers, where we run only the minimum parts of the operating system necessary to support a specific application. There are specialized distros like Alpine, but I still prefer to run Minimal Ubuntu. It's reasonably small (about 30 MB), but compatible with regular Ubuntu, making development and testing easier.