How to Install WordPress on Arch Linux

WordPress is a popular content management system that allows you to create and manage websites without any coding knowledge. In this tutorial, we will guide you through the process of installing WordPress on Arch Linux.

Prerequisites

Before you begin, ensure that you have the following prerequisites:

Step 1: Install Apache Web Server

The first step is to install the Apache web server on your Arch Linux system. You can do this by running the following command in your terminal:

sudo pacman -S apache

Once the installation is complete, start the Apache web server by executing the following command:

sudo systemctl start httpd.service

You can verify whether Apache is running or not by visiting http://localhost/ in your web browser.

Step 2: Install PHP and Required Extensions

WordPress is written in PHP, so you need to install PHP and some required extensions to run WordPress. You can install PHP and its extensions by running the following command:

sudo pacman -S php php-apache

Once the installation is complete, enable the PHP module in Apache by running this command:

sudo nano /etc/httpd/conf/httpd.conf

Look for the following line in the file:

#LoadModule php7_module modules/libphp7.so

Uncomment this line by removing the (#) and save the file.

Next, restart the Apache web server to apply changes by executing the following command:

sudo systemctl restart httpd.service

Step 3: Install MySQL Database Server

WordPress requires a database to store its data. You can install the MySQL database server by running the following command:

sudo pacman -S mariadb

Once the installation is complete, start the MySQL service by running this command:

sudo systemctl start mariadb.service

Run the MySQL secure installation script to secure the installation and set up the root user password:

sudo mysql_secure_installation

Step 4: Create a MySQL Database and User for WordPress

After securing the MySQL installation, log in to the MySQL server by executing this command:

sudo mysql -u root -p

When prompted, enter the root user password that you set during the secure installation.

Create a new database for WordPress and a user to access that database, running the following commands one by one:

CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
EXIT;

Replace password with a strong password for the user.

Step 5: Download and Install WordPress

You can download the latest version of WordPress from the WordPress official website by executing the following command:

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

Extract the downloaded archive to the Apache web root directory:

sudo tar -xvzf latest.tar.gz -C /srv/http/

Now, we need to set permissions for the WordPress directory by running the following command:

sudo chown -R http:http /srv/http/wordpress

Step 6: Configure WordPress

Copy the WordPress sample configuration file to create a new configuration file:

cp /srv/http/wordpress/wp-config-sample.php /srv/http/wordpress/wp-config.php

Open the wp-config.php file in your preferred file editor:

sudo nano /srv/http/wordpress/wp-config.php

Update the following lines in this file:

define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');

Update the password to the one you created for the user in step 4.

Step 7: Access WordPress Installation Wizard

Open your web browser and enter the following URL:

http://localhost/wordpress

The WordPress installation wizard will appear. Follow the steps and enter the required information to complete the installation.

Conclusion

You have now successfully installed WordPress on your Arch Linux system. You can now use the platform to create and manage your website or blog.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!