15

I've been following a couple of tutorials to add ssl to my server (node application).

I tried installing Certbot with the following line on by Ubuntu 20.04 server:

sudo add-apt-repository ppa:certbot/certbot

but got a warning and no install:

This is the PPA for packages prepared by Debian Let's Encrypt Team and backported for Ubuntu.                                                                         
Note: Packages are only provided for currently supported Ubuntu releases.
More info: https://launchpad.net/~certbot/+archive/ubuntu/certbot
Press [ENTER] to continue or Ctrl-c to cancel adding it.*

After searching the net, there is mention of not using PPA, but to use an earlier standalone version - also mention of using snap - But I cannot find a concrete answer. I am using Express and not nginX.

Could someone suggest how to install, please?

Update

Ran sudo snap install certbot.

Result:

error: This revision of snap "certbot" was published using classic confinement and thus may perform
   arbitrary system changes outside of the security sandbox that snaps are usually confined to,
   which may put your system at risk.
   If you understand and want to proceed repeat the command including --classic.
2
  • 1
    That's not a command to install a package. Rather, sudo add-apt-repository ppa:certbot/certbot adds the certbot PPA to your list of trusted sources. Since you've added that to your sources, you may now install the packages they publish. After running that command, make sure to update by sudo apt-get update, and now you'll be able to install the packages they publish (they list them here: launchpad.net/~certbot/+archive/ubuntu/certbot/+packages)
    – user96931
    Sep 30, 2020 at 16:52
  • 1
    The link in @user96931's comment is woefully out of date. The more modern PPA, which is what you'd get if you use the commands in that comment, is also out of date, with their landing page stating "The PPA has been DEPRECATED" (that's their emphasis, not mine) and pointing at the snap installation directions. The main Ubuntu packages are almost up to date (they're currently five minor releases old).
    – Adam Katz
    Apr 23, 2022 at 22:42

4 Answers 4

11

You can use APT, PIP or SNAP to install on Focal / Ubuntu 20.04

(APT works - at least for now.)

But, do not use more than one install method, or mix them.

It sounds like you may have mixed install methods.
You may need to purge everything and start over?

Run these to clean up & delete Certbot first.
If you have certificate(s) already created you will need to recreate them.
Warning: The following lines will delete certbot and files completely!

 sudo apt remove certbot* --purge  
 sudo apt-add-repository --remove ppa:certbot/certbot  
 sudo apt update  
 sudo snap remove certbot  
 sudo -H pip3 uninstall certbot
 pip3 uninstall certbot
 sudo rm /usr/bin/certbot
 rm ~/.local/usr/bin/certbot
 rm ~/.local/bin/certbot
 sudo rm -rf /etc/letsencrypt

Just ignore any errors (not founds).
That should cover all bases - both system-wide and user only.

Now decide how you want to install it.
PICK ONE AND ONLY ONE. Do not mix installation methods.

Snap

Installing snaps is easy enough, but I personally dislike using it. I prefer using python pip (as of right now). Snap would be my second choice.

Snap is well documented for Ubuntu Focal on the Certbot site already as the default installation method.

Pip

Instructions are here at Certbot site.

Apt

sudo apt show certbot

Package: certbot
Version: 0.40.0-1ubuntu0.1
Priority: extra
Section: universe/web
Source: python-certbot
Origin: Ubuntu

( https://packages.ubuntu.com/focal/certbot )

The APT version has always been many versions behind.
This is no exception.
The current APT version is at v0.40.0 -> (Released Nov 5, 2019).
The current PIP and SNAP versions are v1.19.0 (as of Oct 1 2021).

I recommend using something a bit newer than what APT offers. Since Certbot deals with security/SSL and sometimes the LetsEncrypt/Certbot folks make changes you definitely may want to update to immediately. You may not be able to do that if you use the APT version. And as far as I know you cannot use the Certbot PPA for Ubuntu Focal/20, either.

So, stick with pip -or- snap as your installation method.

4
  • 1
    Fantastic answer! Specially for the "clean up" part.
    – MestreLion
    Jun 9, 2022 at 3:30
  • 1
    The Pip install method is no good, as the libcrypto installed as certbot dependency can break Pip in much the same way as in Pip issue 11795. Better use a virtual environment for Pip packages.
    – tanius
    Nov 30, 2023 at 1:44
  • 1
    @tanius It still works for me on my installs, but you are right. I will update soon using certbot.eff.org/… and others as a reference..
    – B. Shea
    Dec 15, 2023 at 22:16
  • 1
    Have updated the guide this answer was based on. Here gist.github.com/bmatthewshea/f6a66ddb2e52ccdbc905aed73d9ca59c as well.
    – B. Shea
    Dec 31, 2023 at 16:26
9

They have gotten rid of the apt it is now snap install certbot --classic

12
  • 1
    Sorry for the newbie question, which version does the above command install ? - is it called a standalone installation ? Sep 30, 2020 at 17:14
  • @Jet I do not believe in bad questions! Now the answer to your question is: It will install the latest version
    – Nate
    Sep 30, 2020 at 17:24
  • 1
    I found another command on Certbot website, 'snap install --classic certbot', Is thi applicable to my situation? Also after I ran 'sudo add-apt-repository ppa:certbot/certbot' as in my question, I checked folder /etc/apt/sources.list.d/ and can see a file called certbot-ubuntu-certbot-focal.list', Should I delete it ?. (I havent yet ran 'apt-get update') Sep 30, 2020 at 17:36
  • 1
    Hi, ran 'sudo snap install certbot' and received error and the use of --classic . I've updated the question. Sep 30, 2020 at 17:52
  • 1
    Express and NodeJs only Sep 30, 2020 at 18:24
2

To install the latest version of a github certbot works on Ubuntu 20.04

sudo curl -o- https://raw.githubusercontent.com/vinyll/certbot-install/master/install.sh | bash

Happy Coding!

1

As laid out nicely in the answer by B. Shea, there are three basic options to install certbot: via apt, Pip or Snap, and the good options are Pip and Snap. Now personally I don't like Snap – it provides lazy, bloated installation packages that always include all the dependencies. So I propose to use the Pip install route.

It is important to not simply install the certbot Pip package system-wide, because it will break Pip and other Python installations that use OpenSSL. (If that already happened to you, fix it first.)

Instead, use a virtual Python environment. There are official Pip-based installation instructions for certbot that follow this technique, and the following is my variant of them that, I think, fits better with the directory structure of Ubuntu systems:

sudo apt update
sudo apt install python3 python3-venv libaugeas0

sudo python3 -m venv /usr/local/share/certbot/
sudo /usr/local/share/certbot/bin/pip install --upgrade pip
sudo /usr/local/share/certbot/bin/pip install certbot certbot
sudo ln -s /usr/local/share/certbot/bin/certbot /usr/local/bin/certbot

After a new login to your terminal, you will then have the certbot command available:

$ which certbot 
/usr/local/bin/certbot
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .