How to install WordPress on Debian 9

This tutorial is going to show you how to install WordPress on Debian 9. WordPress is the most popular CMS (Content Management System) out there. With wordpress, we can easily create a nice and powerful blog or websites within a minute. It is great to have WordPress combined with Debian as the base operating system since Debian 9 is a stable operating system.

Steps to install WordPress on Debian 9

Before proceeding to the installation, WordPress needs a working web server with correct configuration. First, make sure you have installed LAMP (Linux Apache MySQL PHP) on Debian 9. You can read my LAMP Installation Tutorial on Debian 9.

Step 1. Install LAMP Server

Step 2. Download WordPress

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

Now extract the file

tar -xvf latest.tar.gz

Move WordPress directory to web server

mv wordpress /var/www/html/
chown -R www-data:www-data /var/www/html/

Step 3. Create new database

Log in to MySQL Server

mysql -u root -p

And then use the following example to get started.

root@debian:/tmp# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.1.23-MariaDB-9+deb9u1 Debian 9.0

Copyright (c) 2000, 2017, 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;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE USER 'wordpress'@'localhost' IDENTIFIED BY '12345';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO 'dhani'@'localhost' IDENTIFIED BY '12345';
Query OK, 0 rows affected (0.00 sec)

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

MariaDB [(none)]> EXIT;
Bye

Step 4. Modify WordPress Configuration

cd /var/www/html/wordpress/
cp wp-config-sample.php wp-config.php

Now open and edit the file

nano wp-config.php

Find and edit the following section. Change the red text with the actual MySQL database, user and password created on the previous step

// ** 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’, ‘dhani‘);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘12345‘);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

Close and save the file.

Step 5. Configure WordPress Installation

Now open web browser and we will configure WordPress installation.

http://ip-address/wordpress

Change ip-address with your actual Debian ip address.

Finally, WordPress is ready

Admin

Leave a Reply

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