Install SSL Certificate using Certbot in Ubuntu Server

Open a terminal or SSH into your server and update the package list:

sudo apt update

You’ll need to install snapd for installing Certbot, Snap is pre-installed and ready to go on Ubuntu 18.04 and above.

Run this command on the command line on the machine to install Certbot.

sudo snap install --classic certbot

Execute the following instruction on the command line on the machine to ensure that the certbot command can be run.

sudo ln -s /snap/bin/certbot /usr/bin/certbot

Run this command to get a certificate and have Certbot edit your apache configuration automatically to serve it, turning on HTTPS access in a single step.

sudo certbot certonly --apache -d yourwebsite.com

The Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire. You will not need to run Certbot again, unless you change your configuration. You can test automatic renewal for your certificates by running this command:

sudo certbot renew --dry-run

To confirm that your site is set up properly, visit https://yourwebsite.com/ in your browser and look for the lock icon in the URL bar.


Leave a Reply 0

Your email address will not be published. Required fields are marked *