ShinChven's Blog

Install Certbot on Linux With Nginx - 在 Linux 上安装 Certbot 和 Nginx 插件 - Ubuntu / CentOS

Mon Nov 09 2020

Certbot is the command line tool for Let's Encrypt, with it, you can deploy and renew SSL certificates easily through simple commands.

While official guide telling people to install it with snapd, I found it more simple to install it via each Linux distributions' onboard package manager.

So here we go…

Install On Ubuntu 20.04


sudo apt install certbot python3-certbot-nginx

Install On CentOS 7


sudo yum install epel-release
sudo yum install certbot python2-certbot-apache mod_ssl

Install Certificates

Run the following command to install certificates for your domain.

sudo certbot --nginx

The command will show you a list of domains you have on your server, select the one you want to install SSL certificate for, and it will do the rest for you.

Renew Certificates

Run the following command to renew certificates for your domain.

## Test
sudo certbot renew --dry-run
## Renew
sudo certbot renew