1. SSH into the Ubuntu server.
  2. Install snapd:
    => sudo apt update
    => sudo apt install snapd
    To test if snapd installed correctly, run:
    => sudo snap install hello-world
    Output should include something like:
    hello-world 6.4 from Canonical installed
    Then run:
    => hello-world
    Output: Hello world!
  3. Update snapd:
    => sudo snap install core; sudo snap refresh core
  4. Remove any pre-installed versions of certbot:
    => sudo apt-get remove certbot
  5. Install classic certbot with snap:
    => sudo snap install --classic certbot
  6. Check if certbot is installed correctly:
    => sudo ln -s /snap/bin/certbot /usr/bin/certbot
  7. Generate and install certificate:
    => sudo certbot --nginx
    Now follow the instructions from certbot to complete the installation.
    When finished, it will:
    • Update the Nginx config file
    • Create a cron job to automatically renew the SSL before expiry
  8. Test if the auto-renewal is working:
    => sudo certbot renew --dry-run