5

I've recently discovered software collections and understand how they allow me to install multiple versions of software by introducing a namespace for each collection. On Enterprise Linux, this is neat because I'll be able to keep the the regular stability of my system, while now being able to easily update certain versions of software as they are updated (not just security updates, but features too!)

I'd like my system's main webserver to be httpd 2.4. The version available from centos-sclo-rh software collection is currently 2.4.12, while the version available from base is only 2.4.6. So I installed httpd from that SCL and enabled it:

> scl enable httpd24-httpd bash

And then enabled and started the service using systemctl

> systemctl enable httpd24-httpd
> systemctl start http24-httpd

So I would expect my system should understand that I now have a webserver installed. However, when I try to install phpmyadmin from epel, it still wants to install the standard httpd package from base as a dependency.

Looking in to a bit of the mechanics of rpms, I've just learned that packages can have a Provides line in their spec file listing virtual packages like webserver, and indeed the src rpm for httpd has a Provides: webserver line. I'm guessing that the httpd24-httpd package I obtained from the SCL doesn't have that descriptor.

How can I get my system to recognize the installed and enabled httpd from the SCL provides the webserver virtual package so that it doesn't want to install the httpd package from base to fulfill the webserver virtual dependency?

pcronin
  • 161
  • 1
  • 5

2 Answers2

2

With RPM Package Manager you can simply provide foo 4 bar. This is a stupid dummy spec example, purists will remove the rpmlint ;-) warnings:

$ cat ~/rpmbuild/SPECS/provides-httpd.spec 
Summary:   Dummy package to provide with httpd for httpd24
Name:      provides-httpd
Version:   0.1
Release:   1%{?dist}
License:   GPLv2
Requires:  httpd24-httpd
Provides:  httpd
BuildArch: noarch

%description
This is a no-brainer dummy package to provide httpd for SCL httpd24

You should read https://serverfault.com/questions/770417/make-yum-recognize-that-httpd24-httpd-from-scl-provides-the-webserver-virtual

%files

Build this with rpmdevtools and friends:

$ rpmbuild -ba ~/rpmbuild/SPECS/provides-httpd.spec

Install the dummy package:

$ sudo yum install ~/rpmbuild/RPMS/noarch/provides-httpd-0.1-1.el7.noarch.rpm 
kordewiner
  • 21
  • 2
1

As suggested by @Michael Hampton, I reached out to the SCL group as it maintains the httpd24-httpd package (and many others). Here's the response I got from Joe Orton:

SCLs are not expected to be compatible at package level with system packages by definition. Packages which depend on "webserver" typically want to drop a config file into /etc/httpd/conf.d, as you've found, and that doesn't work with the SCL httpd24.

You could in theory bridge the gap between packages which require "webserver" and httpd24: own /etc/httpd/conf.d, drop a file in /opt/rh/.../conf.d/ which has an IncludeOptional for that directory, and provide "webserver". Not sure I'd recommend it, but it should be possible to get working with some hacking.

In this particular case, I value the ease of system maintainability over the smaller installed-software footprint resulting from not needing both httpd and httpd24-httpd installed; so I installed both and am fine with that. If you really don't want to have those two packages installed at the same time, then Joe has suggested a possible way forward you can consider.

pcronin
  • 161
  • 1
  • 5
  • While Joe sometimes misses the boat on dependencies ('apache' vs 'httpd' anyone? Thanks Joe), he does have a point about a virtual dependency thing to glue the packages in. I've done this in the past - probably *for* Joe's httpd mess - and it mostly works out. But keep in mind you're putting a square peg (phpmyadmin) into a round hole: you will run into other issues, either with mixing the two install roots and versions, or from the technical debt incurred from your workarounds. Tread carefully and really assess the value of 6 point releases. – user2066657 Jun 28 '18 at 14:46