Upgrade Apache from source if the original was installed from an rpm?

(migrated from stackoverflow.com)

Recently I've inherited a set of machines running Red Hat Enterprise Linux 5.4. They have been provisioned with Apache Server v2.2.3 installed from rpms. I need to upgrade Apache to v2.2.19. For various reasons I'm building Apache from source. Installing my new version of Apache is no problem but then I have two instances of Apache, v2.2.3 at /usr/sbin/httpd and v2.2.19 at /usr/local/sbin/httpd. In most cases I'd just remove the existing version of Apache with rpm -e, but there are a ton of other rpms that have Apache as a dependency. I can't seem to find an rpm of Apache 2.2.19 for REL 5.4, so I can't do an rpm --upgrade. If I build Apache 2.2.19 with the prefix of the existing Apache instance (/usr/sbin/httpd), the install fails because /usr/sbin/httpd already exists. I've explored using yum to upgrade the packages but the server is behind a firewall and can't see the outside world.

At this point I'm leaning towards creating my own rpm but that seems like a lot of extra work for a seemingly small task. It seems like there's something really basic I'm not getting.


Solution 1:

You really, really want to create an RPM. You shouldn't have to do it from scratch; there'll be any number of existing packages out there you can use (or at least use as a base) -- including the existing RPM package.

Installing from source in a package-managed environment is just asking for trouble, from anyone who has to administer the server in the future or even just you when in 3 years you forget what horror you've wrought.

Solution 2:

I tend to use packages provided by the distribution, but if I for any reason need to compile something like Apache from source, I make sure I

  1. install it to separate path (such as /usr/local/apache2 or /opt/apache2
  2. create my own init scripts for them (such as /etc/init.d/apache2_custom) - messing up with the scripts provided by distribution will bite you sooner or later
  3. update /etc/motd and other documentation to clearly state the fact that this server uses self-compiled package FOO