Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

(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.

share|improve this question

4 Answers 4

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.

share|improve this answer

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
share|improve this answer

Move your old httpd binary out of the way then install.

mv /usr/sbin/httpd /usr/sbin/httpd.old -v, set your --prefix=/usr/sbin for Apache ./configure, then install. Make sure to back up your Apache config files, first. (tar czpf /etc/httpd-backup-$(date +%s).tar.gz /etc/httpd/ )

share|improve this answer

While it may lead you into a slippery slope of dependency removal you should check which packages require httpd to be installed.

# rpm -q --whatrequires httpd

If you can remove the packages than you might have your answer, if you can't remove apache due to dependencies and you absolutely must run the newer version than I would suggest turning off the rpm version of httpd and stop it from starting on boot.

# service httpd stop
# chkconfig httpd off

I would suggest then installing your custom compiled version and run it out of another directory for configuration/binaries. If you go that route it would also be wise to copy the default init script, modify the paths and add it as a different name.

# chkconfig --add httpd-custom
# chkconfig httpd-custom on

Keep in mind if you are using Redhat support they wont help you with the custom compiled version of httpd, and they really would not support you if you messed with the original binaries.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.