WordPress is one of the most popular and widely used Content Management Systems (CMS) in the world. It can be easily installed and configured on several operating systems including Debian Linux. In this tutorial, we will guide you on how to install WordPress on Debian Latest.
Before starting the installation process, it is always recommended to update and upgrade your system to the latest version available. Use the following command on the terminal to update and upgrade the system:
sudo apt update && sudo apt upgrade
WordPress requires a LAMP stack (Linux, Apache, MySQL, and PHP) to run. To install a LAMP stack, use the following command in the terminal:
sudo apt install apache2 mariadb-server php libapache2-mod-php7.4 php-mysql
When the installation is complete, start the Apache and MariaDB services and enable them to start at system boot time:
sudo systemctl start apache2
sudo systemctl start mariadb
sudo systemctl enable apache2
sudo systemctl enable mariadb
WordPress requires its own MySQL database to store the website data. To create a new MySQL database, use the following commands in the terminal:
sudo mysql -u root -p
Enter your root password when prompted. Once you are connected to the MariaDB server, execute the following MySQL commands to create a new database called wordpressdb with a new user wordpressuser and a strong password:
CREATE DATABASE wordpressdb;
GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
EXIT;
Replace the PASSWORD with a strong password.
Download the latest version of WordPress from its official website using the following command in the terminal:
wget https://wordpress.org/latest.tar.gz
Extract the downloaded archive using the following command:
tar xvf latest.tar.gz
This command will extract the archive into the /var/www/html directory.
Copy the sample configuration file to create your WordPress configuration file:
cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
Open the WordPress configuration file with the following command:
nano /var/www/html/wordpress/wp-config.php
Update the database settings with the ones we have created earlier:
define( 'DB_NAME', 'wordpressdb' );
define( 'DB_USER', 'wordpressuser' );
define( 'DB_PASSWORD', 'PASSWORD' );
define( 'DB_HOST', 'localhost' );
Again, replace PASSWORD with the database password you have used in Step 3.
Set the appropriate permissions to the WordPress directory using the following commands:
sudo chown -R www-data:www-data /var/www/html/wordpress/
sudo chmod -R 755 /var/www/html/wordpress/
Open your favorite web browser and navigate to http://your-server-ip/wordpress or http://your-domain-name/wordpress. Follow the on-screen instructions to complete the installation of WordPress. When prompted, provide the database details we have created earlier.
At this point, you have successfully installed WordPress on Debian Latest. You can now start customizing your website and publish your content. Happy Blogging!
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!