in ,

Install WordPress On Arch Linux VPS… Quick Start Guide

Arch Linux logo

In this lab, we will try to install LAMP Stack on Arch Linux, which includes Apache web server, Mysql Database, and PHP then will install our WordPress Blog CLI Using the WP-CLI command.

We will:

  1. Update Our Arch Linux.
  2. Install Apache And Configure Our WordPress Blog Virtual Host.
  3. Install MariaDB.
  4. Install PHP.
  5. Install WordPress.

Step1: Update Arch Linux

# pacman -Syu

Step2: Install Apache And Configure Our WordPress Virtual Host

Installing And Enable Apache

# pacman -Syu apache
# systemctl enable httpd

Add A New User To Arch Linux System

We will create a new website user named “wordpress“, with the home directory path /home/wordpress, and password using the following command.

Of course, you can change the values with green color and bold as you need, and set a complex password.

# useradd -d /home/wordpress -m wordpress -p password

Add our wordpress user to the Apache system Group as the following

# usermod -a -G http wordpress

Configure A Virtual Host For Our WordPress Blog

Create Our Public HTML document root directory

# mkdir -p /home/wordpress/public_html

Create The Virtual Host Config File wordpress.conf in the following path and with the below configs

# vim /etc/httpd/conf/extra/wordpress.conf
## Repace the domain name with yours
## Apache 2.4 VirtualHost
<VirtualHost *:80>
      DocumentRoot /home/wordpress/public_html
      ServerAlias *
      ErrorLog "/var/log/httpd/"
      CustomLog "/var/log/httpd/" common
<Directory "/home/wordpress/public_html">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted

While applying this lab to your project you will need to set up your domain name, and server public IP-Address.

Step3: Install And Configure MariaDB

Install MariaDB Server And Client

# pacman -Syu mariadb mariadb-clients libmariadbclient
# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
# systemctl enable mysqld.service
# systemctl start mysqld.service

Configure MariaDB Basic Security

Run the mysql_secure_installation command to set up basic MariaDB security settings.

when running the command mysql_secure_installation we need to Interact with the outputs as the following:

  • Enter current password for root (enter for none): [Press Enter With Empty Value]
  • Switch to unix_socket authentication [Y/n] [Answer n]
  • Change the root password? [Y/n] [Answer Y & Enter your database root password]
  • Remove anonymous users? [Y/n] [Answer Y]
  • Disallow root login remotely? [Y/n] [Answer Y]
  • Remove test database and access to it? [Y/n] [Answer Y]
  • Reload privilege tables now? [Y/n] [Answer Y]
# mysql_secure_installation


In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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 environment.

Remove anonymous users? [Y/n] y
 ... Success!

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? [Y/n] y
 ... Success!

By default, MariaDB 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 environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Create A New Database And Database User.

Log in to the database server using the database root user credential, we set in the previous step.

So we can create our blog database wordpress_db with the user wordpress_db_user, and its wordpress_db_password password, like the following

# mysql -uroot -pPassWord
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 52
Server version: 10.5.12-MariaDB-0+deb11u1 Debian 11

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.000 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON drupal.* TO 'wordpress_db_user'@'localhost' IDENTIFIED BY 'wordpress_db_password';
Query OK, 0 rows affected (0.001 sec)

Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit;

Step4: Install PHP And WP-CLI

Install PHP

# pacman -Syu php php-apache php-gd

Enable Mysqli And GD Extensions

Edit the file php.ini and uncomment the bellow 2 lines to enable the required extensions

# vim /etc/php/php.ini


Install WP-CLI The Command-line Interface For WordPress

# curl -O
# php wp-cli.phar --info
# chmod +x wp-cli.phar
# mv wp-cli.phar /usr/local/bin/wp

Step5: Install WordPress

We will install our WordPress Blog using WP-CLI as the following

PS: as we are in the root terminal, we will append the suffex “–allow-root” flag at the end of each WP-CLI command.

We will do:

  1. Go To Web Public HTML Directory
  2. Download The latest WordPress core release.
  3. Adjustment The WordPress Config File w-config.php, With the Database and the WebSite Information
  4. Install The WordPress

Do not forget to set your admin username and password while installing WordPress in the next commands…

As the following:

# cd /home/wordpress/public_html
# wp core download --allow-root
Downloading WordPress 5.9.2 (en_US)...
md5 hash verified: b5e9c3b8dfd767d55c3797c2eae0f57d
Success: WordPress downloaded.

# wp core config --dbname=wordpress_db --dbuser=wordpress_db_user --dbpass=wordpress_db_password --dbhost=localhost --dbprefix=wp_ --allow-root
Success: Generated 'wp-config.php' file.

# wp core install --url="" --title="WordPress ArchLinux Lab" --admin_user="Admin" --admin_password="AdminPassWord" --admin_email="" --allow-root
Success: WordPress installed successfully.

Step6: Set The WordPress File Permissions

Change the public_html directory and contents owner and permissions

Go to the domain user home directory /home/wordpress and run the following commands

# cd /home/wordpress
# chown -R wordpress.http public_html
# chmod -R 2750 public_html
# chmod -R 2640 public_html/wp-config.php
# chmod -R 2770 public_html/wp-content/

Step6: Adjustment Apache For PHP And Virtual Host

Edit the Apache configuration file /etc/httpd/conf/httpd.conf

  1. Enable the PHP module.
  2. Add PHP handler.
  3. Enable Prefork.
  4. Add the Vitualhost and Apache module config files.

Enable The PHP Module

# vim /etc/httpd/conf/httpd.conf

Append the below lines at the end of LoadModule List

LoadModule php_module modules/
AddHandler php-script .php

Enable Prefork The Apache Multi-processing Module

In the LoadModule List at the Apache configuration file /etc/httpd/conf/httpd.conf

Comment the mpm_event_module line, then allow the mpm_prefork_module line like the following

#LoadModule mpm_event_module modules/
LoadModule mpm_prefork_module modules/

Append the PHP And WordPress Configuration Files To The  Apache Config

Append the following lines at the end of the Include list in the Apache config file

Include conf/extra/php_module.conf
Include conf/extra/wordpress.conf

Enable Mod_Rewrite And Mod_Alias

From the Apache config file uncomment the following LoadModule lines.

LoadModule alias_module modules/
LoadModule rewrite_module modules/

After Restart Apache

# systemctl restart httpd

Access your blog using your browser with domain name or server public IP-Address

wordpress debian install

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

      Install WordPress On Debian 11

      Installing WordPress On Debian 11 VPS.. Quick Start Guide

      Install Odoo 15 On Ubuntu 20.04LTS

      Install Odoo 15 The OpenERP On Ubuntu 20.04LTS… Quick Start Guide