Step-by-Step Guide: Installing WordPress on Debian 12 Minimal Server

In this tutorial, we’ll walk through the process of setting up a WordPress blog from scratch on a Debian 12 Minimal Server. By following these step-by-step instructions, even users with minimal server administration experience can successfully deploy a WordPress site on their server.

Prerequisites:

  • Access to a Debian 12 Minimal Server with root privileges
  • Basic familiarity with the Linux command line

Step 1: Update System Packages Ensure your system’s package repositories are up-to-date by running the following commands:

bash

sudo apt update
sudo apt upgrade

Step 2: Install LAMP Stack WordPress requires a web server, a database, and PHP. We’ll install these components by setting up a LAMP (Linux, Apache, MySQL, PHP) stack.

bash

sudo apt install apache2 mariadb-server php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

Step 3: Secure MySQL Installation Run the MySQL secure installation script to enhance the security of your MySQL installation and set a root password:

bash

sudo mysql_secure_installation

Step 4: Create MySQL Database and User for WordPress Log in to the MySQL shell as the root user:

bash

sudo mysql -u root -p

Then, create a new database and user for WordPress:

sql

CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Download and Configure WordPress Download the latest version of WordPress and extract it into the Apache web root directory:

bash

cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvzf latest.tar.gz
sudo mv wordpress/* .
sudo rm -rf wordpress latest.tar.gz

Step 6: Configure WordPress Create a configuration file for WordPress and set appropriate permissions:

bash

sudo cp wp-config-sample.php wp-config.php
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Step 7: Complete WordPress Installation via Web Interface Open a web browser and navigate to your server’s IP address or domain name. Follow the WordPress installation wizard, providing the database name, username, password, and server information when prompted.

Step 8: Secure WordPress Installation For security purposes, it’s essential to configure WordPress properly. Follow best practices such as:

  • Changing default admin username
  • Using strong passwords
  • Keeping WordPress, themes, and plugins updated
  • Installing security plugins like Wordfence or Sucuri

Conclusion: Congratulations! You have successfully installed WordPress on your Debian 12 Minimal Server. You can now start creating content and customizing your WordPress blog. If you encounter any issues during the installation process, feel free to ask for assistance in the forum.