How to Install WordPress on Amazon Linux 2

Amazon Linux 2 is a common choice for hosting WordPress on AWS EC2 instances — it's lightweight, well-supported, and integrates cleanly with other AWS services. But the installation process involves several moving parts, and where things go smoothly (or sideways) usually depends on your starting configuration, technical comfort level, and how you plan to use the server long-term.

Here's a clear walkthrough of what the process involves, what varies by setup, and what to think through before you begin.

What You're Actually Installing

WordPress isn't a standalone app you drop onto a server. It's a PHP-based application that requires a working web stack underneath it:

  • A web server (Apache or Nginx) to handle HTTP requests
  • PHP to process WordPress's application logic
  • A database (typically MySQL or MariaDB) to store content, users, and settings

On Amazon Linux 2, this stack is commonly assembled using the LAMP stack (Linux, Apache, MySQL, PHP) or the LEMP stack (Linux, Nginx, MariaDB, PHP). Amazon Linux 2 includes its own package management system (yum) and ships with the Amazon Linux Extras repository, which provides newer PHP versions outside the default package set.

Step-by-Step: The Core Installation Process

1. Update Your System

Before installing anything, update existing packages: