Step-by-Step Guide
- Update the Package Index
Open a terminal and update the package index to ensure you have the latest information about available packages:
sudo yum update -y
- Enable the EPEL Repository
Certbot is available in the EPEL (Extra Packages for Enterprise Linux) repository. Enable it using the following command:
sudo yum install epel-release -y
- Install Certbot
Install Certbot using theyum
package manager:
sudo yum install certbot python3-certbot-nginx -y
For Apache, you would install the Apache plugin:
sudo yum install certbot python3-certbot-apache -y
- Obtain an SSL Certificate
To obtain an SSL certificate using Certbot, run the following command. Replaceyour_domain
with your actual domain name:
sudo certbot --nginx -d your_domain -d www.your_domain
If you are using Apache, use:
sudo certbot --apache -d your_domain -d www.your_domain
Follow the prompts to complete the certificate issuance process. Certbot will automatically configure your web server to use the new certificate.
- Verify SSL Certificate Installation
After obtaining the certificate, you can verify the SSL configuration by visiting your domain in a web browser. You should see a secure connection indicated by a padlock icon in the address bar. - Renew SSL Certificates Automatically
Certbot sets up a cron job to automatically renew the certificates before they expire. You can test the renewal process with the following command:
sudo certbot renew --dry-run
This command simulates the renewal process to ensure that it will work correctly.
- Manual Renewal (Optional)
If you prefer to manually renew the certificates, you can run:
sudo certbot renew
- Revoke a Certificate (Optional)
If you need to revoke a certificate for any reason, use the following command:
sudo certbot revoke --cert-path /etc/letsencrypt/live/your_domain/fullchain.pem
Replace your_domain
with your actual domain name.
- Remove a Certificate (Optional)
If you need to remove a certificate, use the following command:
sudo certbot delete --cert-name your_domain
Replace your_domain
with your actual domain name.
- Check Certbot Logs
Certbot logs its activities, including certificate issuance and renewal attempts, in/var/log/letsencrypt/
. You can check these logs if you encounter any issues:sudo less /var/log/letsencrypt/letsencrypt.log
- Advanced Configuration (Optional)
For more advanced configurations, you can edit Certbot’s configuration files located in/etc/letsencrypt/
. For example, you can customize the renewal parameters by editing the renewal configuration files in/etc/letsencrypt/renewal/
.