If you’re looking to host your own website, Amazon Linux 2 is a secure and stable platform that works perfectly with WordPress. In this guide, we’ll walk you through how to install WordPress on an Amazon EC2 instance running Amazon Linux 2.
What You’ll Need:
- An AWS EC2 instance with Amazon Linux 2
- A domain name (optional, but helpful)
- Access to the instance via SSH
- A basic understanding of terminal commands
Step 1: Update the System
First, SSH into your EC2 instance and update all packages:

Step 2: Install Apache Web Server
Apache will serve your WordPress site to visitors.

Step 3: Install PHP and Required Modules
WordPress needs PHP to function properly.

Step 4: Install and Configure MariaDB (MySQL)
WordPress uses a MySQL-compatible database.

When prompted:
- Set a root password
- Remove anonymous users
- Disallow remote root login
- Remove test databases
Step 5: Create a WordPress Database
Login to MySQL:

Step 6: Download and Configure WordPress
Download WordPress:


Step 7: Complete Installation via Browser
Open your browser and navigate to:

Final Tips
- SSL: Use Let’s Encrypt or AWS Certificate Manager for HTTPS.
- Security: Use a firewall and limit SSH access.
- Backups: Automate your backups using AWS tools or WordPress plugins.
Wrapping Up
Installing WordPress on Amazon Linux 2 is a solid choice for performance and reliability. By following this guide, you’ll have a fully working WordPress site ready to customise.