How to install Let’s Encrypt on Linux server

Let’s Encrypt is a free SSL security provider for everyone. You can install easily for Shared Hosting, VPS and Dedicated server. In the previous article, I had instructions to install Free Let’s Encrypt for cPanel shared hosting.
Today, this article will guide you to Let’s Encrypt installation for some VPS servers running CentOS, Redhat, Debian, and Ubuntu.

let's encrypt free ssl

To get started to install Let’s Encrypt on your Linux VPS

You will need to install git on your Linux:

  • With CentOS, RedHat you need to run with :

yum update
yum install git-all

  • With Debian, Ubuntu

apt-get update
apt-get install git-all

Then we proceed with the installation as follows

mkdir ~/src --> Create source storage directory
cd ~/src → Go to the src folder has been created
git clone https://github.com/letsencrypt/letsencrypt --> Download source let’s encrypt to VPS
cd letsencrypt --> Go to yourletsencrypt folder
chmod g+x letsencrypt-auto --> Grant the file permissions letsencrypt-auto
./letsencrypt-auto --> Proceed to install

The installation process will take several minutes.

After a successful installation, we will proceed to issue a certificate for the domain name.

Install Let’s Encrypt for domain

With Apache

You need to stop apache 2 web server:

  • Use the following systemctl command on Debian Linux version 8.x+ or Ubuntu Linux version Ubuntu 15.04+ or above:

## Stop command ##
systemctl stop apache2.service

  • CentOS/RHEL (Red Hat) Linux version 4.x/5.x/6.x or older specific commands

## Stop ##
service httpd stop

  • CentOS/RHEL (Red Hat) Linux version 7.x or newer specific commands

## Stop command ##
systemctl stop httpd.service

Then run the Let’s Encrypt installation command

./letsencrypt-auto --apache --email=YOUREMAIL@YOURDOMAIN.COM -d YOURDOMAIN.COM -d SUB.YOURDOMAIN.COM -d ANYDOMAIN.YOUWANT.NET

This command helps Let’s Encrypt know you are using Apache to be able to automate the installation process. It announced Let’s Encrypt your email address, and let Let’s Encrypt know about the domain you want to certify.

You can use any domain name you want after -d . Let’s Encrypt will automate this entire process and add the appropriate code to your domain configuration file.

With Nginx

When Let’s Encrypt installation for Nginx you should back up the data before installing because it will likely cause errors.

Stop the Nginx service with the command:

service nginx stop

systemctl stop nginx

Then run the command:
./letsencrypt-auto certonly --email=YOUREMAIL@YOURDOMAIN.COM -d YOURDOMAIN.COM -d SUB.YOURDOMAIN.COM

This command will create certificate files in the directory in /etc/letsencrypt/live/YOURDOMAIN.COM

For Let’s Encrypt to work with your domain name, you need to edit Nginx’s configuration file. Use Nano to edit.

nano /etc/nginx/sites-enabled/default

In the configuration file, make sure the Nginx server is listening on port 443 and the path of the certificate file is correctly declared.

Your configuration file will look like this:

server {
listen 443;
server_name yourdomain.com sub.yourdomain.com;

root /usr/share/nginx/www;
index index.html index.htm;

ssl on;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
}

Save the file, then restart Nginx:

service nginx restart
systemctl restart nginx

Then you can test the domain on your browser. If you show https now, you did it right.

Above is the easiest way to install Let’s Encrypt for your VPS server using operating systems like RedHat, CentOS, Ubuntu, and Debian. If you need help please leave a comment directly below this article.

About the Author: admin
The best hosting, domain and VPS servers coupon codes at TopHostCoupon.com help you save money when buying hosting, domain names, and servers.
You might like

Leave a Reply

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