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
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
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:
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.
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;
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
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/
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.
Next, you will see all the steps you have to complete to install WordPress on Debian 10.
Then, set the parameters of the database.
Next, if everything is OK, you will see this. So you can start with the installation.
After that, you have to define the admin account and the site information.
Next, log in.
Finally, you will see the 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.
Great article Angeloma.
Your instructions worked nicly for my install.
Thanks!!
Worked like a charm for me. Thanks a lot
Thank you for your comment. Don’t forget to share the post to help many more people.
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?
please paste the whole output.
Hi, how can I know what’s my domain? Sorry am beginner.
:~$ hostname –fqdn
Everything works until I get to Step 4: Complete the installation using the web interface. When I try to access my server via a browser, I get 404 errors. I’ve tried entering https://www.mydomain.com/wordpress/wp-admin/setup-config.php and just https://www.mydomain.com/ (where “mydomain” is my domain). Should I use a different address?
You should use the IP-Adress to conect to your blog.
Great howto, I especially enjoyed the screenshots in step 11 and 12 😀
A server error 😀
But the tutorial is good
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?
“Error while connecting to the database” ?
Where is my:
– Namedatabase
– ID
-Database Password ???
Please. Thank’s.
See the image 4
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.
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