How Install Let’s Encrypt SSL on Ubuntu with Certbot

Here are the steps to install Let’s Encrypt SSL on Ubuntu with Certbot:

  1. First, update your Ubuntu system by running the following command:
    sudo apt update
  2. Install the Certbot package by running the following command:
    sudo apt install certbot
  3. Once Certbot is installed, you can use it to obtain and install an SSL certificate for your domain. To obtain a certificate, run the following command:
    sudo certbot certonly --webroot --webroot-path /var/www/html -d example.com -d www.example.com

    Replace example.com and www.example.com with your own domain name(s). This command will generate the necessary files and store them in /etc/letsencrypt/live/.

  4. Once the SSL certificate is obtained, you can configure your web server to use it. For example, if you’re using Apache, you can enable SSL and configure it to use the certificate by running the following commands:
    arduino
    sudo a2enmod ssl
    sudo systemctl restart apache2
    sudo nano /etc/apache2/sites-available/default-ssl.conf

    In the default-ssl.conf file, find the following lines and update them with the appropriate values:

    bash
    SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

    Replace these lines with the following:

    bash
    SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

    Save and close the file.

  5. Finally, restart Apache to apply the changes:
    sudo systemctl restart apache2

Your website should now be using a valid SSL certificate from Let’s Encrypt.