Install WordPress on Debian 11 with Apache and Let’s Encrypt

Install WordPress on Debian 11 with Apache and Let’s Encrypt

WordPress is a widely used free and open-source PHP-based Content Management System. It was developed by Matt Mullenweg and Mike Little in 2003. WordPress can be installed and used on almost any web hosting service, making it the easiest CMS to install and use. Futhermore, with WordPress, you can create a website without any programming knowledge.

The cool features associated with WordPress CMS are:

  • Easy to add Additional Website Editors: easily add/edit/remove additional editors to give others within your organization the ability to manage your website content.
  • Flexible Post Scheduling: Posts can be scheduled to display at later specific dates/times so that you can create content ahead of time and schedule.
  • Restore deleted pages & Rollback Versioning: restore deleted page content before it is deleted permanently and even roll back page text to previous versions using built-in version control features.
  • Automatic Backups – to prevent data loss, automatic daily site-level backups, as well as bare-metal backups, are taken.
  • Integrated News & Blog Posting: use the built-in blogging and blog category management to easily add/edit/remove the content as you need to. Add news articles on an ongoing basis directly from your browser.
  • Managed Website Security: as part of the WordPress managed web hosting services, WordPress’s security, backups, core upgrades, and updates are taken care of for you.
  • Easy to manage: using the intuitive WordPress CMS, you can log in from any modern browser and make changes to your website without programming knowledge.
  • Unlimited pages, posts, and products: it allows one to add images, text, files, links, and embed media right on the content areas without being restricted on the number of pages, posts, or products to can add.
  • Stability and reliability: The third-party plugins are reviewed and tested to help prevent security risks and minimize performance impacts on your website.

By following this guide to the end, you should be able to install WordPress on Debian 11 (Bullseye) with Apache and Let’s Encrypt.

Getting Started.

It is important the system and available packages are updated and upgraded before we proceed. The command used to update the system and its packages is:

sudo apt update && sudo apt upgrade

Step 1 – Install PHP Extensions on Debian 11 (Bullseye)

Since WordPress is PHP-based, we need to install PHP and its extensions on Debian 11 (Bullseye).

The default repository provides PHP 7.4 which can be installed using the command:

sudo apt install php php-common php-mysql php-gmp php-curl php-intl php-mbstring php-xmlrpc php-gd php-xml php-cli php-zip

For PHP8.0 and its extensions, you need to add a third-party repository as below:

sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -

Once added, install PHP8.0 with the command:

sudo apt update
sudo apt install php8.0 php8.0-common php8.0-mysql php8.0-gmp php8.0-curl php8.0-intl php8.0-mbstring php8.0-xmlrpc php8.0-gd php8.0-xml php8.0-cli php8.0-zip

Once installed, you need to configure PHP for WordPress at below:

##For PHP7.4
sudo vim /etc/php/7.4/apache2/php.ini

##For PHP8.0
sudo vim /etc/php/8.0/apache2/php.ini

Edit the file as below:

max_execution_time = 300
upload_max_filesize = 100M
post_max_size = 128M

Step 2 – Install and Configure MariaDB on Debian 11 (Bullseye)

A database is required to serve as storage for WordPress. For this guide, we will install the MariaDB database on Debian 11.

sudo apt install -y mariadb-server mariadb-client

Start and enable MariaDB.

sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure the MariaDB installation.

$ sudo mysql_secure_installation
.....
Enter current password for root (enter for none): Just press Enter
Switch to unix_socket authentication [Y/n] y
Change the root password? [Y/n] 
New password: xxx << Enter Password
Re-enter new password: xxx << Re-Enter Password
.....
Remove anonymous users? [Y/n] y
....
Disallow root login remotely? [Y/n] y
.....
Remove test database and access to it? [Y/n] y
.....
Reload privilege tables now? [Y/n] y
....
Thanks for using MariaDB!

Now login to the shell and created a database for WordPress.

sudo mysql -u root -p

Create the database and remember to replace variables where needed.

CREATE DATABASE wordpress;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'Passw0rd';
GRANT ALL ON wordpress.* TO 'wp_user'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT

Step 3 – Download WordPress on Debian 11 (Bullseye)

Now we will pull the latest WordPress archive file using the wget command below:

cd /tmp
wget https://wordpress.org/latest.tar.gz

Proceed and extract the archive.

tar -xvzf latest.tar.gz

Move the file to the webroot directory.

sudo mv wordpress /var/www/html/wordpress

Set the correct permissions for the path.

sudo chown -R www-data:www-data /var/www/html/wordpress/
sudo chmod -R 755 /var/www/html/wordpress/

Step 4 – Configure Apache Virtual Host for WordPress.

We will then create a virtual host file for WordPress. Create the file using your favorite editor:

sudo vim /etc/apache2/sites-available/wordpress.conf

The file will contain the below lines:

<VirtualHost *:80>
   ServerName wordpress.example.com
   ServerAlias www.wordpress.example.com
   ServerAdmin [email protected]
   DocumentRoot /var/www/html/wordpress

   ErrorLog ${APACHE_LOG_DIR}/wordpress_error.log
   CustomLog ${APACHE_LOG_DIR}/wordpress_access.log combined


   <Directory /var/www/html/wordpress>
      Options FollowSymlinks
      AllowOverride All
      Require all granted
   </Directory>

</VirtualHost>

Remember to replace wordpress.example.com with your own domain name. Save the file, enable the site and activate the rewrite module.

sudo a2ensite wordpress
sudo a2enmod rewrite ssl

Restart Apache for the changes to apply.

sudo systemctl restart apache2

Step 5 – Access the WordPress Web Installer

Access the WordPress Web Installer using the URL http://domain_name. Select the preferred language and proceed.

 

Click Let’s Go to proceed with the installation.

 

Provide the details for the created WordPress database.

 

If the connection goes through, you will see this message.

 

Click Run the installation and proceed to create your WordPress site and admin account.

 

Run the installation, and once it is complete, proceed and login to WordPress Admin.

 

Step 6 – Access and Use WordPress on Debian 11(Bullseye)

Login to the WordPress Admin dashboard by providing the created user credentials.

 

Once logged in, you will see the below dashboard.

 

On this dashboard, you can make several customizations/settings to your website.

To set the theme, background, widgets, and customize your page, click on appearance.

 

You can also add the desired plugins in the Plugins tab.

 

Create and manage users on WordPress in the Users tab. Here, you can create users and assign them a role as a subscriber, author, contributor, editor, or an administrator.

 

Make settings to the WordPress site in the settings tab. The general settings involve setting the site title, site URL, site tagline e.t.c

 

You can also configure the Permalink(permanent link) for your site. This is so important since it avoids exposing the post ID which at times may change when accessed from a different system. The Permanent link is normally obtained from the post title. You can configure how you want the Permalink to appear.

 

Once the made settings have been saved, proceed and create a sample post. In the Posts tab. We already have a sample post created.

 

Create a new one by clicking on Add New and providing the content you need to post.

 

While writing, you can save and preview the content. Once you have completed the task and need to publish it as online content, click publish.

The published content can be viewed using the permalink. Alternatively, visit the site using the URL http://domain_name.

Remember the admin console is moved to the URL http://domain_name/wp-admin after the installation is complete.

Step 7 – Secure WordPress with Let’s Encrypt on Debian 11(Bullseye)

Let’s Encrypt is used to generate free trusted certificates for any FQDN. Begin by installing the required tools:

sudo apt install certbot python3-certbot-apache

Once the Certbot package has been installed, proceed and generate SSL certificates using the command:

sudo certbot --apache

Proceed as shown:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): Enter a valid Email address here          

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y
Account registered.

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: wordpress.example.com
2: www.wordpress.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Requesting a certificate for wordpress.example.com
Created an SSL vhost at /etc/apache2/sites-available/wordpress-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/wordpress-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/wordpress-le-ssl.conf
Redirecting vhost in /etc/apache2/sites-enabled/wordpress.conf to ssl vhost in /etc/apache2/sites-available/wordpress-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://wordpress.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Subscribe to the EFF mailing list (email: [email protected]).

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/wordpress.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/wordpress.example.com/privkey.pem
   Your certificate will expire on 2022-07-18. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again with the "certonly" option. To non-interactively
   renew *all* of your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

That is it! You can now access your WordPress site via HTTPS.

Voila!

That was enough learning. We have successfully installed WordPress on Debian 11 (Bullseye) with Apache and Let’s Encrypt. I hope you found this significant.

See Also: Experience Our for Free VPS Hosting: Enjoy a 30-Day Trial with Risk-Free Servers

COMPLETE DIGITAL SERVER SOLUTIONS FOR ALL

Bare Metal Dedicated Servers

A single tenant, physical server allowing you full access to its resources

Read More

Cloud VPS

The cheapest way to get your own independent computing instance.
Read More

Cloud VDS

Virtualized server platform hosted on enterprise-grade physical servers

Read More

10 Gbps Unmetered Servers

zomiv offers high bandwidth dedicated servers up to 20Gbps.

Read More

ZOMIV NEWSLETTER

Receive the latest news, updates and offers. You can unsubscribe at any time.

ZOMIV NEWSLETTER

Receive the latest news, updates and offers. You can unsubscribe at any time.

zomiv footer logo

HOSTING REDEFINED

44-7-441-399-305
Support Hours: 24x7x365
Sale Office Hours: M-F, 7AM-5PM EST

We accept the following:

visa
mastercard
paypal
download (6)

PRODUCTS

SERVICES

© Copyright 2024, All Rights Reserved by DataCamp Int Limited.

zomiv is a trading name of DataCamp Int Limited. Registered Office: 71-75 Shelton Street, Covent Garden,
London, United Kingdom, WC2H 9JQ. Registered Number 15527709. Registered in England and Wales.
certifications

ZOMIV NEWSLETTER

Receive the latest news, and offers. You can unsubscribe at any time.

  • PRODUCTS
  • LOCATIONS
  • SOLUTIONS
  • COMPANY
This is a staging enviroment

Please tell us more about yourself.

Complete the form below and one of our experts will contact you within 24 hours or less. For immediate assistance contact us.

In order to finalize your application, please read and accept our Terms and Conditions*.

CUSTOM QUOTE REQUEST

Complete the form below and one of our experts will contact you within 24 hours or less. For immediate assistance contact us.

We promise not to sell, trade or use your email for spam. View our Privacy Policy.