22 C
Texas
angeloma
Senior Writer and partner

How to install WordPress on Debian 10?

In today’s world, everything is Internet and information sites. There is too much variety in them. But we also find a lot of variety of applications that allow us to make websites. In this way, we find a nice CMS competition. That is to say, web applications that allow creating a blog without much effort. Of all these, WordPress is the most popular and solvent of all. That’s why, in this post, you will learn how to install WordPress on Debian 10, Buster.

What is WordPress?

WordPress is a CMS (content manager system) that is to say it is an application that allows you to create a blog of information. However, over time has evolved and not only provides services to create blogs but corporate websites or what you can imagine.

Thanks to WordPress and CMS, publish news and entries, do not require knowledge of HTML or PHP, but everything is visual.

So, if you want to have a personal blog or for educational purposes, WordPress is a pretty good solution.

Install WordPress on Debian 10

1) Install Apache and PHP

- Advertisement -

Being a web application, you need to have a web server running on our system. Of course, WordPress is compatible with other servers like Nginx, but in this case, we will use Apache webserver.

On the other hand, WordPress is programmed in PHP, so we need the language for it to work.

So, open a terminal session and type:

:~$ sudo apt install apache2 php7.3 libapache2-mod-php7.3 php7.3-common php7.3-mbstring php7.3-xmlrpc php7.3-soap php7.3-gd php7.3-xml php7.3-intl php7.3-mysql php7.3-cli php7.3-ldap php7.3-zip php7.3-curl

1.- Install Apache and PHP on Debian 10
1.- Install Apache and PHP on Debian 10

Then, create a new PHP file to test the language.

:~$ sudo nano /var/www/html/test.php
<?php
phpinfo();
?>

After that, open it using the web browser, for example http://you-server/test.php. You will see something like this:

2.- PHP info
2.- PHP info

So, Apache and PHP are working.

2) Install MySQL

WordPress requires a database manager. In Debian, we have MySQL which is one of the most popular and makes it a pretty good option for it.

To install it, run the following command:

:~$ sudo apt install default-mysql-server

Then, set a root password and secure the installation.

:~$ sudo mysql_secure_installation

Say “y” to all the questions.

3.- using the mysql_secure_installation script
3.- using the mysql_secure_installation script

After that, it is necessary to create a new database for WordPress. Also, create a new user too.

:~$ sudo mysql -u root -p
> CREATE DATABASE wordpress;
> GRANT ALL PRIVILEGES on wordpress.* TO 'wordpress_user'@'localhost' IDENTIFIED BY 'wordpress_pss123';
> FLUSH PRIVILEGES;
> EXIT;

4.- Crating the new database for WordPress
4.- Crating the new database for WordPress

Now, we can continue with the next steps.

3) Install WordPress on Debian 10

Now it is your turn to install WordPress. However, first, you have to download it. For that, I will use wget.

So, run the following command:

:~$ cd /tmp/
:~$ wget -c https://wordpress.org/latest.tar.gz

5.- Download and install Wodpress on Debian 10
5.- Download and install WordPress on Debian 10

Then, decompress it and move it to the /var/www/html/ folder. Next, set the right permissions to the folder.

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

6.- Installing WordPress on Debian 10
6.- Installing WordPress on Debian 10

Next, create a new Virtualhost for WordPress.

:~$ 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
     </Directory>

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

</VirtualHost>

Of course, replace  “your-domain” with yours. Save the changes and close the file.

Then you have to enable the new Virtualhost and also the Apache rewrite module. And for all this to work, then we’ll have to restart Apache.

:~$ sudo ln -s /etc/apache2/sites-available/wordpress.conf /etc/apache2/sites-enabled/wordpress.conf
:~$ sudo a2enmod rewrite
:~$ sudo systemctl restart apache2

Now complete the installation.

4) Complete the installation using the web interface

Now, you have to complete the installation using the web browser. Access to your server and you will see this. So, select the installation language.

7.- Installation Language
7.- Installation Language

Next, you will see all the steps you have to complete to install WordPress on Debian 10.

8.- WordPress installation
8.- WordPress installation

Then, set the parameters of the database.

9.- Database parameters on the installation
9.- Database parameters on the installation

Next, if everything is OK, you will see this. So you can start with the installation.

10.- Starting the installation
10.- Starting the installation

After that, you have to define the admin account and the site information.

11.- Site information and admin account
11.- Site information and admin account

Next, log in.

12.- WordPress login
12.- WordPress login

Finally, you will see the WordPress Dashboard.

13.- WordPress Dashboard
13.- WordPress Dashboard

And that is it. You can start to work with WordPress and create your web site.

Conclusion

WordPress is a fairly popular CMS. Thanks to this application, you can create your website in a short time and without great knowledge of HTML. Also, in this post, you have seen that installing it is not too complicated for the great advantages it provides.

Please share this post with your friends and join our Telegram channel.

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

18 COMMENTS

  1. Hi Angeloma,

    I get following error:
    Job for apache2.service failed because the control process exited with error code.
    See “systemctl status apache2.service” and “journalctl -xe” for details.

    What should I do?

  2. Cool guide, followed it completely. Except that my domain name does not redirect correctly to /var/www/html/wordpress but to the default Apache2 Debian Default Page, i.e. /var/www/html/index.html

    Any thoughts?

  3. In the step: sudo mysql_secure_installation, the instructions given here are to "say 'y' to all the questions". This is actually less secure.

    MariaDB for Debian 10 installs the DB's "root" ccount with socket permissions. By default, logging in to the DB's root account with a password is disabled. That means that in order to log in to the database's root account, you also have to have access to the Debian system's root superuser.

    One of the questions in mysql_secure_installation is do you want to make a root password. If you say yes here and create a password for the DB's root account, it means that anyone can log into the database as root as long as they know that password. It opens up your database to brute force attacks from any user on the system.

    It is far more secure NOT to create a root password.

  4. Thank you for this guide, angeloma.
    But it is not clear to me what to input to the initial database set up screen of the wordpress installtion (Step 9).

    • Hello, there you have to set the parameters of the database you have created.

      In this example, assuming you didn’t change anything in the post they would be:

      Database name: wordpress
      user: wordpress_user
      password: wordpress_pss123
      host: localhost

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article