How to Install WordPress on Ubuntu 24.04: The Ultimate Guide for Dedicated Servers

WordPress powers a massive portion of the internet, but standard shared hosting often crumbles under heavy traffic or resource intensive plugins. For serious projects whether it's a high traffic blog, an e-commerce giant, or a gaming community portal nothing beats the raw power and isolation of a Dedicated Server.

Install WordPress on Ubuntu

In this guide, we will walk you through installing WordPress on Ubuntu 24.04 LTS (Noble Numbat). We will use the industry-standard LAMP stack (Linux, Apache, MySQL, PHP) to ensure your Leo Servers dedicated machine runs WordPress with maximum efficiency.

What You'll Learn

Prerequisites

Before we begin, ensure you have the following:

  • A Dedicated Server running Ubuntu 24.04: This guide is optimized for bare metal performance. If you need powerful infrastructure, check out Leo Servers Dedicated and GPU Servers .

  • Root or Sudo Access: You will need full administrative privileges.

  • A Domain Name: Pointed to your serverโ€™s public IP address (e.g., yourdomain.com).

Step 1: Update Your System

On a fresh dedicated server, it is critical to ensure all system packages are up to date to guarantee security and stability.

SSH into your server and run:

bash

sudo apt update && sudo apt upgrade -y
                                

Step 2: Install the Apache Web Server

Apache is the "A" in the LAMP stack. On a dedicated server, Apache can be tuned to handle thousands of concurrent connections.

Install Apache:

bash

sudo apt install apache2 -y
                                

Enable and Start Apache: Ensure the web server starts automatically if the physical server is rebooted.

bash

sudo systemctl enable apache2
sudo systemctl start apache2
                                

Verify Installation: Visit http://your_server_ip in your browser. You should see the "Apache2 Ubuntu Default Page."

Step 3: Install and Secure the Database (MySQL)

WordPress needs a robust database. Since you are on a dedicated server, you have the full resources of the machine available for database queries, which significantly speeds up page loads.

Install MySQL Server:

bash

sudo apt install mysql-server -y
                                

Secure the Installation: Run the security script to remove insecure defaults.

bash

sudo mysql_secure_installation
                                
  • VALIDATE PASSWORD PLUGIN? Type N (unless you want strict enforcement).

  • Remove anonymous users? Y

  • Disallow root login remotely? Y

  • Remove test database? Y

  • Reload privilege tables now? Y

Step 4: Install PHP and Extensions

Ubuntu 24.04 includes modern PHP versions. We need to install PHP along with the specific modules WordPress requires to process images, handle XML, and connect to the database.

Install PHP:

bash

sudo apt install php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip -y
                                

Restart Apache:

bash

sudo systemctl restart apache2
                                

Step 5: Create a WordPress Database

Log in to MySQL:

bash

sudo mysql -u root -p
                                

Run the following SQL commands: (Replace your_strong_password with a secure password).

sql

-- Create the database
CREATE DATABASE wordpress_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

-- Create a user and grant permissions
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';

-- Apply changes and exit
FLUSH PRIVILEGES;
EXIT;
                                

Step 6: Download WordPress

Download the latest version:

bash

cd /tmp
wget https://wordpress.org/latest.tar.gz
                                

Extract and Move: Unzip the files and move them to the public web directory.

bash

tar -xzvf latest.tar.gz
sudo mv wordpress/* /var/www/html/
                                

Set Permissions: This ensures the web server can read and write files (essential for media uploads and plugin updates).

bash

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
                                

Step 7: Configure Apache for WordPress

To enable "Pretty Permalinks" (clean URLs like yourdomain.com/post-name rather than ?p=123), we must configure Apache.

Edit the default configuration:

bash

sudo nano /etc/apache2/sites-available/000-default.conf
                                

Add the <Directory> block: Insert the following inside the <VirtualHost> block:

apache

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    <Directory /var/www/html/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
                                

Save and exit (CTRL+O, Enter, CTRL+X).

Enable Rewrite Module and Restart:

bash

sudo a2enmod rewrite
sudo systemctl restart apache2
                                

Step 8: Finalize Installation

  • Open your browser and navigate to http://your_domain.com.

  • Select your language.

  • Enter the database details from Step 5:

    • Database Name: wordpress_db

    • Username: wp_user

    • Password: your_strong_password

    • Database Host: localhost

  • Run the installation and create your admin account.

Bonus: Secure Your Dedicated Server with SSL

For production sites, SSL is non-negotiable.

bash

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache
                                

Follow the prompts to auto-configure a free Let's Encrypt SSL certificate.

Conclusion

You have successfully installed WordPress on a powerful Ubuntu 24.04 environment. By using a dedicated machine, you have ensured your website has the dedicated RAM, CPU, and storage I/O needed to perform under pressure.

Looking for Bare Metal Power? Whether you need high performance GPU Servers for AI/Rendering, Gaming Servers for low latency hosting, or robust Dedicated Servers for enterprise web hosting, Leo Servers has the infrastructure you can rely on.

Have questions? Contact our support team for assistance with your Colocation or Dedicated Server needs.

Discover Leo Servers Dedicated Server Locations

Leo Servers servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.