21.7 C
Senior Writer and partner

Install WordPress on Debian 11

Hello, friends. With the release of Debian 11, many will take this moment to deploy new personal websites using WordPress. So, in this post, you will learn how to install WordPress on Debian 11.

By way of introduction, WordPress is an open-source CMS (Content Management System) that allows us to deploy a website or a blog quickly but including a lot of advanced features.

In addition to this, we can upload new information from a control panel via a web interface so the ease of administration is complete. It is worth noting that a huge amount of websites are deployed with WordPress, this gives you an idea of how complete it is.

So, let’s get started.

Install WordPress on Debian 11

Install LAMP on Debian 11

- Advertisement -

As WordPress is a web application created with PHP and requires a database manager like MariaDB, then we can use the LAMP stack for our purpose.

To do so, first read our post about Apache and PHP

How to install Apache on Debian 11?

Also, you will need these PHP modules for WordPress to work at least in a basic way.

php7.4 libapache2-mod-php7.4 php7.4-common php7.4-mbstring php7.4-xmlrpc php7.4-soap php7.4-gd php7.4-xml php7.4-intl php7.4-mysql php7.4-cli php7.4-ldap php7.4-zip php7.4-curl php7.4-zip php7.4-curl

And then complete the LAMP installation with MariaDB.

How to install MariaDB on Debian 11?

Now with MariaDB installed, the next step is to create a new database and MariaDB user dedicated to WordPress. To do this, enter the MariaDB shell

sudo mysql -u root -p

And create the database with the name you want:


After this, create a new user with permissions on the database.

GRANT ALL PRIVILEGES on wordpress.* TO 'wordpress_user'@'localhost' IDENTIFIED BY 'wordpress_pss123';

You can replace the username and password with any values you want.

Refresh permissions


And exit the console


With this, we have the system ready for WordPress.

Download the WordPress package

The next step is to download the latest stable version of WordPress for Linux. This step will be done from the /tmp folder and using the wget command.

cd /tmp
wget https://wordpress.org/latest.tar.gz
--2021-09-11 17:41:50--  https://wordpress.org/latest.tar.gz
Resolving wordpress.org (wordpress.org)...
Connecting to wordpress.org (wordpress.org)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15087630 (14M) [application/octet-stream]
Saving to: ‘latest.tar.gz’

latest.tar.gz                             100%[=====================================================================================>]  14.39M  10.6MB/s    in 1.4s

2021-09-11 17:41:52 (10.6 MB/s) - ‘latest.tar.gz’ saved [15087630/15087630]

When the download is finished, unzip it, move it to the Apache root directory, assign the appropriate permissions and make Apache the owner of the folder so that it will not have any problems running.

tar -xvzf latest.tar.gz
sudo mv wordpress/ /var/www/html/
sudo chmod 755 -R /var/www/html/wordpress/
sudo chown -R www-data:www-data /var/www/html/wordpress/

Next, create a new VirtualHost to better manage the WordPress website

sudo nano /etc/apache2/sites-available/wordpress.conf

And add the following:

<VirtualHost *:80>
     ServerAdmin admin@your_domain.com
      DocumentRoot /var/www/html/wordpress
     ServerName your-domain.com

     <Directory /var/www/html/wordpress>
          Options FollowSymlinks
          AllowOverride All
          Require all granted

     ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
     CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined


Replace the ServerName and ServerAdmin values with the appropriate values which are your domain and Admin email.

Save the changes and close the editor.

Now enable the new Apache site and the Apache rewrite module.

sudo ln -s /etc/apache2/sites-available/wordpress.conf /etc/apache2/sites-enabled/wordpress.conf
sudo a2enmod rewrite

Apply changes by restarting Apache

sudo systemctl restart apache2

Install the Let’s Encrypt certificates

As your site will be on the internet, you should enable HTTPS and for that, you have to generate and install the Let’s Encrypt certificates which we can do with the help of Certbot.

So, install Certbot and the Apache plug-in.

sudo apt install certbot python3-certbot-apache

And generate the certificates, with the following command

sudo certbot --apache -d [your-domain]

Replace [your-domain] with your domain. During the process, you will have to enter an email address and accept the license terms.

Afterward, if the process is successful you will be notified and you can restart Apache and finish the process.

Install WordPress on Debian 11

Now open a web browser and go to https://yourdomain and you will see the following screen starting the installer.

Start by selecting the language of the installation.

1.- Language installation
1.- Language installation

Then the installer will notify you of the information needed for installation.

2.- Start the WordPress installation
2.- Start the WordPress installation

After this, enter the parameters of the created database such as database name, user, and password.

3.- Database parameters
3.- Database parameters

If everything went well, you will see a screen informing you that the process was successful.

4.- Database connection properly defined
4.- Database connection properly done

Now, enter the information of the website you are creating. Also, on that screen, you will have to create the WordPress administrator user. Then, press the Install WordPress button.

5.- Site information
5.- Site information

If everything went well, you will see this screen

6.- WordPress installed
6.- WordPress installed

Now you just need to log in with your credentials.

7.- WordPress Login screen
7.- WordPress Login screen

And see the WordPress dashboard indicating that everything went well.

8.- WordPress on Debian 11
8.- WordPress on Debian 11

Enjoy it.


In this post, you have learned how to install WordPress on Debian 11 using Apache as the web server. This process has been done step by step in a way that anyone can do it. Now that you know how to do it, give it a try.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article