WordPress is a popular content management software(CMS) written in PHP programming language. Due to popularity WordPress captures at least 43 percent market share of all the websites. One of the reason why it is popular is because it is completely free and easy to setup and manage.
WordPress is not only popular for blogging but it is also being used for e-commerce, forums, etc.
In this tutorial we will guide your setup and install WordPress using Ubuntu 22.04.
Let us start.
1 Updating the System
Let us first update our system.
sudo apt update && apt upgrade
2 Installing PHP and PHP extension
Let us install PHP and PHP extensions needed to run WordPress properly.
PHP 8.1.2 (cli) (built: Jul 21 2022 12:10:37) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies
3 Database Installation and Configuration
Since WordPress is built with PHP the database of choice should be MySQL or MariaDB and in this tutorial we will install MariaDB.
sudo apt install mariadb-server -y
Let us enable and start MariaDB.
systemctl enable mariadb --now
Check the status of MariaDB database.
sudo systemctl status mariadb
● mariadb.service - MariaDB 10.6.7 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-09-03 12:32:57 EDT; 2min 13s ago
Main PID: 123075 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 9 (limit: 9456)
Let us secure the MariaDB database.
Securing the MySQL server deployment.
Enter password for user root:
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.
Estimated strength of the password: 50
Change the password for root ? ((Press y|Y for Yes, any other key for No) : N
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
- Dropping test database...
- Removing privileges on test database...
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
Restart MariaDB service.
sudo systemctl restart mariadb
Let us create database and database user for our WordPress site.
mysql -u root -p
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> grant all privileges on wordpress.* to 'wordpress_user'@'localhost' identified by 'your_secure_password';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
Please don’t forget to change ‘your_secure_password‘ to your secure password.