Jump to content
EGGTCL

eggdrop

  • entries
    19
  • comments
    0
  • views
    492

Certbot / Apache on Debian


Pugsley

13 views

1. SSH into the server

SSH into the server running your HTTP website as a user with sudo privileges.

2. Install snapd

You'll need to install snapd and make sure you follow any instructions to enable classic snap support.

Follow these instructions on snapcraft's site to install snapd.

or here;

Installing snap on Debian

sudo apt update
sudo apt install snapd

 

If the sudo command isn’t installed (usually because a root password was provided at install time), you can install snap by first switching to the root account:

$ su root
# apt update
# apt install snapd

 

Either log out and back in again, or restart your system, to ensure snap’s paths are updated correctly.

After this, install the core snap in order to get the latest snapd.

$ sudo snap install core
core 16-2.45.2 from Canonical✓ installed

 

Note: some snaps require new snapd features and will show an error such as snap "lxd" assumes unsupported features" during install. You can solve this issue by making sure the core snap is installed (snap install core) and it’s the latest version (snap refresh core).

 

To test your system, install the hello-world snap and make sure it runs correctly:

$ sudo snap install hello-world
hello-world 6.3 from Canonical✓ installed
$ hello-world
Hello World!

 

3. Remove certbot-auto and any Certbot OS packages
If you have any Certbot packages installed using an OS package manager like apt, dnf, or yum, you should remove them before installing the Certbot snap to ensure that when you run the command certbot the snap is used rather than the installation from your OS package manager. The exact command to do this depends on your OS, but common examples are sudo apt-get remove certbot, sudo dnf remove certbot, or sudo yum remove certbot.

 

4. Install Certbot
Run this command on the command line on the machine to install Certbot.

sudo snap install --classic certbot

 

5. Prepare the Certbot command
Execute the following instruction on the command line on the machine to ensure that the certbot command can be run.

sudo ln -s /snap/bin/certbot /usr/bin/certbot

 

6. Choose how you'd like to run Certbot
 

Either get and install your certificates...

Run this command to get a certificate and have Certbot edit your apache configuration automatically to serve it, turning on HTTPS access in a single step.

sudo certbot --apache

Or, just get a certificate

If you're feeling more conservative and would like to make the changes to your apache configuration by hand, run this command.

sudo certbot certonly --apache

 

7. Test automatic renewal
 

The Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire. You will not need to run Certbot again, unless you change your configuration. You can test automatic renewal for your certificates by running this command:

sudo certbot renew --dry-run

 

The command to renew certbot is installed in one of the following locations:

  • /etc/crontab/
  • /etc/cron.*/*
  • systemctl list-timers

 

8. Confirm that Certbot worked
 

To confirm that your site is set up properly, visit https://yourwebsite.com/ in your browser and look for the lock icon in the URL bar.

0 Comments


Recommended Comments

There are no comments to display.

×
×
  • Create New...