Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install a Free SSL Certificate on a Linux VPS with Certbot

Install Certbot with Snap, get a Let's Encrypt certificate for Apache or Nginx and set up auto-renewal.

SSL and Security2 min read5 screenshots

What you need

  • A Linux VPS with Apache or Nginx already running.
  • A registered domain whose DNS points to the VPS.
  • SSH access with sudo rights.

Step 1: Update the system

sudo apt update && sudo apt upgrade
Updating the packages

Step 2: Install Certbot

Install snapd first:

sudo apt install snapd && sudo snap install core
Installing snapd

Then install Certbot:

sudo snap install --classic certbot
Installing Certbot with Snap

Link the command so it works everywhere:

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

Step 3: Get the certificate

For Apache:

sudo certbot --apache

For Nginx:

sudo certbot --nginx
Certbot requesting the certificate

Enter your email, accept the terms, choose your domain, and let Certbot set up the redirect to HTTPS.

Step 4: Check the result

Open your site with https:// and check the padlock in the browser.

The website served over HTTPS

Step 5: Auto-renewal

Let's Encrypt certificates last 90 days. The Snap package normally adds a renewal timer by itself. You can test it with:

sudo certbot renew --dry-run

If you prefer a cron job, open the crontab:

sudo crontab -e

and add a line that runs twice a day:

0 0,12 * * * /usr/bin/certbot renew --quiet

Quick recap

  • Install snapd, then Certbot, and link the command.
  • Run certbot --apache or certbot --nginx.
  • Test renewal with certbot renew --dry-run.