Instructions for installing Certbot for Apache2 and Nginx on a Linux VPS.
With Certbot you can set up free TLS/SSL certificates from Let's Encrypt.
Certbot via Snap (recommended)
-
Update system
First update the system of your server. Open the console and enter the following command:apt update && apt upgrade -y -
Install Snap
Install Snap by entering the following commands in the console:sudo apt install snapd sudo snap install core sudo snap refresh core -
Install Certbot
Install Certbot via Snap:sudo snap install --classic certbot -
Enable command
Make the Certbot command available system-wide:sudo ln -s /snap/bin/certbot /usr/bin/certbot -
Use Certbot
Run Certbot for your web server:- For Apache2:
sudo certbot --apache- For Nginx:
sudo certbot --nginx -
Check certificates
You can find certificates under:/etc/letsencrypt/live/<your-domain>/Show status:
sudo certbot certificates -
Automatic renewal
Certbot automatically creates a cronjob. You can use the following command to test whether the automatic renewal works correctly:sudo certbot renew --dry-run
Certbot via APT
-
Update system
First update the system of your server. Open the console and enter the following command:apt update && apt upgrade -y -
Install Certbot
Install Certbot for your web server:- For Apache2:
sudo apt install certbot python3-certbot-apache- For Nginx:
sudo apt install certbot python3-certbot-nginx -
Use Certbot
Run Certbot for your web server:- For Apache2:
sudo certbot --apache- For Nginx:
sudo certbot --nginx -
Check certificates
You can find certificates under:/etc/letsencrypt/live/<your-domain>/Show status:
sudo certbot certificates -
Automatic renewal
Certbot automatically creates a cronjob. You can use the following command to test whether the automatic renewal works correctly:sudo certbot renew --dry-run