Introduction
In this tutorial you will learn how to install WordPress on Arch Linux. WordPress is a free and open source Content Management System, built on PHP and MySQL. It provides over 30,000 plugins for easy customization of appearance and functionality. WordPress is the most popular blogging platform, estimated to be running on 60 million sites and seen by tens of millions of people every day.
Prerequisites
• This tutorial assumes that you already have LAMP (Linux, Apache, MySQL and PHP) installed in your server. If you don’t have LAMP stack on your sever, you can find the steps for doing the set up here.
• The user should have root privileges so as to have administrative capabilities and permissions. You can check out how to grant root privileges for user here.
Now that you have the user with root privileges and mandatory software, let’s get down to installing WordPress.
Download the WordPress Package
Before executing the download, verify whether wget is already installed on your server.
sudo pacman -S wget
After verifying, you can download the WordPress package directly from wordpress.org.
wget http://wordpress.org/latest.tar.gz
You will have the WordPress package in zipped format inside user’s home directory. Unzip it using the command given below.
tar -xzvf latest.tar.gz
Create Database and User for WordPress
Once the WordPress files are unzipped, you can locate them under wordpress directory within home directory.
Now, log into MySQL shell using MySQL root password.
mysql -u root –p
Once logged in, you have to create a wordpress database and a user in that database. You can set a password for the new user. Find the MySQL commands for setting up the database and the user given below.
For creating the database:
CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)
Note: Here, I have given the name wordpress for the database. You can give any name you wish. However, a unique name is recommended.
For creating the user:
CREATE USER [email protected];
Query OK, 0 rows affected (0.00 sec)
For setting the password for the user:
SET PASSWORD FOR [email protected]= PASSWORD("yourpassword");
Query OK, 0 rows affected (0.00 sec)
Note: Here, I have given the name wordpressuser1 for the newly created user. You can set password as you prefer.
Now, you can grant all the privileges for the new user. Without proper privileges, you may end up with installation and database permission issues.
GRANT ALL PRIVILEGES ON wordpress.* TO [email protected] IDENTIFIED BY 'yourpassword';
Query OK, 0 rows affected (0.00 sec)
Finish up this step by refreshing and exit out of the shell.
FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
Exit
Configure the WordPress Installation
Here we are going to set up WordPress and link it to the database that we created for it.
For that, first you need to locate the sample wordpress configuration file from the wordpress directory and copy it to a new file which you can edit later. Thus a new usable wordpress config will be created.
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
Open the wordpress config for editing.
sudo nano ~/wordpress/wp-config.php
Search for the code snippet that contains MySQL settings and update the name of database, username and password correctly.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpressuser1');
/** MySQL database password */
define('DB_PASSWORD', 'yourpassword');
After updating the fields, save and exit.
Copy the WordPress Files
We need to move the unzipped wordpress files to website’s root directory.
sudo cp -r ~/wordpress/* /srv/http/
Now, let’s verify if PHP can make its connection to MySQL. For that, open the file named php.ini and delete the semi-colon of the MySQL extension.
sudo nano /etc/php/php.ini
Line of code before deleting semi colon:
;extension=mysql.so
Line of code after deleting the semi-colon:
extension=mysql.so
Restart Apache to bring in all the changes that we have been doing.
sudo systemctl restart httpd
That’s it for the WordPress configuration. Now, you will be able to proceed with the easy online installation of WordPress.
Access and Finalize the WordPress Installation
This is the last stage of your WordPress installation. Open your browser and access the page by tailoring your site’s IP address or domain with /wp-admin/install.php. The link may look like this:
www.example.com/wp-admin/install.php
The WordPress online installation page will be opened and it should look similar to this:
Fill out the required fields in the form and finalize the WordPress installation.