Let's Encrypt is a free, automated certificate authority run by the nonprofit Internet Security Research Group (ISRG). Certbot is the ACME client from the Electronic Frontier Foundation (EFF) that requests a Let's Encrypt certificate, configures HTTPS on your web server and renews it automatically. On a dedicated server you have root access and full control of the configuration, so you can install Certbot in a few minutes, secure every domain you host and never pay for domain-validated SSL certificates again. This tutorial covers installation on Ubuntu, certificate issuing with the Nginx or Apache plugin, automatic renewal, security hardening and the most common errors. Plans begin at US$19.90/month.
Key Takeaways
- Install Certbot with snap, the method the EFF recommends: it updates itself and ships a renewal timer.
- Point the domain's DNS record at the server and open ports 80 and 443 before you request a certificate.
- Certificates are valid for 90 days today, 64 days from February 2027 and 45 days from February 2028. Let the Certbot timer manage renewal instead of a fixed cron schedule.
- Tools required: SSH access with sudo, a domain name, and about 10 minutes.
Prerequisites
Before you get started, check these requirements for installation. Every command in this tutorial runs over an SSH connection as a regular user with sudo, so there is no need to log in as root, and the whole setup takes about ten minutes once you get started.
- A server with Ubuntu 22.04 or 24.04 and SSH access as root or a user with sudo. Our guide to configuring a Linux server covers the first steps.
- A web server already running, such as Nginx or an Apache server, with a site for your domain. With Caddy and its automatic HTTPS, you can skip Certbot entirely.
- A domain name whose DNS points at the public IP of the server (type A for IPv4, AAAA for IPv6). Let's Encrypt checks this DNS record during validation.
- Ports 80 and 443 open in the firewall you control, for example with
sudo ufw allow 'Nginx Full'once your UFW firewall rules are in place. The HTTP challenge uses TCP port 80, even if your site only serves HTTPS afterwards, so the network path from the internet to the server must stay open on that port.
A small machine is enough for TLS: a KS-C dedicated server, with 6 cores and 32 GB of ECC memory, can terminate HTTPS for dozens of sites. On shared hosting, the hosting provider manages certificates for you through its control panel. On a dedicated server or a VPS, you manage each certificate and its renewal yourself, with full control over the configuration and no extra cost. The same steps work on a VPS or a cloud server, as long as the domain resolves to the machine.
Step 1: Update Your System
Connect over SSH with your admin password or, better, an SSH key, and update the package index and installed software before installing anything else:
sudo apt update && sudo apt upgrade -yRemove any old Certbot packages installed from apt or with certbot-auto, so the snap version is the only one on the system:
sudo apt remove certbotStep 2: Install Certbot
The official, recommended method on Ubuntu is snap. It installs the current Certbot version and its plugins, and updates them automatically:
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
certbot --versionThe last command prints the Certbot version, which confirms the installation. The snap is updated automatically in the background, so you always run the current release with the latest security fixes.
Alternative: pip. On a VPS or other systems without snapd, install Certbot in a Python virtual environment under /opt:
sudo apt install python3-venv
sudo python3 -m venv /opt/certbot
sudo /opt/certbot/bin/pip install certbot certbot-nginx
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbotWith pip, you manage updates yourself with sudo /opt/certbot/bin/pip install --upgrade certbot-nginx certbot, and you must create the renewal cron job yourself.
Step 3: Obtain and Install Your SSL Certificate
Certbot can obtain the certificate and edit your web server configuration in one command, or obtain it only and let you configure the server. Use the plugin for the web server you run: our Nginx and Apache comparison helps if you have not chosen one yet.
With Nginx: the plugin edits the server block that matches your domain, as created in our step-by-step Nginx setup:
sudo certbot --nginx -d example.com -d www.example.comWith Apache: enable the SSL module first, then run the plugin:
sudo a2enmod ssl
sudo certbot --apache -d example.com -d www.example.comThe first run asks for an email address for important account notices and asks you to accept the subscriber agreement and the privacy policy. Certbot will then perform the HTTP challenge, an authentication step that proves you control the domain, installs the signed certificate in the virtual host configuration file and adds the redirect from HTTP to HTTPS. The Nginx or Apache plugin also reloads the server, so there is no additional step. Each command takes less than a minute.
Get the certificate only. If you prefer to manage the server configuration yourself, run another software stack, or replace an existing certificate on a mail or VPN service, use certonly with the webroot authentication method, which places a challenge file in your site directory:
sudo certbot certonly --webroot -w /var/www/example -d example.comThe files land in /etc/letsencrypt/live/example.com/: fullchain.pem is the certificate with its chain, and privkey.pem is the private key. Certbot will generate a private key for each certificate, so there is no need to install OpenSSL tools or create a CSR by hand. Point your service at these two paths in its conf file; for Nginx, that means ssl_certificate and ssl_certificate_key.
Wildcard certificates. A certificate for *.example.com requires DNS validation instead of HTTP. Use the DNS plugin for your DNS provider, which creates the TXT entry through the provider's API with a local credentials file, or --manual --preferred-challenges dns to add it yourself. The manual method cannot renew automatically, so prefer a plugin.
Step 4: Verify the Installation
Check that the certificate is in place and see how Certbot manages it:
sudo certbot certificatesThe output lists each certificate, its domains, its expiry date and the paths of its files: everything you need to manage it. Then open https://example.com in a browser: the padlock should show a certificate issued by Let's Encrypt. From another machine, you can also test the chain and the protocol version:
openssl s_client -connect example.com:443 -servername example.comThe -servername option sends SNI, which servers hosting several domains on one IP need to pick the right certificate.
Manage your certificates
A few commands cover day-to-day certificate management:
| Command | What it does |
|---|---|
| sudo certbot certificates | Lists every certificate Certbot manages |
| sudo certbot --expand -d example.com -d new.example.com | Adds a domain to an existing certificate |
| sudo certbot delete --cert-name example.com | Removes a certificate you no longer use |
| sudo certbot revoke --cert-name example.com | Revokes a certificate if the private key leaked |
| sudo certbot renew --cert-name example.com | Renews one certificate now |
If you manage many domains, one certificate per site keeps renewals independent and easier to manage: a DNS issue on one domain does not block the others. Certbot stores each renewal configuration in /etc/letsencrypt/renewal/, so you can manage options per certificate, and the Certbot documentation lists every option.
Automatic SSL Renewal with Certbot
The snap package sets up automatic renewal with a systemd timer that runs twice a day, so you never manage expiry dates by hand. Certbot renews each certificate when it is close to expiry, then reloads the web server through the plugin. Check the timer status:
systemctl list-timers | grep certbotThen test the full renewal process without issuing real certificates. Certbot will perform every step against the staging environment, including domain authentication, a check worth repeating after each change:
sudo certbot renew --dry-runThis dry run already tests the 2027 rules. A dry run requests test certificates from the Let's Encrypt staging environment, and since October 14, 2026, staging issues certificates valid for 64 days (Source: Pasquale Pillitteri, “Let’s Encrypt announces 64-day TLS certificates from February 10, 2027”, October 2026). If the dry run succeeds today, your renewal setup will keep working when production switches to 64 days on February 10, 2027. Run it now rather than in February.
If you use certonly, add a deploy hook so the server reloads after each renewal; it is the simplest way to automate the last step:
sudo certbot renew --deploy-hook "systemctl reload nginx"Shorter certificate lifetimes. All publicly trusted certificate authorities are moving to shorter validity periods. For Let's Encrypt, the default certificate drops from 90 to 64 days on February 10, 2027 (Source: Let’s Encrypt, “64-Day Certificate Lifetimes Coming Feb 2027”, October 7, 2026), and the last certificates issued under the old rule expire on May 11, 2027. The default then drops to 45 days on February 16, 2028 (Source: ISRG, “Decreasing Certificate Lifetimes to 45 Days”), and an opt-in profile already issues certificates at that length.
Automated renewal through the timer handles this with no change, since Certbot decides when renewing is due based on the lifetime of each certificate. A renewal job hard-coded to a fixed number of days does not: the troubleshooting section shows how to find one.
Security Hardening Recommendations (HSTS, SSL config)
- Use modern TLS settings. The Mozilla SSL Configuration Generator produces a recommended configuration for each web server, with TLS 1.2 and 1.3 only.
- Enable HSTS once HTTPS works everywhere:
add_header Strict-Transport-Security "max-age=31536000" always;in Nginx, or the equivalent header with the headers module on other servers.
- Add a CAA record in your DNS zone, such as
example.com. CAA 0 issue "letsencrypt.org", so no other CA can issue for your domain.
- Remove OCSP stapling directives. Let's Encrypt ended its OCSP service in 2025, so
ssl_stapling onnow only produces warnings.
- Protect the private key. Control access to
/etc/letsencrypt: keep it readable by the root admin only, and include it in your backups with the rest of your server data.
Encryption protects the data and passwords your users send through forms, and the personal data your site stores. For a complete web stack around HTTPS, see our guides to a website on a dedicated server and an ecommerce dedicated server, where a valid certificate is required for card payments.
Troubleshooting Common Issues
| Issue | Likely cause | Fix |
|---|---|---|
| Timeout during connect | Port 80 blocked by a firewall | Open TCP port 80 and retry |
| DNS problem: NXDOMAIN | DNS record missing or not propagated | Check the zone, wait, retry |
| unauthorized on the challenge | Another server answers for the domain | Point the domain at this server's IP |
| too many certificates | Rate limit reached | Test with --dry-run or the staging environment |
| Renewal works but the site shows the old certificate | Web server not reloaded | Add a deploy hook to reload the service |
Find hard-coded renewal intervals. A cron job that renews every 60 days leaves only 4 days of margin under the 2027 rules, and lets certificates expire under the 2028 ones. Let's Encrypt recommends searching cron jobs, wrapper scripts and runbooks for hard-coded values such as 83, 80 or 60 (Source: Help Net Security, October 2026). Start with the places a renewal job usually lives:
sudo grep -rn certbot /etc/cron* /etc/systemd/system /usr/local/bin
sudo crontab -lRemove any custom job you find and rely on the Certbot timer, or, if you must keep a script, make it renew at about two thirds of the certificate lifetime rather than after a fixed number of days.
Run sudo certbot renew --dry-run after every change to the web server configuration, and read /var/log/letsencrypt/letsencrypt.log for the full error. Most issues come from the network path: a firewall rule, a reverse proxy or a DNS change that blocks the challenge.
Frequently Asked Questions
What is the difference between Certbot and Let's Encrypt?
Let's Encrypt is the CA that signs the certificate. Certbot is one ACME client that talks to it: it proves you control the domain, requests the certificate and renews it. Other clients such as acme.sh or the one built into Caddy work with Let's Encrypt too.
Is Certbot deprecated?
Not at all. Certbot is actively maintained by the EFF with regular releases and additional plugins, an open-source community on GitHub and a community forum shared with Let's Encrypt, where people post answers to most questions. What is deprecated is the old certbot-auto script and the outdated apt packages; the snap install is the current method.
Why doesn't everyone use Let's Encrypt?
Some organizations need organization-validated or extended-validation certificates, longer lifetimes, a support contract, or a commercial CA with a payment method and warranty. For most websites, a free domain-validated certificate is enough. The Let's Encrypt FAQ covers trust and compatibility questions in detail.
Does Let's Encrypt still work?
It does. Let's Encrypt remains one of the most widely used certificate authorities on the internet. The main change is shorter certificate lifetimes, which automated renewal absorbs.
Can I use Certbot on other Linux distributions besides Ubuntu?
You can. The snap method works on Debian, Fedora and most operating systems with snapd, and the pip method works on almost any Linux system. Debian and RHEL-based systems also ship Certbot packages, which can be older. The Certbot FAQ and the official instructions on the EFF site list the steps for each operating system, from installing snapd to the first certificate.
Secure your sites on bare metal Kimsufi dedicated servers from US$19.90/month. Root access, fixed monthly pricing, built-in DDoS protection.
