How to install letsencrypt on ubuntu 20.04

This tutorial will show step by step on How to install letsencrypt on ubuntu 20.04. Certbot provides an easy way to obtain and install trusted certificates for free from Let’s Encrypt. With Certbot, you can establish a secure encrypted connection between a web server and a client browser.
 The SSL certificate issued by Let’s Encrypt is only valid for 90 days and you will need to renew it in order to get a new certificate.

In this tutorial, you will learn the following 

  • Install Certbot 
  • configuration
  • Obtain SSL 
  • auto-renew SSL

Certbot Requirement

  • familiar with  Linux commands line.
  • remote server access (AWS instance or Linode server).
  • user with Sudo access.

How to install letsencrypt on ubuntu 20.04

for Linode server run the following command to connect to your server.

ssh user@my_ip_address

for an AWS account, you may need to change to security key file ownership with the following command.

sudo chmod 600 aws_perm_access_file.pem

Then run the below command to connect to your remote server.

 ssh -i aws_perm_access_file.pem ubuntu@my_ip_address

Download and install certbot for repository updates.

sudo add apt-repository ppa:certbot/certbot
sudo apt-get update

Install certbot with the following commands

sudo apt-get install certbot python -certbot-apache

configure apache virtual host

Navigate to sites available folder

cd /etc/apache2/sites-available/

you can remove the existing apache default configuration file and create a new virtual host.

sudo nano my_vhost_http.conf

copy-paste the apache configuration and replace [example.com] with your domain name.

<VirtualHost *:80>
     ServerAdmin webmaster@example.com
     DocumentRoot /var/www/example.com/
     ServerName example.com
     ServerAlias www.example.com

     <Directory /var/www/example.com/>
        Options +Includes
        Options +FollowSymlinks -Indexes
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
  • Choose how you want your certificate by selecting any of the twp option below.

certbot will generate SSL certificate and create a new apache configuration file for your new virtual host HTTPS by running the below command.

sudo certbot --apache

The certbot will generate the SSL certificate only without modifying your apache configurations file by running the below command.

sudo certbot certonly  --apache

since I do not have https apache configuration I will choose the

sudo certbot --apache

Generate SSL Certificate

After running the above command, certbot require an email address, they will message you if anything goes wrong

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache Enter email address (used for urgent renewal and security notices) 

(Enter 'c' to cancel): example@gmail.com

choose A to agree to certbot terms of service.

Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at 
https://acme-v02.api.letsencrypt.org/directory
 
(A)gree/(C)ancel: A

if you want to receive an update choose Yes.

Would you be willing 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: Y

Choose the domain names you want to obtain a certificate.

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.
 
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting vhost in /etc/apache2/sites-enabled/my_vhost_http.conf to ssl vhost in /etc/apache2/sites-available/my_vhost_http-le-ssl.conf

Next…

Congratulations! You have successfully enabled https://example.com and
 https://www.example.com
 You should test your configuration at:
 https://www.ssllabs.com/ssltest/analyze.html?d=example.com
 https://www.ssllabs.com/ssltest/analyze.html?d=www.example.com
 
 IMPORTANT NOTES:
 Congratulations! Your certificate and chain have been saved at:
 /etc/letsencrypt/live/example.com/fullchain.pem
 Your key file has been saved at:
 /etc/letsencrypt/live/example.com/privkey.pem
 Your cert will expire on 2019-11-30. To obtain a new or tweaked
 version of this certificate in the future, simply run certbot again
 with the "certonly" option. To non-interactively renew all of
 your certificates, run "certbot renew"
 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

Now verify your website domain using
 https://your_domain.com

Renew SSL certificate with corn service.

the following command creates a corn task to automate the SSL certificate renewal.

crontab -e

add the following to renew certbot weekly

@weekly /usr/bin/certbot renew >> /var/log/letsencrypt-renew.log

save and restart cron service 

sudo service restart cron restart

After setting up let’s encrypt you may want to make use of some command for more configuration.

The missing part here is how to link your domain to route53, which I will release in few days, be expectant.

13 thoughts on “How to install letsencrypt on ubuntu 20.04

  1. Just want to say your article is as surprising. The clarity in your post is just nice and i can assume you’re an expert on this subject. Well with your permission let me to grab your feed to keep updated with forthcoming post. Thanks a million and please carry on the gratifying work.

  2. Based on my observation, after a foreclosures home is sold at a sale, it is common with the borrower to still have any remaining balance on the mortgage. There are many creditors who make an effort to have all charges and liens cleared by the up coming buyer. Nonetheless, depending on specific programs, legislation, and state legislation there may be a number of loans which aren’t easily solved through the switch of financial products. Therefore, the responsibility still rests on the borrower that has acquired his or her property in foreclosure process. Many thanks sharing your thinking on this weblog.

  3. Great post. I was checking continuously this blog and I’m impressed! Extremely useful information particularly the final section 🙂 I care for such information a lot. I used to be looking for this certain info for a very long time. Thank you and best of luck.

  4. I and also my pals appeared to be viewing the good tips and tricks from your website and then instantly came up with a terrible suspicion I had not thanked the site owner for those tips. Most of the people had been stimulated to study all of them and already have certainly been taking advantage of these things. Appreciate your really being indeed considerate and then for deciding on this sort of nice resources most people are really wanting to understand about. Our own honest regret for not expressing appreciation to you sooner.

  5. One thing I’d prefer to say is that before getting more pc memory, have a look at the machine in which it would be installed. When the machine can be running Windows XP, for instance, the particular memory threshold is 3.25GB. Using a lot more than this would merely constitute any waste. Make certain that one’s motherboard can handle the upgrade quantity, as well. Interesting blog post.

  6. Definitely believe that which you stated. Your favorite justification appeared to be on the net the easiest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they plainly don’t know about. You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people could take a signal. Will probably be back to get more. Thanks

  7. Thanks for your posting on the travel industry. We would also like to include that if your senior thinking of traveling, it is absolutely imperative that you buy travel insurance for senior citizens. When traveling, senior citizens are at greatest risk of having a health care emergency. Buying the right insurance package for the age group can look after your health and provide you with peace of mind.

  8. It’s a pity you don’t have a donate button! I’d certainly donate to this fantastic blog! I suppose for now i’ll settle for bookmarking and adding your RSS feed to my Google account. I look forward to fresh updates and will share this website with my Facebook group. Talk soon!

  9. Hello! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results. If you know of any please share. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *