
In this blog post, we will explain how to install Let’s Encrypt on Ubuntu 24.04 OS. Let’s Encrypt is a non-profit certificate authority that issues free SSL certificates, enabling HTTPS encryption for websites. The key features of Let’s Encrypt are that it offers free SSL/TLS certificates for everyone, the process is automated, making it easier to manage, and the community is huge for support and troubleshooting. The lifespan of a Free Let’s Encrypt SSL certificate is 90 days, but certificate renewal is configured on the server with a single command and a cron job (a time-based job scheduler in Unix-like operating systems that automates tasks by running commands or scripts at specified intervals).
Installing a Let’s Encrypt SSL certificate is a straightforward process that may take a couple of minutes. In this blog post, we will install Free Let’s Encrypt on Apache and Nginx web servers. Let’s get started with Let’s Encrypt on Ubuntu 24.04!
Table of Contents
Prerequisites
- A server running Ubuntu 24.04 OS
- User privileges: root or non-root user with sudo privileges
- A valid domain with a pointed A record to the server, which is key for using Let’s Encrypt on Ubuntu 24.04
Update the System
Before we begin installing the web servers or the Let’s Encrypt SSL certificate, we will update the system packages to their latest versions. Execute the following command to get ready for Let’s Encrypt on the Ubuntu 24.04 setup.
sudo apt update -y && sudo apt upgrade -y
What is Certbot?
Certbot is a free, open-source tool for automatically obtaining and renewing SSL/TLS certificates from Let’s Encrypt. The key functions of Certbot are: automated certificate issuance, web server configuration, automatic renewal, domain validation, compatibility, and user-friendly. Certbot user automated process and the ACME protocol to verify the domain ownership and issue the certificate. To validate a website, Certbot on the web server proves ownership by completing a set of challenges, such as placing a specific file in a public directory. Let’s Encrypt then checks that the challenges are completed correctly before issuing the certificate, which works smoothly with Ubuntu 24.04.
In the following paragraphs, we will explain how to install Certbot for Apache or Nginx.
Install Free Let’s Encrypt with Apache as a web server
We assume that you already have an Apache web server installed on your server. If not, then you can install it with the following command:
sudo apt install apache2 -y
Before we install Free Let’s Encrypt, we must have an Apache virtual host with a valid domain. To create an Apache virtual host on Ubuntu 24.04, execute the following command:
sudo touch /etc/apache2/sites-available/website.conf
Open the file and paste the following lines of code:
<VirtualHost *:80>
ServerName yourdomainhere.com
DocumentRoot /var/www/html/
<Directory /var/www/html/>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save the file and close it.
Enable the Apache configuration files for your Website, including the rewrite module.
sudo a2enmod rewrite
sudo a2ensite website.conf
sudo a2dissite 000-default.conf
Check the Apache2 syntax:
apachectl -t
You should receive the following output:
root@host:/var/www/html/# apachectl -t
Syntax OK
If the syntax is OK, restart the Apache service.
systemctl restart apache2
Now, the next step is to install the Certbot tool for Apache:
sudo apt install certbot python3-certbot-apache -y
To obtain an SSL certificate with Certbot, execute the following command:
sudo certbot --apache -d yourdomain.com
After executing the command, you will be asked a couple of questions, and the output after generating the SSL certificate should look like this:
root@host:~# sudo certbot --apache -d yourdomain.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel): admin@yourdomain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.5-February-24-2025.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Yes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Yes
Account registered.
Requesting a certificate for yourdomain.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/yourdomain.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/yourdomain.com/privkey.pem
This certificate expires on 2026-02-06.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for yourdomain.com to /etc/apache2/sites-available/website-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://yourdomain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
That was for the Apache web server. Now, let’s proceed to the Nginx web server in the next heading.
Install Free Let’s Encrypt with Nginx as a web server
We assume you already have a Nginx installed on your server. If not, then you can install it with the following command:
sudo apt install nginx -y
Before we install Free Let’s Encrypt, we must have an Nginx virtual host with a valid domain. To create an Nginx virtual host appropriate for Ubuntu 24.04, execute the following command:
sudo touch /etc/nginx/conf.d/website.conf
Open the newly created file and paste the following lines of code:
server {
listen 80;
server_name yourdomainhere.com
root /var/www/html/;
index index.html index.php;
server_tokens off;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
client_max_body_size 64M;
location / {
try_files $uri $uri/ /index.php?$args;
}
}
Save the file and close it.
Next, check the Nginx syntax:
nginx -t
You should receive the following output:
root@host:/var/www/html# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
You can proceed with the Nginx restart:
sudo systemctl restart nginx
Now, the next step is to install the Certbot tool for Nginx:
sudo apt install certbot python3-certbot-nginx -y
To obtain an SSL certificate with Certbot, execute the following command. This will complete the Let’s Encrypt on Ubuntu 24.04 setup for your server.
sudo certbot --nginx -d yourdomain.com
root@host:~# sudo certbot --nginx -d yourdomain.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for yourdomain.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/yourdomain.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/yourdomain.com/privkey.pem
This certificate expires on 2026-02-06.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for yourdomain.com to /etc/nginx/conf.d/website.conf
Congratulations! You have successfully enabled HTTPS on yourdomain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Conclusion
The procedure for installing Let’s Encrypt with Apache or Nginx is almost the same, except for using the Certbot tool. To make it simple, let’s see the differences:
# Installing Certbot for Apache
sudo apt install certbot python3-certbot-apache -y
#Obtaining SSL certificate with Certbot and Apache
sudo certbot --apache -d yourdomain.com
===================================================
# Installing Certbot for Nginx
sudo apt install certbot python3-certbot-nginx -y
#Obtaining SSL certificate with Certbot and Nginx
sudo certbot --nginx -d yourdomain.com
That’s it. You successfully installed a Free Let’s Encrypt SSL certificate on Ubuntu 24 using Apache and Nginx as a web server. This guide should help you manage Let’s Encrypt on Ubuntu 24.04 with ease.
Of course, you don’t have to install Free Let’s Encrypt on Ubuntu 24.04 if you have difficulties and are not familiar with Linux. You can always contact our technical support. You only need to sign up for one of our NVMe VPS plans and submit a support ticket. We are available 24/7 and will attend to your request promptly.
If you liked this post about installing a Free Let’s Encrypt SSL certificate on Ubuntu 24.04, please share it with your friends or leave a comment down below.