Short answer: Use CentOS 7 or Ubuntu 18.04. Flip a coin, both are fine.
A Linux distribution combines the Linux operating system kernel with a collection of software packages. 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. There are two main families, RedHat and Debian. RedHat traditionally comes from the corporate world, and Debian from the free software community.
RedHat was the first major commercial Linux distribution, 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 CentOS. There was always a bit of a delay with releases, but it worked fine. 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 the first popular non-commercial Linux distribution. 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, there was nobody who cared that much, and it 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 currently run CentOS. If an enterprise needs commercial support, then they pay for RedHat. Many commercial software packages, e.g. Oracle, were certified and supported on RedHat. Most dedicated servers run CentOS by default, and it may be the only supported distribution. 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 not clear, so it's a bit of a moving target. You can't practically run Amazon Linux outside of Amazon.
Ubuntu made deals with various partners, e.g. Amazon. It is a first class supported distribution on AWS, and is very popular there. It's also popular for OpenStack. 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. My preferences have shifted back and forth over the years. We manage hundreds of virtual and dedicated servers, and we are currently about 75% CentOS and 25% Ubuntu.
My current preference is 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, 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 we use. You can often download random packages off the net, but it feels a bit questionable sometimes.
The long term support for a server is much more important in a bare-metal world, where upgrading can be traumatic. In the cloud, it's easy for us to set up a new instance with the latest OS, verify that it works, then switch. We do use a number of dedicated servers for performance, however.
Ubuntu is also a good choice. 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. It is well supported in cloud environments. Its business model is a bit of a question mark, though it's doing ok right now.
Debian is a high quality distribution, but has always suffered from the lack of a revenue model. The community can occasionally be dysfunctional, driven by politics, the "United Nations" of free software. These days I run macOS for my desktop, but if I was running Linux, I would probably run Debian.