Sub topic 6
Installing Certbot
This chapter assumes you are comfortable with a Linux shell and sudo. You also need a Debian or Ubuntu server with nginx already installed. You should control a registered domain name and know which DNS records point to the server. Certbot is an ACME client, which is a program that requests and manages certificates from an ACME certificate authority such as Let's Encrypt.
Installing Certbot does not issue a certificate by itself. It installs the client and the nginx plugin that you will use in a later step.
Install Certbot and the nginx plugin
On Debian and Ubuntu, install Certbot from the operating system's package repositories. The python3-certbot-nginx package adds nginx support.
sudo apt update
sudo apt install certbot python3-certbot-nginx
certbot --versionThe first command refreshes the local package index. The second installs two packages:
| Package | Purpose |
|---|---|
| `certbot` | Provides the ACME client and certificate management commands |
| `python3-certbot-nginx` | Lets Certbot inspect and work with nginx |
The version command confirms that the executable is available. Its output should show a Certbot version, such as certbot 2.x.x. The exact version depends on your Linux distribution and its configured repositories.
Understand the installation boundary
Certbot will later contact the Let's Encrypt ACME service. During that process, the service asks you to prove control of each domain. The nginx plugin can help answer an HTTP-01 challenge by temporarily serving a validation file through nginx.
Installing the plugin does not automatically:
- Change nginx configuration
- Open ports in the firewall
- Create a certificate
- Redirect HTTP traffic to HTTPS
- Schedule certificate renewal
Those actions happen in later configuration steps. Keeping installation separate from certificate issuance makes it easier to identify whether a problem comes from the package, nginx, DNS, or domain validation.
The relationship between the installed components is:
Check the local setup
Confirm that nginx is installed and that its configuration is valid before asking Certbot to use it.
nginx -v
sudo nginx -tThe first command prints the nginx version. The second checks configuration syntax. A successful check ends with a message similar to syntax is ok and test is successful.
If nginx -t fails, fix that error before continuing. Certbot depends on nginx being able to load a valid configuration. Also verify that the domain's DNS records point to this server and that your firewall can eventually allow inbound TCP traffic on ports 80 and 443.
Exercise
What does installing python3-certbot-nginx add to a Certbot installation?
Show answer
It adds the nginx plugin, which lets Certbot work with nginx during domain validation and certificate configuration.