How do I generate and install a Let’s Encrypt SSL certificate?
Asked on Sep 18, 2025
Answer
To generate and install a Let's Encrypt SSL certificate, you typically use the Certbot tool, which automates the process of obtaining and renewing certificates. Certbot is compatible with most web servers and is easy to set up.
# Install Certbot
sudo apt-get update
sudo apt-get install certbot python3-certbot-apache
# Obtain a certificate
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
# Renew automatically
sudo certbot renew --dry-run
Additional Comment:
- Ensure your domain is pointed to your server before running Certbot.
- Certbot can be configured for different web servers, such as Nginx, by replacing "apache" with "nginx" in the command.
- Certificates from Let's Encrypt are valid for 90 days, but Certbot can automatically renew them.
- Always test the renewal process with the "--dry-run" option to ensure it works correctly.
- Check your server's firewall settings to allow traffic on ports 80 and 443.
Recommended Links: