Tip: RedHat httpd RPM replacement

Posted on October 17, 2012 by Tommy McGuire
Labels: linux, system administration

Hmph. I can't think of a word beginning with r- for Apache httpd.

When a couple of our servers were patched, it looks like the RedHat httpd took over for our /usr/local/ httpd. I didn't think the RPM was installed previously but I'm not sure, so I don't know whether the infamous They upgraded it during the patching or if they just installed it.

In any case, here's how to fix it:

  1. To tell what httpd is running:


    $ ps -ef | grep httpd

    If the list of processes has /usr/sbin/httpd, it's the RPM version. Our local version will be something starting with /usr/local.

  2. If the RPM version is running, become root and kill it:


    # /etc/init.d/httpd stop
  3. (Optional) Blow away the httpd RPMs:


    # rpm -qa | grep httpd

    This command lists the RPMs installed; looks like there's three on this server now: httpd-2.2.15, httpd-tools-2.2.15, and httpd-manual-2.2.15. (Yay, doccies.)


    # yum remove package

    The comes from the rpm -qa list above, and removing httpd removes httpd-manual (and some other packages as well) so I just had to remove httpd and httpd-tools.

    That'll teach 'em.

    You will want to do this after you stop httpd and before you remove and re-create the /etc/init.d link because removing the RPM blows away the /etc/init.d link as well as stopping the server. Trying to use the rpm command rather than yum is possible (The command is rpm -e package.), but it doesn't remove recursive dependencies, meaning it will require iteration.

  4. Remove the /etc/init.d/httpd script from the RPM and replace it with a link to the our version:


    # rm /etc/init.d/httpd
    # ln -s /usr/local/ours/httpd/bin/apachectl /etc/init.d/httpd

    Yes, the startup script that comes with apache is called apachectl. If you removed the RPM in the previous step, you don't have to remove the init.d script here. If you didn't, you will probably have to go through this dance the next time They patch the servers.

  5. Start our httpd:


    # /etc/init.d/httpd start

    The ps command above should now show our httpd.

Here's to not having to look up rpm commands again.

active directory applied formal logic ashurbanipal authentication books c c++ comics conference continuations coq data structure digital humanities Dijkstra eclipse virgo electronics emacs goodreads haskell http java job Knuth ldap link linux lisp math naming nimrod notation OpenAM osgi parsing pony programming language protocols python quote R random REST ruby rust SAML scala scheme shell software development system administration theory tip toy problems unix vmware yeti
Member of The Internet Defense League
Site proudly generated by Hakyll.