How to Install WordPress on Ubuntu 24.04

WordPress is one of the most popular website-building tools available out there. It is a simple way to get your online presence and perfect for those who do not know how to code and want a simple and effective way to share and build your story on the internet.

Prerequisites:

Creating Database

Log into MySQL with the following command.

mysql -u root -p

Inside the MySQL shell, run the following commands to create a database and user for WordPress:

First, we'll create a new database.

CREATE DATABASE wordpress_db;

Next, create a new MySQL user account that we will use to operate on WordPress's new database,

CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';

Replace wordpressuser and password with your desired username and password.

Link the user and DB together by granting our user access to the database.

GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost';

Flush the privileges so that MySQL knows about the user permissions we just added.

FLUSH PRIVILEGES;

Exit out of the MySQL command prompt by typing.

exit

Output:

root@vps:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 45
Server version: 10.11.6-MariaDB-2 Ubuntu 24.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE wordpress_db;
Query OK, 1 row affected (0.004 sec)

MariaDB [(none)]> CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost';
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> exit
Bye

Download and install WordPress

You can visit the official Wordpress site to get to know the latest version available for download and also for more information on requirements of the server.

Download the latest version of WordPress by using the below command,

wget -O /tmp/wordpress.tar.gz https://wordpress.org/latest.tar.gz

Unzip the downloaded WordPress file.

tar -xzvf /tmp/wordpress.tar.gz -C /var/www/

Change the permission of the site directory.

chown -R www-data.www-data /var/www/wordpress

Configure WordPress

Open your web browser and enter the following URL in the address bar:

http://IP_ADDRESS/wordpress

Replace 'IP_ADDRESS' with the actual IP address of your server. This will take you to the WordPress site hosted on your server.

Start a WordPress installation by selecting the language of your choice

images

Click on the "Let's go" button to proceed to the next step.

images

Enter the details of Database that was created earlier.

images

Click on Run the Insallation

images

Next after installation, you will be prompted to enter the site details and also creating a new User for accessing the admin dashboard.

images

Once the details are confirmed, you will be acknowledged with Success message.

images

Login with the new User and Password and you will be presented to the WordPress dashboard. Where you can further configure the site as per your requirements.

images

This concludes our topic of installing WordPress on Ubuntu 24.04 using Apache as a web server.