Setting Up WordPress Development Environment on Debian 10

Chưa phân loại
In this article, I am going to show you how to setup a LAMP (Linux, Apache, MySQL/MariaDB, PHP) server on Debian 10 Buster for WordPress web development. So, let’s get started.

Updating APT Package Repository Cache:

First, update the APT package repository cache with the following command:

$ sudo apt update

The APT package repository cache should be updated.

Installing and Configuring MySQL/MariaDB:

Now, install MariaDB server and client packages from the official package repository of Debian 10 with the following command:

$ sudo apt install mariadb-server mariadb-client

To confirm the installation, press Y and then press <Enter>.

The APT package manager will download and install all the required packages.

At this point, MariaDB server and client packages will be installed.

Now, check whether mariadb service is running with the following command:

$ sudo systemctl status mariadb

As you can see, the mariadb service is running. It’s also enabled to automatically start on system boot.

If in any case, mariadb service is not running, then start the service with the following command:

$ sudo systemctl start mariadb

Now, run the following command to set a root password for MariaDB:

$ sudo mysql_secure_installation

Press <Enter>.

Now, press Y and then press <Enter>.

Now, type in your root password and press <Enter>.

Type in your root password again and press <Enter>.

Press Y and then press <Enter> to remove anonymous users.

If you don’t want to allow root login remotely, press Y. Otherwise, press N. Then, press <Enter>.

Now, press Y and press <Enter> to remove test database.

Now, press Y and then press <Enter> to reload the privilege table.

MariaDB should be configured.

Creating MySQL/MariaDB Users and Databases for WordPress:

Now, you have to create a new user and database for WordPress development setup.

Login to MariDB shell with the following command:

$ sudo mysql -u root -p

Now, type in the MariaDB root password you’ve already set and press <Enter>.

You should be logged in.

Now, create a new database wp_site1 with the following SQL statement:


Now, create a new user wordpress, set a password for the user (let’s say 123) and grant the user permission to use all available databases with the following SQL statement:

GRANT ALL ON *.* TO ‘wordpress’@‘localhost’ IDENTIFIED BY ‘123’;

Now, flush the MariaDB privileges for the changes to take effect as follows:


Now, exit out of the MariaDB shell as follows:


Installing Apache Web Server, PHP and Required PHP Libraries:

Now, install Apache 2 web server, PHP and all the required PHP libraries with the following command:

$ sudo apt install apache2 php phpcurl phpgd phpmbstring phpmysql
 phpzip phpjson phpxml

Now, press Y and then press <Enter> to confirm the installation.

Apache 2 web server, PHP and required PHP libraries should be installed.

Configuring Apache Web Server for WordPress Development:

The default Apache run user on Debian 10 is www-data and the default web root directory is /var/www/html. So, as an ordinary user, you won’t be able to create, modify or remove any files/directories in the web root directory. As you’re setting up a WordPress development server, this is not what you want.

To solve this problem, you should change the Apache run user to your login user and change the owner and group of the webroot /var/www/html to your login user.

To change the Apache run user, edit /etc/apache2/envvars configuration file with the following command:

$ sudo nano /etc/apache2/envvars

You have to modify the APACHE_RUN_USER and APACHE_RUN_GROUP environment variables.

Now, set APACHE_RUN_USER and APACHE_RUN_GROUP environment variables to your login user’s username. If you don’t know what the username is, you can use the whoami command to find it out.

Once you’re done, save the file by pressing <Ctrl> + X followed by Y and <Enter>.

Now, change the owner and group of the /var/www/html directory to your login user with the following command:

$ sudo chown Rf $(whoami):$(whoami) /var/www/html

To get the WordPress permalink feature to work, you need to enable Apache rewrite module. To do that, run the following command:

$ sudo a2enmod rewrite

For the changes to take effect, restart Apache 2 web server with the following command:

$ sudo systemctl restart apache2

Downloading WordPress:

You can download WordPress from the official website of WordPress. Once the page loads, click on the Download WordPress button as marked in the screenshot below.

Your browser should prompt you to save the file. Select Save File and click on OK.

WordPress archive should be downloaded.

Installing and Configuring WordPress on the Development LAMP Server:

Now, double click on the WordPress archive file. The archive should be opened with Archive Manager. Now, navigate to the wordpress directory from the Archive Manager.

Select all the files and directories and click on Extract.

Now, navigate to the /var/www/html directory and click on Extract.

All the required files and directories should be extracted. Now, click on Close and close the Archive Manager.

Now, visit http://localhost from your web browser. You should see the WordPress configuration page. Select your language and click on Continue.

Now, click on Let’s go!.

Now, type in the MySQL/MariaDB database details and click on Submit.

If all goes well, then you should see the following page. Now, click on Run the installation.

Now, type in your website information and click on Install WordPress. Be sure to note the username and password as you will need them later to manage your WordPress website.

WordPress should be configured. Now, click on Log In.

You should be taken to WordPress Admin login page (http://localhost/wp-login.php). Type in your username and password and click on Log In.

You should be logged in to WordPress Admin. Now, you should be able to set up your WordPress website the way you want.

So, that’s how you install WordPress development environment on Debian 10. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

How to Zip a Folder in Linux

In this article, I will show you how to Zip and Unzip a Folder or Directory in Linux.  This might seem trivial, but sometimes...

How to Install MythTV 0.28 – An Open Source DVR on Linux

MythTV is the ultimate free open source Digital Video Recorder. You can think of it has a home media center hub for everyone...
Chưa phân loại, vps giá rẻ

Bash Echo Examples

Multiple built-in functions exist in bash to print the output into the terminal. ‘echo’ is one of the most used...