blog-image

Sep 11, 2019

14 min read

How To Install WordPress On Debian 9 With LAMP (Tutorial)

Written by

Vippy The VPS

WordPress + LAMP is the classic web hosting setup.

Sure, there are other software stack options for hosting WordPress (some of our team is partial to LEMP). But in terms of wide implementation and usage for websites across the globe, nothing compares to WordPress with LAMP.

So today we'll show you how to get serve your website to the world this way by installing WordPress on Debian 9 using a LAMP stack.

Want to install WordPress but not on Debian? 👉Click here for our WordPress + Ubunbu 18.04 tutorial 👉Click here for our WordPress + Centos 7 tutorial

WordPress + LAMP: the most popular CMS and web server

WordPress is a powerhouse—over 34% of all websites online today use it—that’s over 22 million websites.

And for sites using a CMS (content management system), it towers over the competition with 60% of the market share.

Meanwhile, Apache (a key piece of the LAMP stack) is the world’s most popular web server.

So, you can see why having the WordPress/LAMP installation in your pocket is key for any developer or anyone looking to host their own blog or website.

How to install WordPress on Debian 9 using a LAMP stack

In this tutorial, I will show you how to install WordPress with LAMP on Debian 9.

Prerequisites for installing WordPress on Debian 9

Before we get started, you'll need to have the following set up:

  1. LAMP stack: LAMP stands for Linux Apache MySQL PHP. WordPress is both a front end and a back-end system so it requires a web server, a database engine and PHP for serving dynamic content which is handled by the LAMP stack. —>Click here for a step-by-step guide to installing LAMP on your Linux server.
  2. SSH access to your Debian 9 Server
  3. A system user with sudo privileges

If you're all set, then let's get started!

Step 1: Create a database for WordPress user

WordPress ships a bundle of numerous files and those files need to be stored in a database.

So, your first step towards installing WordPress is to setup MySQL database to handle these files.

To do this, let's log in to MySQL as a root user, using the command:

mysql -u root -p

You’ll then prompted for the password that you set during the set-up of MySQL database system.

Once logged in, you need to create a new database that will accommodate WordPress files during and after the installation process. You can name it whatever you wish, but to keep things simple, we will call it wordpressdb in this guide.

To create the database, run the following command.

mysql> CREATE DATABASE wordpressdb;

NOTE: Always remember to terminate MySQL statements with a semi-colon “;”

With the database in place, you need to create a new MySQL user account that will have exclusive access to the database.

Let's also grant the user full access to the database and set a strong password. For this guide, we will create a user called admin-user.

To do that, execute the following command

mysql> GRANT ALL ON wordpress.* TO 'admin-suser'@'localhost' IDENTIFIED BY 'PASSWORD';

NOTE: Remember to replace the PASSWORD string with a strong password.

At this point, we’ve created a database and a user account specifically for WordPress.

To apply the changes in MySQL instance, we need to run the command below

mysql> FLUSH PRIVILEGES;

Then we'll exit the MySQL instance by running the command

mysql>   EXIT;

Step 2: Install additional PHP extensions

LAMP stack requires only a minimal set of extensions for PHP to communicate with MySQL database server. However, WordPress and many of its plugins require additional extensions to function without complications.

With that in mind, we're now going to install additional PHP extensions for WordPress.

First, update the system:

# sudo apt update

Next, install the additional PHP extensions:

# sudo apt install php-curl php-gd php-mbstring php-xml
Continue reading this article
by subscribing to our newsletter.
Subscribe now

A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.

If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.

Leave a Reply