How to Install Let's Encrypt SSL with LAMP Stack on Rocky Linux 8

Let's Encrypt is a non-profit certificate authority run by Internet Security Research Group that provides X.509 certificates for Transport Layer Security encryption at no charge. In this article, we are going to learn how to install Let's Encrypt SSL on Rocky Linux 8. So, let’s get started.

Checkout the Let's Encrypt SSL Project Here.

Get started with $5 VPS from CrownCloud. Check our latest offers : CrownCloud VPS [ 24x7 In-House Customer Support ]

Pre-requisites :

  • A system with Rocky Linux 8 installed and running.

  • root access to the system.

  • LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB, and PHP).

Once you're all set, we'll proceed with Let's Encrypt SSL installation and configuration.

Install Certbot

Let us begin with installing Certbot.

dnf install epel-release -y

dnf install certbot python3-certbot-apache -y

Configuring Apache vHost

Create a new apache configuration file dev1.domainhere.info.conf for the domain with the following command:

nano /etc/httpd/conf.d/dev1.domainhere.info.conf

Add the following codes:

  <VirtualHost *:80>
  ServerName dev1.domainhere.info
  ServerAlias dev1.domainhere.info
  DocumentRoot /var/www/html

  <Directory /var/www/html/>
      Options -Indexes +FollowSymLinks
      AllowOverride All
  </Directory>

  ErrorLog /var/log/httpd/dev1.comainhere.info-error.log
  CustomLog /var/log/httpd/dev1.comainhere.info-access.log combined
  </VirtualHost>

Change dev1.domainhere.info with Your Domain Name.

Now, press the Esc key, and type in :wq! and press the Enter key to save and exit the file.

Now, restart & check the apache with the following commands:

systemctl restart httpd

systemctl status httpd

Enable Firewall:

firewall-cmd --permanent --add-service=http

firewall-cmd --permanent --add-service=https

firewall-cmd --reload

Generating Let's Encrypt SSL

Generate Let's Encrypt SSL with the following command.

certbot --apache

Restart Apache

Restart apache to avoid getting error messages.

systemctl restart httpd

Now you have successfully installed Let's Encrypt SSL with LAMP Stack on Rocky Linux 8.