Blog
How to Install Certbot on Ubuntu and AMIPosted by
admin on 02 Aug 2023
Certbot is an open-source command line tool that is used for getting certificates for self-hosted servers that are not already given HTTPS by their providers. Developed by Electronic Frontier Foundation (EFF), Certbot can help switch an existing HTTP website to HTTPS and renew the HTTPS certificate as required. In this blog, we will share how to Install Certbot on Ubuntu and AMI (Amazon Linux Images).
Certbot can be used with a server, whether on-premise or cloud-based, if it meets the following conditions:
Let’s start the step-by-step procedure to Install Certbot on Ubuntu and AMI.
Check if:
INSTALLING CERTBOT
Step 1
Ubuntu recommends using snap packages for installation
sudo snap install core; sudo snap refresh core
Step 2
Delete any previous version of Certbot in the system
sudo apt remove certbot
Step 3
Install the Certbot
sudo snap install --classic certbot
Step 4
Link the Certbot command from the snap install directory to your path
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Step 5
Allow 443 port
sudo ufw allow 443
Step 6
Run Certbot to get certificates for different servers
sudo certbot certonly --standalone -d
sudo certbot --apache
sudo certbot --nginx
sudo certbot certonly --webroot
Step 7
Configure the application
sudo ls /etc/letsencrypt/live/your_domain
AUTO-RENEWAL
sudo nano /etc/letsencrypt/renewal/your_domain.conf
renew_hook= systemctl reload
sudo certbot renew -dry-run
Also Read: Golang, Node.js, or Python: Which is Best for Your Project?
CREATE AMAZON LINUX AMI EC2 INSTANCE
Note: Creating an EC2 instance is not in the scope of this document. Please refer to this link.
SSH INTO EC2 INSTANCE
Step1
ssh -i username@
Or
Click Connect to login into your instance
sudo wget -r --no-parent -A 'epel-release-*.rpm'
https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/
Step2
sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm
Step3
sudo yum-config-manager --enable epel*
sudo yum repolist all
Step4
Edit the apache config file/etc/httpd/conf/httpd.conf. Locate the “Listen 80” directive and add the specific domain and subdomain details.
Step5
Save and restart Apache
sudo systemctl restart httpd
Step1
Install Amazon extras repo for epel
sudo amazon-linux-extras install epel -y
Step2
Install Certbot packages and dependencies
sudo yum install -y certbot python2-certbot-apache
Step3
Run Certbot
sudo certbot
Step4
Enter the admin email address for Certbot communication
AUTO-RENEWAL
Step 1
Open /etc/crontab
sudo crontab -e
0 7 * * * /usr/bin/certbot renew
TEST SSL
https://www.ssllabs.com/ssltest/
References
Share On
Tags
Amazon Linus
AMI
Certbot
How to
install certbot on amazon linus
install certbot on ubuntu
Ubuntu
Highlights
Download Blog
Talk to Our Experts
Get in Touch with us for a Walkthrough