Ubuntu

How to Use Certbot to Renew Certificate

The Certbot tool is popular among Linux users to install the SSL certificates for particular websites on the Linux operating systems. It also helps renew the already installed certificates. Therefore, we are implementing this article to install a Certbot to renew the certificates in Ubuntu 20.04 system. Let’s get going with the system update in the shell. The shell application must be opened using “Ctrl+Alt+T”. Ensure the “apt” package is already configured to use within the “update” query as shown. The system root password would be required to continue processing this system update:

Install Certbot Using Snapd

The first way to install Certbot is using the “snapd” package of the Ubuntu 20.04 system. It’s the latest way to install Certbot. So we must install the “snapd” package first in our system. For this, we are using the system’s “apt” package again within the installation command along with the keyword “snapd”. It will be mounted upon being presented:

You must ensure that your system has the latest version of “snapd” configured. For this, you have to utilize the “core” command to the installation of snap in the shell terminal. You have to use the “refresh” command to update the installed version of snap to the latest one. You may have a look at the instructions working below. It will start downloading the “core” snap package from the “stable” channel:

After the download, the core package will be installed, and it will show you if any update is available for the installed version. In our case, we have already configured the latest one:

Now, we have to use a simple “snap” package within our installation command to install the “certbot” classic version on our system. It will start downloading the “certbot”:

After a while, the Certbot will be installed using the “snapd” in the Ubuntu 20.04 Linux system:

Install Certbot Using Pip

Before going further, we need to install some prerequisites before installing domains and environments on the Ubuntu 20.04 system. You must install the Python package along with its dependencies on Ubuntu 20.04. This might be done with our system “apt” package, as shown below. The process will start to install Python and its environment:

Affirm the installation process by tapping “y” on the keyboard:

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

Sustain the installation by pressing “y”:

Presently, it’s a phase to build a virtual atmosphere first. Use the stated below Python 3 command first. Follow up the process by querying the upgrade command for “pip” shown in the image. It will start collecting and downloading “pip” on our system. After that, the pip package will be installed as the newest version, and we are good to go.

$ sudo python3 –m venv /opt/certbot/

After the Python and “pip” installation, we have to make use of “pip” to install the Certbot and “nginx” domain in our system. The command for this installation is stated in the shown image. It will collect the data for Certbot and certbot-nginx, download and install both on our system:

At last, it will show you the range of packages installed by using this single command as shown below:

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

Install Certbot Manually

If none of the methods work for you, try a manual way to install Certbot. Try querying the “apt” package installation command along with the keyword “certbot”. The secret code for the presently logged-in account user would be required to do so. Add your password and hit the “Enter” button to continue. It will start getting dependencies as shown:

Within the installation process, it will require your affirmation to continue the installation of the Certbot. You must tap “y” to continue it without any hesitation:

The installation will be continued smoothly. After a while, the process of Certbot installation will be completed, and the last processing lines for Certbot are shown below:

Before doing anything, we are simply applying the renewal command to force the certificate to renew using the newly installed Certbot software. This command uses the keyword “renew” along with the flag “—force-renewal” to do the renewal forcefully. In return, it will ask for your sudo password once again. You have to add your secret code and press the “Enter” key from your keyboard. In return, it will start saving the debugging information of the encryption. The output for this command shows us that not a single renewal has been done because we don’t have any certificate installed yet on our system. So, we need to install the certificate first:

Install Certificate

You need to install the certificate for a particular domain, i.e., nginx installed just now. Use the “certbot” instruction using the “—nginx” flag. It might request you to enter your email first:

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

Again tap “y”, and you will be registered:

In last, you have to add your domain web-server name and press Enter:

Your certificate will be installed for a particular server. You can now use the “renew” command to renew the certificate using the Certbot tool:

Conclusion

At last, we are done using the Certbot tool to renew a particular certificate for a particular domain. We have started with the different methods of installing certbot on the Ubuntu 20.04 system, such as pip and snapd. After that, we have established the main domain server and a certificate. In addition, we have cast-off the Certbot “renew” query to renovate the certificate. We hope you found this article helpful. Check out other Linux Hint articles for more tips and tutorials.

About the author

Saeed Raza

Hello geeks! I am here to guide you about your tech-related issues. My expertise revolves around Linux, Databases & Programming. Additionally, I am practicing law in Pakistan. Cheers to all of you.

Page was generated in 0.059564113616943