Linux exists in a complex open source environment, with many different distributions (distros) being developed by programmers from around the globe, and simultaneously being backed by huge companies. Which distro should you install on your new server?
What’s The Difference Between All These Distros?
When you’re running Linux on a cloud server, you’re likely accessing it over SSH, and not a GUI, so differences in the desktop environment don’t matter much (if at all). While you can technically run any flavor of Linux on a server, it’s best to choose a distro optimized for server use.
Most distros will vary based on what software they have preinstalled and where it falls on the Linux “family tree.” Nearly all Linux distros are open source, so many distros will be based on others. For example, Ubuntu is based on Debian, and many distros are based on Ubuntu. Red Hat Enterprise Linux was forked and became CentOS, with Red Hat (the company) supporting CentOS’s development. Amazon forked CentOS to roll their own distro. Each one of these distros will install similar software, though the exact version numbers will vary from one distro to another.
In practice, most distros intended for server use will be relatively similar. It’s all Linux after all, so as long as you’re not using an obscure distro, the software you want to run will likely be compiled for your system, or just be compatible anyway. The biggest issue is folder structure being different on certain distros, though you might also have to get used to the distro’s idiosyncrasies, like Ubuntu using the
apt package manager, while RHEL, CentOS, and Amazon Linux use
One way to solve this issue altogether is to use a containerization service like Docker. Docker packs your applications into containers, which run the same regardless of what operating system they’re running on (assuming that distro has a Docker binary compiled). You can even “emulate” other distros; for example, you could have a server on Ubuntu running a containerized app that thinks it’s running on CentOS. This is because Docker only modifies the container’s namespaces, and it’s all running on the same Linux kernel under the hood. You could switch that server over to a different provider running Fedora and all you’d have to do to get your app running again would be to copy and run your app’s container on the new system.
Ubuntu Server LTS
Ubuntu is perhaps the most well-known Linux distro. It’s free and open source, so almost every cloud provider will offer it as an option, if it’s not already the default. If you move to a new provider in the future, the transition should be seamless.
Ubuntu Server is a very general-purpose distro. If you don’t care to dive in to all the details of competing distros, you won’t have any problems simply installing Ubuntu and forgetting about it.
There are a few flavors of Ubuntu Server, but we would recommend installing whatever the latest Long-Term Support (LTS) release is, which is published every two years in April. Currently, the latest version is Ubuntu 18.04.2 LTS (Bionic Beaver), with 20.04 LTS slated for next April. However, Canonical is supporting still Ubuntu 18.04 LTS until 2022 with extended security patches until 2027.
Ubuntu is open source, and Canonical’s patches are free, but the company offers a paid service called Ubuntu Advantage, which provides 24/7 phone and web support. More notably, it also gives you access to two very useful services—Canonical Livepatch and Landscape.
Livepatch installs kernel updates automatically without rebooting your system, which allows you to keep your server up even through critical kernel bugs. It’s free for three machines, but anything more requires Ubuntu Advantage. Landscape is a management tool designed around monitoring the health of your system and installing batch updates to packages on multiple servers.
If you want a minimal distro similar to Ubuntu, you can try running Debian, the distro Ubuntu is based on. However, the support for bare Debian is community based, and it isn’t as popular.
Amazon rolls their own version of Linux for use in their services. It comes preinstalled with tools for managing your AWS resources, like the AWS CLI interface. It’s also “tuned for optimal performance on Amazon EC2,” though the exact performance benefit of using Amazon Linux over another distro is unclear.
It’s likely that Amazon Linux contains performance optimizations designed to reduce costs on Amazon’s side when running multiple EC2 instances under a hypervisor, and you won’t actually see your system running any faster compared to Ubuntu.
Amazon Linux is offered as an Amazon Machine Image (AMI) when you create a new EC2 instance. It’s the first option, so if you quickly fired up an EC2 server, it’s likely running on Amazon Linux unless you specified otherwise.
While a distro built specifically for your cloud provider comes with great integrations, the main downside of Amazon Linux is that it is exclusive to AWS. If you want to switch cloud providers, you might have to spend time configuring your software on a new operating system, which will inevitably lead to issues. The easiest transition would likely be to CentOS, the distro that Amazon Linux is based on.
Amazon doesn’t offer any kind of kernel live patching service, though they recommend using the third-party KernelCare, which costs $2 per server, per month.
CentOS, Red Hat Enterprise Linux, Fedora
These three distros all share communities, and are fairly similar to each other. Red Hat Enterprise Linux (RHEL) is a very popular distro for enterprise servers, but unlike most Linux flavors, it’s not free. Recently, Red Hat has started offering development-only builds of RHEL.
Fedora is the upstream source of Red Hat, meaning new features get implemented and tested in Fedora before making their way into RHEL. As such, the distro will be updated quite often, and is more “cutting edge” than a stable server distro.
CentOS is the downstream source of RHEL. It’s essentially RHEL’s free version, but it’s maintained by a separate team and is independent from Red Hat. If you’re looking for a free distro that isn’t Ubuntu, CentOS is the top contender. It’s used a lot less than Ubuntu, but is updated less frequently, which can be a good or bad thing in the cloud server world.
One major note about RHEL and CentOS is that they’re the only distro that officially supports cPanel, a popular web-hosting control panel. If you’re looking to use cPanel you’ll have to use CentOS, or try to run it in a Docker image, which is probably more trouble than it’s worth for an application designed to save you time.
Red Hat is the developer of Kpatch, a utility for kernel live patching. Kpatch is free, but it’s not automated, and requires you to manually apply patches when necessary. It works on RHEL and CentOS, as well as Debian.