Install plugin without installing 2nd Nginx (Certbot)

My domain is: Not relevant to my issue

I ran this command: Not relevant to my issue

It produced this output: Not relevant to my issue

My web server is (include version): nginx/1.19.4 (built from source, not installed through apt)

The operating system my web server runs on is (include version): Ubuntu server 20.04

My hosting provider, if applicable, is: Not relevant to my issue

I can login to a root shell on my machine (yes or no, or I don't know): Yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): Certbot 0.40.0


Hi!

I'm trying to use Certbot with Nginx, and I have built Nginx from source; I don't have it installed from apt. This is important to my issue.

When I try to use certbot --nginx, I get an error saying The requested nginx plugin does not appear to be installed

When I try to install the plugin (sudo apt install python3-certbot-nginx), it installs both the plugin and Nginx itself.

I do not want it to do this, as I have a version of Nginx that I built from source installed and when apt installs the plugin, it thinks that Nginx is not installed and installs the Nginx from apt. This results in me having two Nginxes installed -- one from apt and one I built from source.

How can I install the plugin without installing Nginx?

// There's probably an obvious solution for this, but I haven't ran into this, like, ever, and I don't even know what to google

Thanks for your help in advance.

3 Likes

Hello @daniel11420,

You could try to append a minus to the end of the package you don't want to install, for example:

sudo apt-get install python3-certbot-nginx nginx-

or

sudo apt-get install python3-certbot-nginx nginx*-

Edit: Sorry, I'm afraid this won't work in this situation and I don't have an Ubuntu or Debian here right now to test it.

Cheers,
sahsanu

2 Likes

Ok, I got an Ubuntu 20.04 and this worked... well, I mean, I installed the plugin without nginx as dependency but I've not checked that the plugin is working fine.

1.- Download the package python3-certbot-nginx:

apt-get download python3-certbot-nginx

2.- Install several dependencies needed by the plugin:

sudo apt-get install certbot python3-acme python3-certbot python3-mock

3.- Now use dpkg to install the plugin we have download without nginx as dependency (check that the name of the deb file is the right one in your system):

sudo dpkg -i --ignore-depends=nginx python3-certbot-nginx_0.40.0-0ubuntu0.1_all.deb

Cheers,
sahsanu

4 Likes

Wow! I love this approach. It raises my curiosity:
Did you install from source to improve entropy ?
And if so were you able to capture it successfully?

Rip

2 Likes

That's a great tip! Is the --ignore-depends permanent (does it get saved?), or will apt later prompt you to fix the apparently missing dependency?

2 Likes

You can view these dependencies (and probably a few already installed ones) with:

apt-cache depends python3-certbot-nginx

(A few are dependencies for python3-certbot too for example.)

I see python3-pyparsing is a nginx plugin dependency not in python3-certbot nor python3-acme, while python3-mock already is a dependency for both.

Disclaimer: tested on Raspbian, probably worth noting :stuck_out_tongue:

3 Likes

@schoen, no, as far as I know it is not permanent and could cause issues so I think the best approach is to create a fake nginx deb package.

@daniel11420, here the steps to create a fake nginx package (I think it is better to use this approach):

1.- Install equivs package and its dependencies:

sudo apt install equivs

2.- Create a control package

mkdir equivs-nginx
cd equivs-nginx
equivs-control nginx

3.- Edit the nginx file created and should look like this:

Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: nginx
Version: 1.19.4
Maintainer: daniel11420
Architecture: all
Description: Fake package for nginx to avoid dependencies

4.- Save the file and build the package.

equivs-build nginx

5.- Install the new nginx package:

sudo dpkg -i nginx_1.19.4_all.deb

6.- Install python3-certbot-nginx

sudo apt install python3-certbot-nginx

I hope this helps.

Cheers,
sahsanu

4 Likes

I feel like a dumb... I should search this community before to "waste" time trying to find a solution because the fake deb package solution was already provided in this great community some time ago:

Well, at least I've learned something during the journey :smiley:

2 Likes

@sahsanu If two persons independently devise the exact same solution, it's probably a good one :wink:

4 Likes

@sahsanu

Thanks! This worked.
And about searching the community, that's mostly my fault, I should have tried searching a little bit more and I probably would have found it.

3 Likes