Linux distributions, OS images and ISOs
Before launching your self-hosted WordPress server, you'll need to decide which Linux distribution you're going to use. This will determine things like the package manager and available package versions, update cadence, security posture, tooling and more.
There is no perfect distribution for WordPress, and it ultimately comes down to personal preferences. If you've been a CentOS or Fedora user for years, there is no reason to switch to Debian or Ubuntu, and vice versa. Unless, of course, you're looking to try something new.
Pre-configured vs custom OS images
Most dedicated and VPS hosting providers will have plenty of distro options available. These are pre-configured operating system images, designed for and tested with the specific provider's hardware and software stacks.
For example, pre-configured images (sometimes referred to as cloud images) use
a templating tool such as cloud-init
to configure things like private and
public networking, DNS, SSH access using a key, non-root user, custom package
mirrors, helper packages and more. Some hosting providers will even allow you
to use your own cloud-config
script for further configuration.
Custom images (typically .iso files) can often be uploaded and booted from, too, allowing you to use any distribution and version you like. You'll have to configure some things yourself, though most distributions nowadays ship with an installer that can quickly determine the correct settings.
Using custom OS images gives you greater flexibility, usually at the expense of ease, predictability, and stability of pre-configured ones. I always recommend going for pre-configured images when your OS flavor is available.
LTS vs bleeding edge
Most Linux distributions offer an LTS (long-term support, long-life, etc.) version. This typically lasts five years, with a further paid option to extend to a whopping 10 years or more. Non-LTS versions usually stop receiving updates after about a year.
The biggest downside of LTS versions is that they do have some version lag in various packages, meaning you won't get a major version upgrade until you upgrade to the next LTS release. This is an important consideration in the context of WordPress, primarily because of PHP.
PHP and WordPress versions
PHP moves quite fast, seeing one major release every year on average. For example, at the time of writing, Ubuntu 22.04 LTS, which is officially supported until April 2027, ships with PHP 8.1, while the latest stable PHP version is 8.4, with 8.5 expected within the next few months.
WordPress core currently supports PHP versions 7.2 through 8.3, with beta/experimental support for PHP 8.4. The recommended version is PHP 8.3, so using the official packages from an LTS release, you may get significantly behind WordPress' recommended version.
On the other hand, if you pick Debian 13 (which has five years of support), it installs PHP 8.4, which, at the time of writing, is labelled as beta/experimental for WordPress, and will very likely break some older plugins and themes.
Note that while not very common, some OS distributions may have multiple officially supported versions, with the ability to install parallel packages as well.
It is much easier (and safer) to maintain PHP from the official OS packages, however there are ways to use non-official or backport packages to get any supported PHP version you like (even multiple versions simultaneously), on any OS distribution and version.
I go over some of these techniques in the advanced section. However, for simplicity, I do recommend sticking to the official packages when possible. Here's a list of PHP versions provided as official packages in some of the popular Linux distributions:
- PHP 8.4: Ubuntu 25.04, Debian 13, Amazon Linux 2023, Fedora 42
- PHP 8.3: Ubuntu 24.04, RHEL 9/10 and equivalent, Rocky 10, Alma 10, CentOS Stream 9, Amazon Linux 2023
- PHP 8.2: Debian 12, RHEL 9, CentOS Stream 9, openSUSE Leap 15, SLES 15, Amazon Linux 2/2023
- PHP 8.1: Ubuntu 22.04, RHEL 9, CentOS Stream 9, Amazon Linux 2/2023
Last update: August 25, 2025.
Upgrades and migrations
Don't worry about making the wrong decision when it comes to Linux distributions. You can always start fresh, especially in a VM environment. If you follow this course, you will have the knowledge and skills to not only upgrade PHP and the OS packages, but also migrate between distributions and servers.
Sticking to an LTS/Long-life release will help significantly minimize manual upgrade work and any potential service disruption that comes with it. The endoflife.date website is a great resource for identifying end-of-life (EOL) and support information for a wide variety of operating systems and applications.
Ubuntu 24.04
In this course I'll be using Ubuntu 24.04. It's the latest LTS release of one of the most popular and widely supported Linux distributions. It comes with PHP 8.3 from the official packages, along with MariaDB 10.11 and Nginx 1.24.
Most of the commands, techniques and configuration in the following lessons will work with other versions of Ubuntu, as well as Debian and other Debian-based distributions. If you're having trouble with any other Linux flavor, try our Discord server (for members only).