{"id":23310,"date":"2023-12-31T19:25:02","date_gmt":"2023-12-31T19:25:02","guid":{"rendered":"https:\/\/linuxways.net\/?p=23310"},"modified":"2023-12-31T19:26:35","modified_gmt":"2023-12-31T19:26:35","slug":"install-wordpress-on-debian-12","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/install-wordpress-on-debian-12\/","title":{"rendered":"How to Install WordPress on Debian 12"},"content":{"rendered":"<p>To publish and manage web content there are different tools but the most popular among them is WordPress. This is because it is an open-source tool that has nearly all the bells and whistles that other tools provide but with some extra cost. In other words, WordPress is also known as a content management system that helps you manage your site settings which include different kinds of plugins, website appearance, adds management, and more. Moreover, it is based on the PHP hypertext preprocessor language and uses MariaDB or MySQL for storing the database.<\/p>\n<h2><strong>How to Install WordPress on Debian 12 <\/strong><\/h2>\n<p>Since WordPress is a content management tool, installing it requires having a web server and a database which makes its installation quite a long process, but it is easy to follow. So, to Install WordPress on Debian 12 here are some steps that you need to follow:<\/p>\n<h3><strong>Step 1: Install Apache Web Server on Debian12 <\/strong><\/h3>\n<p>There are a number of web servers available like Nginx, Node.js, Lite speed, Apache, and more, you can use any of them but here I am using Apache. Apache is an open-source web server that uses the HTTP protocol and to install it on Debian 12 execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> apache2 <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"313\" class=\"wp-image-23311\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-1.png 761w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-1-300x123.png 300w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/p>\n<p>Once the installation is complete check its version by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apache2 <span class=\"re5\">-v<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"219\" class=\"wp-image-23313\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-2.png 771w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-2-300x85.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-2-768x218.png 768w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/p>\n<p>Now check the Apache service if it is running using the systemctl command and if it is not running then try to enable it by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">systemctl <span class=\"kw3\">enable<\/span> apache2 <span class=\"re5\">--now<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"295\" class=\"wp-image-23314\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-3.png 758w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-3-300x117.png 300w\" sizes=\"auto, (max-width: 758px) 100vw, 758px\" \/><\/p>\n<p>You may get this error of<em> journalctl -xeu apache2.service<\/em> then it means that there is any other server running that is accessing the same port. So in that case look for the server that is accessed by the respective pot 80 by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> lsof <span class=\"re5\">-i<\/span> tcp:<span class=\"nu0\">80<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"869\" height=\"270\" class=\"wp-image-23318\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-4.png 869w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-4-300x93.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-4-768x239.png 768w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/p>\n<p>Now here I already had Nginx installed which is using port 80 that is causing this error for Apache, so for that just use the kill command to terminate the root user process using its PID:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">kill<\/span> <span class=\"sy0\">&lt;<\/span>root-PID<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"311\" class=\"wp-image-23323\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-5.png 878w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-5-300x106.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-5-768x272.png 768w\" sizes=\"auto, (max-width: 878px) 100vw, 878px\" \/><\/p>\n<p>Now execute the enable command for Apache:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl <span class=\"kw3\">enable<\/span> apache2 <span class=\"re5\">--now<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"875\" height=\"386\" class=\"wp-image-23326\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-6.png 875w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-6-300x132.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-6-768x339.png 768w\" sizes=\"auto, (max-width: 875px) 100vw, 875px\" \/><\/p>\n<p>Now use your IP address to visit the Apache2 default page for verification:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">http:<span class=\"sy0\">\/\/<\/span>127.0.0.1<br \/>\n<br \/>\nhttp:<span class=\"sy0\">\/\/<\/span>localhost<\/div><\/div>\n<p><strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"588\" class=\"wp-image-23336\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-7.png 840w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-7-300x210.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-7-768x538.png 768w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/strong><\/p>\n<p>You might encounter firewall issues while accessing the server, so it is advisable to add a rule for allowing the TCP protocol at port 80 using the iptables command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> iptables <span class=\"re5\">-I<\/span> INPUT <span class=\"re5\">-p<\/span> tcp <span class=\"re5\">--dport<\/span> <span class=\"nu0\">80<\/span> <span class=\"re5\">-j<\/span> ACCEPT<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"214\" class=\"wp-image-23341\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-8.png 761w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-8-300x84.png 300w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/p>\n<h3><strong>Step 2: Install MariaDB Database Server <\/strong><\/h3>\n<p>MariaDB is a server database management tool that can store large amounts of data, it has a central access point from where the data can be retrieved and stored. So for the installation of WordPress on Debian12, we have to install the MariaDB server and client, for that execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> mariadb-server mariadb-client <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"762\" height=\"338\" class=\"wp-image-23349\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-9.png 762w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-9-300x133.png 300w\" sizes=\"auto, (max-width: 762px) 100vw, 762px\" \/><\/p>\n<p>Once this database server is installed verify its version by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">mariadb <span class=\"re5\">--version<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"224\" class=\"wp-image-23353\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-10.png 764w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-10-300x88.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/p>\n<p>Now check the status of the database server usually, it is active and running and for that execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl status mariadb<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"757\" height=\"414\" class=\"wp-image-23360\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-11.png 757w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-11-300x164.png 300w\" sizes=\"auto, (max-width: 757px) 100vw, 757px\" \/><\/p>\n<p>If your database server is not active and running, then try enabling it and then starting it using the systemctl commands:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl <span class=\"kw3\">enable<\/span> mariadb <span class=\"re5\">--now<\/span><br \/>\n<br \/>\n<span class=\"kw2\">sudo<\/span> systemctl start mariadb<\/div><\/div>\n<p>The newer version of MariaDB comes with default configurations which are not that good when it comes to any potential of unauthorized access or in case of any breach. So, to provide better security for MariaDB run the<em> mysql_secure_installation<\/em>:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> mysql_secure_installation<\/div><\/div>\n<p><strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"757\" height=\"367\" class=\"wp-image-23368\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-12.png 757w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-12-300x145.png 300w\" sizes=\"auto, (max-width: 757px) 100vw, 757px\" \/><\/strong><\/p>\n<p>You have to give prompts for various options that will be asked during the execution of the script and just for the prompt of root account password press n and for the rest of the prompts replay with y.<\/p>\n<h3><strong>Step 3: Install PHP on Debian 12 <\/strong><\/h3>\n<p>As mentioned above WordPress is based on the PHP language so it is necessary to have PHP installed on Debian. Moreover, it also acts as a bridge between the web server that is Apache, and the database server which is MariaDB. Apart from installing the PHP WordPress requires some PHP extension as well to run properly so for that execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> php libapache2-mod-php8.2 php8.2-cli php8.2-common php8.2-zip php8.2-curl php8.2-mysql <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"770\" height=\"313\" class=\"wp-image-23373\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-13.png 770w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-13-300x122.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-13-768x312.png 768w\" sizes=\"auto, (max-width: 770px) 100vw, 770px\" \/><\/p>\n<p>Here is a bit more detail for the PHP extensions that are installed:<\/p>\n<ul>\n<li><strong>libapache2-mod-php8.2<\/strong>: The Apache module that integrates PHP with the web server.<\/li>\n<li><strong>php8.2-cli<\/strong>: The command-line interface for PHP.<\/li>\n<li><strong>php8.2-common<\/strong>: The common files shared by different PHP extensions.<\/li>\n<li><strong>php8.2-zip<\/strong>: The PHP extension for handling ZIP archives.<\/li>\n<li><strong>php8.2-curl<\/strong>: The PHP extension for using the cURL library.<\/li>\n<li><strong>php8.2-mysql<\/strong>: The PHP extension for interacting with MySQL or MariaDB databases.<\/li>\n<\/ul>\n<p>Now to see if PHP is installed successfully, check its version by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">php <span class=\"re5\">-v<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"234\" class=\"wp-image-23383\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-14.png 764w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-14-300x92.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/p>\n<p>Further, if you want to switch to any other PHP version that is installed on your Debian system then you have to deactivate the current one:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> a2dismod php<span class=\"sy0\">&lt;<\/span>verison-number<\/div><\/div>\n<p>Now to switch to the other version use the<em> a2enmod<\/em> command like this:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> a2enmod php<span class=\"sy0\">&lt;<\/span>version-number<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>Next, once you are done with the change restart the Apache server to apply the changes by using:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl restart apache2<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"762\" height=\"222\" class=\"wp-image-23391\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-15.png 762w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-15-300x87.png 300w\" sizes=\"auto, (max-width: 762px) 100vw, 762px\" \/><\/p>\n<h3><strong>Step 4: Install WordPress Backend on Debian 12 <\/strong><\/h3>\n<p>Web applications usually have two ends, one is the backend and the other is the frontend, the backend has all the programming that creates the frontend. The same is the case with WordPress, so first we have to install the backend end for <a href=\"https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/\">WordPress from its official site<\/a> by executing the:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> https:<span class=\"sy0\">\/\/<\/span>wordpress.org<span class=\"sy0\">\/<\/span>latest.tar.gz<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"450\" class=\"wp-image-23401\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-16.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-16-300x176.png 300w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/p>\n<p>Now extract the downloaded file to the HTML folder in the variables directory of Debian using the C flag:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">tar<\/span> <span class=\"re5\">-xzvf<\/span> latest.tar.gz <span class=\"re5\">-C<\/span> <span class=\"sy0\">\/<\/span>var<span class=\"sy0\">\/<\/span>www<span class=\"sy0\">\/<\/span>html<span class=\"sy0\">\/<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"766\" height=\"287\" class=\"wp-image-23408\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-17.png 766w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-17-300x112.png 300w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" \/><\/p>\n<p>Once the file is extracted change its permissions, first starting by changing the ownership of the WordPress directory by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">chown<\/span> <span class=\"re5\">-R<\/span> www-data:www-data <span class=\"sy0\">\/<\/span>var<span class=\"sy0\">\/<\/span>www<span class=\"sy0\">\/<\/span>html<span class=\"sy0\">\/<\/span>wordpress<span class=\"sy0\">\/<\/span><\/div><\/div>\n<p>Here <em>chown<\/em> is for changing the owner and <em>www-data:www-data<\/em> is the user group that is the new owner whereas the R flag is used for recursive as this will apply to any subdirectories if any.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"766\" height=\"246\" class=\"wp-image-23415\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-18.png 766w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-18-300x96.png 300w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" \/><\/p>\n<p>Next, change the permissions of the directory and the files inside it, the <em>chmod 775<\/em> means that the owners can read, write, and execute this directory, to specify it for directory <em>type d <\/em>command is used.<\/p>\n<p>However, for other users, it has only read and execute permission. Moreover, the permissions for the files in the directories are limited to reading and executing for the owner, and in the case of other users the permission is only for reading the files:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">find<\/span> <span class=\"sy0\">\/<\/span>var<span class=\"sy0\">\/<\/span>www<span class=\"sy0\">\/<\/span>html<span class=\"sy0\">\/<\/span>wordpress <span class=\"re5\">-type<\/span> d <span class=\"re5\">-exec<\/span> <span class=\"kw2\">chmod<\/span> <span class=\"nu0\">755<\/span> <span class=\"br0\">&#123;<\/span><span class=\"br0\">&#125;<\/span> \\;<br \/>\n<br \/>\n<span class=\"kw2\">sudo<\/span> <span class=\"kw2\">find<\/span> <span class=\"sy0\">\/<\/span>var<span class=\"sy0\">\/<\/span>www<span class=\"sy0\">\/<\/span>html<span class=\"sy0\">\/<\/span>wordpress <span class=\"re5\">-type<\/span> f <span class=\"re5\">-exec<\/span> <span class=\"kw2\">chmod<\/span> <span class=\"nu0\">644<\/span> <span class=\"br0\">&#123;<\/span><span class=\"br0\">&#125;<\/span> \\;<\/div><\/div>\n<p><strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"241\" class=\"wp-image-23421\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-19.png 767w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-19-300x94.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/strong><\/p>\n<h3><strong>Step 5: Create a Database for WordPress<\/strong><\/h3>\n<p>WordPress, as mentioned above uses a database for storing all the website data and user information, similarly, to access the database name, username, and password are to be stored. So, execute the MariaDB database server by executing:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> mariadb <span class=\"re5\">-u<\/span> root<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"321\" class=\"wp-image-23422\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-20.png 771w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-20-300x125.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-20-768x320.png 768w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/p>\n<p>Now create a database using the command <em>CREATE DATABASE<\/em> along with the desired name, here for illustration I have created a database named<em> WORDPRESSDB<\/em> but you can give any name you want:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">CREATE DATABASE WORDPRESSDB;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"363\" class=\"wp-image-23423\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-21.png 763w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-21-300x143.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/p>\n<p>Now create a user for WordPress and set the password for accessing the database, here for illustration I have set a dummy name and password, but you can set any name and password based on your preference:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">CREATE USER <span class=\"st_h\">'WPUSER'<\/span><span class=\"sy0\">@<\/span>localhost IDENTIFIED BY <span class=\"st_h\">'PASSWORD'<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"754\" height=\"401\" class=\"wp-image-23427\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-22.png 754w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-22-300x160.png 300w\" sizes=\"auto, (max-width: 754px) 100vw, 754px\" \/><\/p>\n<p>Once you have created a user and set its password key then grant the user all the rights for managing the database. Don&#8217;t forget to replace the username and password in the command below with your set password and username:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">GRANT ALL PRIVILEGES ON WORDPRESSDB.<span class=\"sy0\">*<\/span> TO WPUSER<span class=\"sy0\">@<\/span>localhost IDENTIFIED BY <span class=\"st_h\">'PASSWORD'<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"485\" class=\"wp-image-23428\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-23.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-23.png 753w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-23-300x193.png 300w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/p>\n<p>Now just reload the grant tables which in other words reloads the database to apply the changes and after that exit the database:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">FLUSH PRIVILEGES;<br \/>\n<br \/>\nEXIT;<\/div><\/div>\n<p><strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"254\" class=\"wp-image-23431\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-24.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-24.png 790w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-24-300x96.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-24-768x247.png 768w\" sizes=\"auto, (max-width: 790px) 100vw, 790px\" \/><\/strong><\/p>\n<p><strong>Step 5: Configure WordPress on Debian 12 <\/strong><\/p>\n<p>The password and the user we created in the previous steps are saved in the configuration file of WordPress so that it can access it automatically. So, for that navigate to the WordPress directory we created previously and rename the sample configuration file by using the move command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">cd<\/span> <span class=\"sy0\">\/<\/span>var<span class=\"sy0\">\/<\/span>www<span class=\"sy0\">\/<\/span>html<span class=\"sy0\">\/<\/span>wordpress<span class=\"sy0\">\/<\/span><br \/>\n<br \/>\n<span class=\"kw2\">sudo<\/span> <span class=\"kw2\">mv<\/span> wp-config-sample.php wp-config.php<\/div><\/div>\n<p><strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"244\" class=\"wp-image-23434\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-25.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-25.png 764w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-25-300x96.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/strong><\/p>\n<p>Now open up the configuration file and just set the database name, username, and password as highlighted in the image below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">nano<\/span> wp-config.php<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"571\" class=\"wp-image-23436\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-26.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-26.png 753w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-26-300x227.png 300w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/p>\n<p>Once you have updated the details for the database in the WordPress configuration file, now there is an optional adjustment that you can do by adding the below code lines at the end of the file:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"sy0\">\/*<\/span> use the direct method to save files <span class=\"sy0\">*\/<\/span><br \/>\n<br \/>\ndefine<span class=\"br0\">&#40;<\/span> <span class=\"st_h\">'FS_METHOD'<\/span>, <span class=\"st_h\">'direct'<\/span> <span class=\"br0\">&#41;<\/span>;<br \/>\n<br \/>\n<span class=\"sy0\">\/*<\/span> Increase memory limit <span class=\"sy0\">\/<\/span><br \/>\n<br \/>\ndefine<span class=\"br0\">&#40;<\/span><span class=\"st_h\">'WP_MEMORY_LIMIT'<\/span>, <span class=\"st_h\">'256M'<\/span><span class=\"br0\">&#41;<\/span>;<br \/>\n<br \/>\n<span class=\"sy0\">\/*<\/span> change database table prefix <span class=\"sy0\">*\/<\/span><br \/>\n<br \/>\n<span class=\"re1\">$table_prefix<\/span> = <span class=\"st_h\">'wp_'<\/span>;<\/div><\/div>\n<p><strong>define( &#8216;FS_METHOD&#8217;, &#8216;direct&#8217; ):<\/strong> To install and update the plugins or themes without providing conditionals every time WordPress can be directed to use the direct method for saving files. Which means it can write files without asking for FTP or SSH credentials.<\/p>\n<p><strong>define(&#8216;WP_MEMORY_LIMIT&#8217;, &#8216;256M&#8217;<\/strong>): The default memory limit is 32 MB, which may not be enough for some sites so it is a preventive measure to increase the memory limit up to 256MB. As a result of this, the overall efficiency and stability of the website can be significantly improved.<\/p>\n<p><strong>$table_prefix = &#8216;wp_&#8217;<\/strong>; The table prefixes in WordPress are used to avoid any issue with the other tables and it can increase the security of the website. Using table prefixes makes it quite difficult for the attackers to guess your table names. Here by default wp_ is set but you set prefixes based on your preference don&#8217;t forget to use the underscore with the name.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"581\" class=\"wp-image-23438\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-27.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-27.png 763w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-27-300x228.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/p>\n<p>Now add the security key for WordPress which it stores in the form of cookies and other site data. Normally you have to generate the keys from the official WordPress website and just place them in their placements in the configuration file:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"575\" class=\"wp-image-23440\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-28.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-28.png 748w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-28-300x231.png 300w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/p>\n<p>It is always better to generate the keys prior to starting WordPress but if you do not add the keys then WordPress will generate it automatically.<\/p>\n<h3><strong>Step 6: Configure Apache2 Server for WordPress <\/strong><\/h3>\n<p>To successfully connect WordPress with the internet it is necessary to configure it with Apache properly. For that create a configuration file named the same as your domain name in the <em>sites-available<\/em> directory of the Apache2 server:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">nano<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apache2<span class=\"sy0\">\/<\/span>sites-available<span class=\"sy0\">\/&lt;<\/span>domain-name<span class=\"sy0\">&gt;<\/span>.conf<\/div><\/div>\n<p>Here in the above command, you just need to replace the <em>domain-name <\/em>with your website name and then add the following lines of code:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"sy0\">&lt;<\/span>VirtualHost <span class=\"sy0\">*<\/span>:<span class=\"nu0\">80<\/span><span class=\"sy0\">&gt;<\/span><br \/>\n<br \/>\nServerName yourdomain.com<br \/>\n<br \/>\nServerAlias www.yourdomain.com<br \/>\n<br \/>\nDocumentRoot <span class=\"sy0\">\/<\/span>var<span class=\"sy0\">\/<\/span>www<span class=\"sy0\">\/<\/span>html<span class=\"sy0\">\/<\/span>wordpress<br \/>\n<br \/>\n<span class=\"sy0\">&lt;<\/span>Directory <span class=\"st0\">&quot;\/var\/www\/html\/wordpress&quot;<\/span><span class=\"sy0\">&gt;<\/span><br \/>\n<br \/>\nAllowOverride All<br \/>\n<br \/>\n<span class=\"sy0\">&lt;\/<\/span>Directory<span class=\"sy0\">&gt;<\/span><br \/>\n<br \/>\nErrorLog <span class=\"co1\">${APACHE_LOG_DIR}<\/span><span class=\"sy0\">\/<\/span>wordpress.error.log<br \/>\n<br \/>\nCustomLog <span class=\"co1\">${APACHE_LOG_DIR}<\/span><span class=\"sy0\">\/<\/span>wordpress.access.log combined<br \/>\n<br \/>\n<span class=\"sy0\">&lt;\/<\/span>VirtualHost<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>This code defines the settings for the WordPress site which includes the domain name, and server name along with the directory paths for saving the settings. Here in the code set your domain name and server name to the preferred one.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"571\" class=\"wp-image-23447\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-29.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-29.png 764w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-29-300x224.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/p>\n<h3><strong>Step 7: Dry Run the Virtual Host <\/strong><\/h3>\n<p>Once you have created the virtual host then just verify the file by testing it for any sort of errors and for that run the configuration test for the Apache server:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apache2ctl configtest<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"217\" class=\"wp-image-23451\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-30.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-30.png 753w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-30-300x86.png 300w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/p>\n<p>Once there are no errors, then enable your website on the Apache server using your website configuration file:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> a2ensite <span class=\"sy0\">&lt;<\/span>domian-name<span class=\"sy0\">&gt;<\/span>.conf<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"755\" height=\"206\" class=\"wp-image-23453\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-31.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-31.png 755w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-31-300x82.png 300w\" sizes=\"auto, (max-width: 755px) 100vw, 755px\" \/><\/p>\n<p>Next, restart the Apache server to apply the changes:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl restart apache2<\/div><\/div>\n<h3><strong>Step 8: Install WordPress Frontend <\/strong><\/h3>\n<p>Once you are set now run the following address on your browser in Debian to start the WordPress frontend installation:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">http:<span class=\"sy0\">\/\/<\/span>localhost<span class=\"sy0\">\/<\/span>wp-login.php<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1097\" height=\"664\" class=\"wp-image-23455\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-32.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-32.png 1097w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-32-300x182.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-32-1024x620.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-32-768x465.png 768w\" sizes=\"auto, (max-width: 1097px) 100vw, 1097px\" \/><\/p>\n<p>After selecting the language click on <strong>Continue<\/strong> and in the next tab just fill up the necessary details and click on <strong>Install WordPress<\/strong>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1103\" height=\"708\" class=\"wp-image-23456\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-33.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-33.png 1103w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-33-300x193.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-33-1024x657.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-33-768x493.png 768w\" sizes=\"auto, (max-width: 1103px) 100vw, 1103px\" \/><\/p>\n<p>Once WordPress is installed log in to WordPress using the same credentials that you placed in the previous step:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1095\" height=\"532\" class=\"wp-image-23460\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-34.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-34.png 1095w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-34-300x146.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-34-1024x498.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-34-768x373.png 768w\" sizes=\"auto, (max-width: 1095px) 100vw, 1095px\" \/><\/p>\n<p>Now the dashboard of WordPress will open and on the left side you will find the menu column from where you can manage your website:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1090\" height=\"701\" class=\"wp-image-23462\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-35.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-35.png 1090w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-35-300x193.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-35-1024x659.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23310-35-768x494.png 768w\" sizes=\"auto, (max-width: 1090px) 100vw, 1090px\" \/><\/p>\n<p><strong>Note:<\/strong> If you see an error of failed connection with the database then check for the password and username details in the configuration file of WordPress. If the credentials do not match with the database, the WordPress page won&#8217;t be able to load.<\/p>\n<h2><strong>Conclusion <\/strong><\/h2>\n<p>To install WordPress on Debian 12 you need to have a web server and a database server installed first and for that, you can install Apache2 and MariaDB. Next, install the backend for WordPress and then you have to create a database and share its credentials in the WordPress configuration file. Finally, run the local host on the browser and then install the front end of WordPress on Debian 12.<\/p>","protected":false},"excerpt":{"rendered":"<p>To install WordPress on Debian 12 you need to have a web server and a database server installed first and for that, you can install Apache2 and MariaDB. <\/p>","protected":false},"author":110,"featured_media":23446,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-23310","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=23310"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23310\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/23446"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=23310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=23310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=23310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}