Categories: TutorialsUbuntu

How to use Certbot to renew the certificate

The Certbot tool is popular among Linux users to install the SSL certificates for specific websites on the Linux operating systems. It also helps to renew the certificates already installed. So we implement this article to install a certbot to renew the certificates in Ubuntu 20.04 system. Let’s start with the system update in the shell. The shell application must be opened with “Ctrl+Alt+T”. Make sure the “apt” package is already configured for use in the “update” query as shown. The system root password would be required to continue processing this system update:

Install
Sponsored
Certbot with Snapd

The first way to install Certbot is to use the Ubuntu 20.04 system’s “snapd” package. This is the newest way to install Certbot. So, we need to install the “snapd” package in our system first. To do this, within the installation command, we will again use the system’s “apt” package together with the “snapd” keyword. It is assembled according to template:

You must ensure that you have the latest version of snapd configured on your system. To do this, you need to use the “core” command to install snap in the shell terminal. You must use the “Update” command to update the installed version of Snap to the latest version. You can check out the instructions below. It starts by downloading the “Core” snap package from the “Stable” channel:

Once downloaded, the core package will be installed and you will be shown if an update is available for the installed version. In our case we have already configured the latest one:

Now we need to use a simple “snap” package in our install command to install the classic version “certbot” on our system. It starts by downloading the “certbot”:

After some time, the Certbot will be installed with the “snapd” in the Ubuntu 20.04 Linux system:

Install Certbot with Pip

Before we continue, we need to install some prerequisites before we can install domains and environments on the Ubuntu 20.04 system. You need to install the Python package along with its dependencies on Ubuntu 20.04. This can be done using our system package “apt” as shown below. The process begins by installing Python and its environment:

Confirm the installation process by typing “y” on the keyboard:

You need to install the main domain you want to use here. Assuming you are using nginx or apache. So we need to install nginx via the “install” command with the apt package followed by the short word “nginx-core”. It will start installing nginx on your system:

Keep the installation going by pressing y:

It is currently a phase in which a virtual atmosphere is first established. First use the Python 3 command given below. Follow the process by querying the pip upgrade command shown in the image. It starts collecting and downloading “pip” on our system. After that, the pip package will be installed as the latest version and we’re good to go.

$ sudo python3 –m venv /opt/certbot/

After installing Python and “pip” we need to use “pip” to install domain certbot and “nginx” in our system. The command for this installation is given in the image shown. It collects the data for Certbot and certbot-nginx, downloads both and installs them on our system:

Finally, it will show you the series of packages installed with this single command as shown below:

Sponsored

After all the installations, we need to link the Certbot and make sure it’s running as shown below:

Install Certbot manually

If none of the methods work for you, try installing Certbot manually. Try querying the “apt” package installation command along with the “certbot” keyword. This would require the secret code of the currently logged-in account user. Enter your password and press the “Enter” key to continue. It will start getting dependencies as shown:

During the installation process, your confirmation is required to continue installing the Certbot. You need to tap “y” to continue without hesitation:

The installation will continue smoothly. After a while, the Certbot installation process will be complete and the final processing lines for Certbot are shown below:

Before we do anything, let’s just apply the renewal command to force the renewal of the certificate with the newly installed Certbot software. This command uses the renew keyword along with the —force-renewal flag to force the renewal. In return, you will be asked for your sudo password again. You need to add your secret code and press the “Enter” key on your keyboard. In turn, it starts storing the encryption debugging information. The output for this command shows us that not a single renewal has been performed since we don’t have a certificate installed on our system yet. So we need to install the certificate first:

Install certificate

You need to install the certificate for a specific domain, i.e. nginx was just installed. Use the certbot directive with the —nginx flag. You may be asked to enter your email address first:

After adding an email, you confirm that you agree to the terms. Press “y”:

Tap “y” again and you will be registered:

Lastly, you need to add the name of your domain web server and press Enter:

Your certificate will be installed for a specific server. You can now use the renew command to renew the certificate with the Certbot tool:

Conclusion

Finally we are done with the Certbot tool to renew a specific certificate for a specific domain. We started with the different methods to install certbot on Ubuntu 20.04 system such as: B. pip and snapd. After that we set up the main domain server and a certificate. We also rejected the Certbot “renew” query to renew the certificate. We hope you found this article helpful. Check out other Linux hints articles for more tips and tutorials.

Source

Ubuntu Server Admin

Recent Posts

Ubuntu Weekly Newsletter 866

Welcome to the Ubuntu Weekly Newsletter, Issue 866 for the week of November 10 –…

10 hours ago

Ubuntu vs Debian: Linux Distributions Compared Deep Dive

Debian and Ubuntu are two popular Linux distributions. In this deep dive we will guide…

19 hours ago

How to Install Google Cloud BigQuery Python client library on Linux

In this article, we will see how to Install Google Cloud BigQuery Python client library…

3 days ago

Wallpaper Contest for Xfce 4.20 open for voting

Nov 15,2024 Wallpaper Contest for Xfce 4.20 open for voting The submission phase for the…

3 days ago

Canonical announces the first MicroCloud LTS release

MicroCloud 2.1.0 LTS is now available, expanding the number of Canonical infrastructure solutions with a…

4 days ago

Join Canonical in Paris at Dell Technologies Forum

Canonical is thrilled to be joining forces with Dell Technologies at the upcoming Dell Technologies…

5 days ago