How To Install WordPress On Ubuntu

In this blog post, we will guide you through the process of installing WordPress on an Ubuntu server. By following these simple steps, you can have your own WordPress website up and running in no time.


Before we begin, make sure you have the following installed on your Ubuntu server:

  • Apache web server
  • MySQL or MariaDB
  • PHP 7.2 or higher

Step 1: Downloading WordPress

First, download the latest version of WordPress from the official website:


Once the download is complete, extract the WordPress files:

            tar xf latest.tar.gz

Step 2: Creating a Database for WordPress

Next, let’s create a new MySQL or MariaDB database and user for WordPress. Log in to your MySQL or MariaDB server:

            mysql -u root -p

Create a new database and user:

            CREATE DATABASE wordpress_db;
            GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost' IDENTIFIED BY 'your_password';

Remember to replace wordpress_db, wordpress_user, and your_password with your preferred database name, username, and password.

Step 3: Configuring WordPress

Now, navigate to the extracted WordPress folder and copy the sample configuration file:

            cd wordpress
            cp wp-config-sample.php wp-config.php

Edit the wp-config.php file to update the database details:

            nano wp-config.php

Replace the following lines with your database information:

            define( 'DB_NAME', 'wordpress_db' );
            define( 'DB_USER', 'wordpress_user' );
            define( 'DB_PASSWORD', 'your_password' );

Step 4: Copying WordPress Files to the Web Server

Move the WordPress files to the Apache web server root directory:

            sudo cp -R * /var/www/html/

Step 5: Setting up Permissions and .htaccess

Set the correct ownership and permissions for the WordPress files:

            sudo chown -R www-data:www-data /var/www/html/
            sudo find /var/www/html/ -type d -exec chmod 755 {} \;
            sudo find /var/www/html/ -type f -exec chmod 644 {} \;

Create a blank .htaccess file in the web server root directory:

            sudo nano /var/www/html/.htaccess

Save and close the file.

Step 6: Completing the Installation

Finally, open your web browser and navigate to your server’s IP address or domain name. Follow the on-screen instructions to complete the WordPress installation.

Congratulations! You have successfully installed WordPress on your Ubuntu server. You can now start building and customizing your website.