Categories
Tech

Renew Certbot SSL Certificate on Linux Command Line

As a chucklehead, I get to work with all kinds of web servers. New ones, old ones, fantastic ones, and ones that need to be updated to the newest, latest, greatest, and safest software. These articles should help us both handle any shenanigans that occur while maintaining these awesome devices.

I remember I used to have to manually update Certbot on a Linux server for a certain client. If I didn’t update it manually every 3 months, an error would be shown when visiting the site.

To update Certbot on our Linux server, we’ll have to run three commands. These commands will:

  • Turn off Apache.
  • Run the renewal command for Certbot.
  • Turn Apache back on.

So let’s get moving! Let’s start with step 1 and stop Apache on our Linux server. Below is the line for that. Copy and paste it into your bash window.

sudo service apache2 stop

Once our Apache service has stopped, we can run the Certbot renew command. It looks like:

sudo certbot renew

It may take a few seconds for that command to complete. Once all that is good to go, we can start our Apache service right back up.

sudo service apache2 start

And boom! You’re good.

Do yourself (and your sanity) a favor and create a cron job to run those commands every X days automatically for you. Maybe I’ll write an article on that next.

Leave a Reply

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