Install Let’s Encrypt SSL on Ubuntu 20.04: The easiest way to install the Let’s Encrypt certificate is by using Certbot with instructions for the various web server or hosting platforms (Nginx, Apache)
In this tutorial, we’ll use Certbot to Install Let’s Encrypt SSL on Ubuntu 20.04 using certbot and step up the SSL certificate to automatically renew.
Prerequisites:
- Login from root user.
- you must point domain name to your server ip and confifire apache.
Step 1 — Configure Apache Virtual Host
In the First Step, you need to virtual host configuration check this up, open the virtual host file for your domain using nano
or your preferred text editor:
sudo nano /etc/apache2/sites-available/00-default.conf
Now you need to find these two lines ServerName
and ServerAlias
lines. They should look like this:/etc/apache2/sites-available/00-default.conf
...
ServerName your_domain
ServerAlias www.your_domain
...
and replace your_domain with your original domain name
If you already have your ServerName
and ServerAlias
set up like this, you can exit the editor by typing CTRL+X
, then Y
and ENTER
to confirm.
sudo apache2ctl configtest
Step 2 — Installing Certbot In Ubuntu
To install a free SSL certificate with Let’s Encrypt, we need to install the Certbot software on the server.
we can use default Ubuntu package repositories to install certbot, two packages are required: certbot
, and python3-certbot-apache
. this module will install automate an SSL certificate. run this command:
sudo apt install certbot python3-certbot-apache
Step 3 — Install an SSL Certificate
Certbot provides many ways to install SSL certificates through modules. This plugin can do reconfiguring Apache and reload the configuration whenever necessary. to install SSL run this command:
sudo certbot --apache
First, it will ask you for a valid e-mail address and enter your email address and get renewal notifications. you can confirm your email address by pressing A
and then ENTER
The next step will ask terms and condition agreement Press A for Yes
(A)gree/(C)ancel: A
Next, you’ll install SSL include alias domain then leave it blank and hit ENTER
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: your_domain
2: www.your_domain
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
the final step will ask redirect to force SSL select 2 and hit the enter ENTER
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
Congratulations! You have successfully enabled https://your_domain and
https://www.your_domain
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=your_domain
https://www.ssllabs.com/ssltest/analyze.html?d=www.your_domain
That’s it installation of Let’s Encrypt on Ubuntu 20.04 is now successful.
Conclusion
In this article, you’ve installed the Let’s Encrypt SSL certificate for your domain on ubuntu. If you have further questions about using Certbot feel free to comment on this post.