How to Install WordPress Alongside LAMP on Debian 10

First released in 2003, WordPress has grown to become one of the leading CMS systems in the internet, accounting for over 30% of the market share. WordPress is a free and opensource CMS that is written using PHP and uses MySQL as its database.

In this tutorial, you will learn how to install WordPress on Debian 10 Buster.


Before we begin, perform a flight check and ensure that you have the following installed.

  1. Install LAMP on Debian 10 Server.
  2. A regular user with sudo privileges.

Step 1: Creating a Database for WordPress

To start off, we shall begin by creating a MySQL database for WordPress, which comes with numerous files which require a database to accommodate them.

$ sudo mysql -u root -p

This prompts you to type the root Password that you specified when securing the MySQL database server during installation. Type the correct password and press ENTER to access the MySQL shell.

Next, we are going to create a database called wordpress_db. Feel free to play around with any name. To create the database run:

mysql> CREATE DATABASE wordpress_db;

Next, create a database user and grant him all the permissions to the database as follows.

mysql> GRANT ALL ON wordpress.* TO 'wordpress_user'@'localhost' IDENTIFIED BY 'password';

Remember to replace the ‘password‘ string with your own strong password. To save the changes, issue the command.


Finally, exit MySQL by executing the command.

mysql> EXIT;

A summary of the command is as shown.

Create WordPress Database on Debian

Create WordPress Database on Debian

Step 2: Installing Additional PHP Extensions

WordPress requires a pack of additional plugins to function without any problems. With that in mind, proceed and install the extra PHP extensions as shown.

$ sudo apt update
$ sudo apt install php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
Install PHP Extensions for WordPress

Install PHP Extensions for WordPress

To effect the changes, restart the Apache web server as shown below.

$ sudo systemctl restart apache2

Step 3: Install WordPress on Debian 10

With the database fully configured, we are now going to download and install the WordPress on the Apache web root directory.

$ sudo cd /var/www/html/

Using curl command, proceed and download the WordPress tarball file.

$ sudo curl -O
Download WordPress on Debian

Download WordPress on Debian

Next, proceed and extract the WordPress tarball file as shown.

$ sudo tar -xvf latest.tar.gz

This will yield a folder labelled wordpress. This folder contains all the WordPress configuration files. Once extracted, it is safe to delete the WordPress tarball file.

$ sudo rm latest.tar.gz

Step 4: Configure WordPress on Debian 10

In this step, we are going to modify the WordPress folder in the web root folder. But before we do so, we need to modify file ownership and permissions. We are going to assign file ownership to all the files in the wordpress directory using the command.

$ sudo chown -R www-data:www-data /var/www/html/wordpress

Next, assign the correct permissions as shown in the commands below.

$ sudo find /var/www/html/wordpress/ -type d -exec chmod 750 {} \;
$ sudo find /var/www/html/wordpress/ -type f -exec chmod 640 {} \;

Additionally, you also need to rename the sample configuration file in wordpress directory to a filename it can read from.

$ cd wordpress
$ sudo mv wp-config-sample.php wp-config.php

Next, using your favorite text editor, open the wp-config.php file. In this case, I will use the vim text editor.

$ sudo vim wp-config.php

Scroll down and locate the MySQL settings section and be sure to fill with the corresponding database details a specified when creating the WordPress database as shown below.

Set MySQL Settings for WordPress

Set MySQL Settings for WordPress

Save and exit the configuration file.

Step 5: Securing WordPress Installation on Debian 10

Moreover, we need to generate security keys to provide additional security to our WordPress installation. WordPress provides an automatic generator for these keys to eliminate the need of generating them by ourselves.

To generate these values from WordPress secret generator, run the command.

$ sudo curl -s

The command generates output as shown. Note that in your case, this code will be different.

define('AUTH_KEY',         'fmY^[email protected];R|+=F P:[email protected]{+,;dA3lOa>8x{nU29TWw5bP12-q><`/');
define('SECURE_AUTH_KEY',  'j5vk0)3K[G$%uXFv5-03/?E~[X01zeS3CR(nCs5|ocD_?DAURG?pWxn,w<04:J)p'); define('LOGGED_IN_KEY', 'KQZQd|T9d9~#/]7b(k^F|4/N2QR!hUkR[mg?ll^F4~l:FOBhiN_t)3nktX/J+{s['); define('NONCE_KEY', 'Pg8V&/}[email protected]_RZ><W3c6JFvad|0>R.i$42]-Wj-HH_?^[[email protected]?8U5<ec:q%'); define('AUTH_SALT', '*i>O[(Dc*8Pzi%E=,`kN$b>%?UTJR==YmGN4VUx7Ys:$tb<PiScNy{#@x0h*HZ[|'); define('SECURE_AUTH_SALT', '}=5l/6$d [s-NNXgjiQ*u!2Y7z+^Q^cHAW*_Z+}8SBWE$wcaZ+; 9a>W7w!^NN}d');
define('LOGGED_IN_SALT',   '%:brh7H5#od-^E5#?^[b<=lY#>I9-Tg-C45FdepyZ-UpJ-]yjMa{R(E`=2_:U+yP');
define('NONCE_SALT',       '-ZVuC_W[;ML;vUW-B-7i}[email protected]~+JUW|o]-&k+D &[email protected]+ddGjr:~C_E^!od[');

Copy the output that you have generated.

Once again, open the WordPress configuration file wp-config.php.

$ sudo vim wp-config.php 

Scroll and locate the section that contains the dummy values as shown below.

Default WordPress Values

Default WordPress Values

Delete those values and paste the values that you generated earlier on.

WordPress Secret Keys

WordPress Secret Keys

Save and exit the configuration file.

Step 6: Configure Apache for WordPress

Next, a few adjustments need to be made to the default Apache configuration file 000-default.conf located in the /etc/apache2/sites-available path.

Again, using your favorite text editor, open the default configuration file.

$ sudo vim  /etc/apache2/sites-available/000-default.conf 

Next, locate the DocumentRoot attribute and modify it from /var/www/html to /var/www/html/wordpress.

Still in the same file, copy and paste the following lines inside the Virtual Host block.

<Directory /var/www/html/wordpress/>
AllowOverride All
Configure Apache for WordPress

Configure Apache for WordPress

Save and exit the configuration file.

Next, enable the mod_rewrite so that we can use WordPress Permalink feature.

$ sudo a2enmod rewrite
Enable Mod_Rewrite in Apache

Enable Mod_Rewrite in Apache

To verify that all went well, issue the command.

$ sudo apache2ctl configtest
Verify Apache Configuration

Verify Apache Configuration

To implement the changes, restart Apache web server.

$ sudo systemctl restart apache2

Step 7: Run WordPress Installation Setup

At this point we are done with all the server configurations needed for WordPress installation. The final step is to complete the installation via a web browser.
To do this, launch your web browser and browser your server’s IP address or domain name

Select WordPress Language

Select WordPress Language

On the first page you will be required to select your preferred language. Click on your preferred Language and click on the ‘Continue‘ button.

In the next page, fill in the additional information required such as Site name, Username, Password, and Email address.

Add WordPress Site Details

Add WordPress Site Details

Once you have filled all the required fields, click on the ‘Install WordPress‘ button on the bottom left corner.

Install WordPress on Debian

Install WordPress on Debian

If all went well, you will get a ‘Success‘ confirmation.

WordPress Installation Success

WordPress Installation Success

Now, to log in to your WordPress CMS, click on the ‘Log In‘ button.

WordPress User Login

WordPress User Login

This will autofill the details you specified earlier. To access the dashboard, click on the ‘Log in‘ button

WordPress Dashboard

WordPress Dashboard

Congratulations! At this point you have successfully installed WordPress on Debian 10 buster Linux system. We have finally come to the end of this tutorial. We hope it was beneficial to you. Give it a shot and share your feedback. Thanks.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

James Kiarie

This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.