In this article, we will install WordPress on Ubuntu 24.04 LTS using Nginx, MariaDB, and PHP 8.3.
Table of Contents
What is WordPress?
WordPress is a free and open-source content management system (CMS) that allows users to create websites, blogs, and online stores. It runs on PHP and uses MariaDB or MySQL as a database. With its vast collection of themes and plugins, WordPress is highly customizable, making it a popular choice for beginners and professionals alike.
Prerequisites:
- AWS Account with Ubuntu 24.04 LTS EC2 Instance.
- A non-root user with sudo privileges
Step #1:Update System Packages on Ubuntu 24.04 LTS
Before installing any software, ensure your package lists are up-to-date.
sudo apt update 
Step #2:Install Nginx Web Server on Ubuntu 24.04 LTS
Install the Nginx web server using the following command.
sudo apt install nginx -y

Start the Nginx web service using systemctl command-line tool.
sudo systemctl start nginx
Enable the Nginx web service to start automatically at boot time.
sudo systemctl enable nginx
After installation, check the status of the Nginx service to ensure it’s running.
sudo systemctl status nginx
Open a web browser and access the nginx using http://<EC2-PUBLIC-IP>. You should see the default NGINX welcome page.

Step #3:Install MariaDB (Database Server) on Ubuntu 24.04 LTS
MariaDB is an open-source relational database management system that will store your WordPress data.
Install MariaDB server with apt package manager.
sudo apt install mariadb-server 
Start the MariaDB service using systemctl command-line tool.
sudo systemctl start mariadbEnable the MariaDB service with the following commands.
sudo systemctl enable mariadbView the MariaDB service is running by checking its status.
sudo systemctl status mariadb

Step #4:Create a WordPress Database & User on Ubuntu 24.04 LTS
Now that MariaDB is installed, we need to create a database and a user for WordPress.
1. Log in to the MariaDB Shell:
sudo mariadb -u root 
2. Create a Database for WordPress:
CREATE DATABASE wordpress;3. Create a User for WordPress:
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'YourStrongPassword';Replace YourStrongPassword with a strong password:
4. Grant Permissions to the User:
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
5.Flush privileges to reload the privilege tables in the database :
FLUSH PRIVILEGES;6. Exit MariaDB:
Exit;

Step #5:Install PHP 8.3 & Required Extensions on Ubuntu 24.04 LTS
WordPress requires PHP to function properly.
We’ll install PHP 8.3 along with the necessary extensions.
sudo apt install php php-cli php-common php-imap php-fpm php-snmp php-xml php-zip php-mbstring php-curl php-mysqli php-gd php-intl
Verify PHP Installation:
php -v

Step #6:Download and Install WordPress on Ubuntu 24.04 LTS
Let’s download and configure WordPress.
1.Navigate to the Web Directory:
cd /var/www/html/
2. Download the Latest WordPress Version:
sudo wget https://wordpress.org/latest.tar.gz

3. Extract the Downloaded WordPress Package
sudo tar -xvzf latest.tar.gz
4.Remove the Downloaded Archive to Save Space:
sudo rm latest.tar.gz
5.Change Ownership of WordPress Files
sudo chown -R www-data:www-data /var/www/html/wordpress

6.Set Proper File Permissions
sudo chmod -R 755 /var/www/html/wordpress

Step #7:Configure Nginx for WordPress on Ubuntu 24.04 LTS.
Create a new Nginx configuration file:
sudo nano /etc/nginx/sites-available/wordpress.conf

Paste the following content (replace your_server_ip with your actual IP address):
server {
listen 80;
server_name your_server_ip;
root /var/www/html/wordpress;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Save and exit (CTRL + X, then Y, then ENTER).
Enable the WordPress Configuration in Nginx
sudo ln -s /etc/nginx/sites-available/wordpress.conf /etc/nginx/sites-enabled/
Remove the Default Nginx Configuration
sudo rm /etc/nginx/sites-enabled/default

Test the Nginx configuration:
sudo nginx -t
Restart Nginx
sudo systemctl restart nginx

Step #8:Configure WordPress to connect with database
Now that WordPress files are in place, we need to configure WordPress to connect to the database.
1. Create the wp-config.php File
WordPress provides a sample configuration file (wp-config-sample.php). We need to copy it and rename it to wp-config.php:
sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
2. Edit wp-config.php file
Next, we edit the wp-config.php file to update the database details:
sudo nano /var/www/html/wordpress/wp-config.php

Locate the following lines and update them with your database credentials:
define('DB_NAME', 'your_database');
define('DB_USER', 'your_database_user');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost'); - DB_NAME → The database name you created in MariaDB.
- DB_USER → The username created for the database.
- DB_PASSWORD → The password for that database user.
- DB_HOST → Leave as
localhostif MariaDB is running on the same server.

Save and exit (CTRL + X, then Y, then ENTER).
Step #9:Complete WordPress Installation in Browser
Now that WordPress is configured, we can complete the installation through the web browser.
Open Your Browser And Go to your server’s IP address
http://EC2 _public_ip_addrYou will see the WordPress setup page. Choose your preferred language and click Continue.

Enter Site Information
Fill in the required details:
- Site Title – Enter a name for your website.
- Username – Create a login username for WordPress.
- Password – Set a strong password for your WordPress admin account.
- Your Email – Enter an email address for password recovery and notifications.
Click Install WordPress to proceed.

Once the installation is complete, click Log In.

Enter the username and password you created and click on Log In button.

After logging in, you will be redirected to the WordPress dashboard, where you can manage your website, install themes, add plugins, and customize settings.

Conclusion:
We have successfully installed WordPress on Ubuntu 24.04 using Nginx, MariaDB, and PHP 8.3. We covered setting up the necessary packages, configuring the database, downloading WordPress, and setting up Nginx as a web server. After completing the installation, you can now access the WordPress dashboard to start building and customizing your website.
Related Articles:
Setup Job Board in WordPress using WP Job Manager Plugin
Reference:
Install WordPress on Ubuntu official page