Rick's Tech Talk

All Tech Talk, Most of the Time

How Hard is it to Install a Web Server?

Today I was in RPM Hell, a punishing landscape even when you know what you're doing. And unfortunately for me, I only barely know what I'm doing.

Rewinding the clock: I was on a RHEL4 server, but it somehow didn't have the Apache Web Server (httpd) installed on it. I hunted around for a binary HTTPD (no, my server didn't have a compiler). After I found it, I tried to install it:

% rpm -i httpd-2.2.2-1.x86_64.rpm
warning: httpd-2.2.2-1.x86_64.rpm: V3 DSA signature: NOKEY, key ID 751d7f27
error: Failed dependencies:
        apr >= 1.2.0 is needed by httpd-2.2.2-1.x86_64
        apr-util >= 1.2.0 is needed by httpd-2.2.2-1.x86_64
        libapr-1.so.0()(64bit) is needed by httpd-2.2.2-1.x86_64
        libaprutil-1.so.0()(64bit) is needed by httpd-2.2.2-1.x86_64
        libpq.so.3()(64bit) is needed by httpd-2.2.2-1.x86_64
    Suggested resolutions:
        /var/spool/up2datepostgresql-libs-7.4.17-1.RHEL4.1.x86_64.rpm

I probably only merit a Tenderfoot rank when it comes to system administrator skills, but I knew what my next few hours looked like: I'd have to hunt around and locate these missing dependencies, and individually install them. One by one.

I only made it through the first dependency (apr) before I quit in frustration. The apr-util RPM depended on libpq.so.3, and that had me digging around for PostgreSQL RPMs. In turn, that RPM demanded some Crypto libraries. It felt like I peeling a never-ending onion. It felt like I was inside an Escher painting.

Since I still wanted to have an Apache Web Server, I looked around for an alternative distribution, and I was happy to see XAMPP for Linux. XAMPP is a nifty package of software for people who just want an "all-in-one" installation so they can do some LAMP development. I have installed the components that make up LAMP many times individually, but when I first tried out XAMPP I thought "how easy was that?"

XAMPP for Linux offered a way out of RPM Hell. Its compressed tar ball contained all of its dependcies, and its start-up was easy:

% tar zxf xampp-linux-1.7.1.tar.gz -C /opt
% cd /opt/lampp
% ./lampp start

However, when I did the start-up command, I saw this error:

% ./lampp start
Starting XAMPP for Linux 1.7.1...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
libgcc_s.so.1 must be installed for pthread_cancel to work
XAMPP: Couldn't start MySQL!
XAMPP: Starting ProFTPD...
XAMPP for Linux started.

The error was definitely caused by MySQL (the "M" in LAMP). The missing file had the ".so" suffix, which meant shared library, which meant more RPM madness. After a quick walk around the building to clear my steaming head, I did quick check for this file on my Linux box.

% rpm -q libgcc-3.4.6-9 -l
/lib64/libgcc_s-3.4.6-20060404.so.1
/lib64/libgcc_s.so.1
/usr/sbin/libgcc_post_upgrade
/usr/share/doc/libgcc-3.4.6
/usr/share/doc/libgcc-3.4.6/COPYING.LIB

The above interaction suggested to me that I was on a 64-bit Linux server. I knew that (and confirm that with the output of the uname command):

Linux rhel4-lbox 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64 x86_64 GNU/Linux

After wandering through some forum posts [1] [2], I came to the conclusion that XAMPP for Linux shipped 32-bit executables. It was trying to find a 32-bit libgcc_s.so. The libgcc_s.so in /lib64 wouldn't work. Examining the MySQL executable confirms this:

% file /opt/lampp/sbin/mysqld
mysqld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), stripped

So how hard would it be to find a 32-bit version of this shared library? With the proliferation of Linux distributions, and the proliferation of RPM sites, it would prove moderately difficult. Eventually, using the search terms "rhel4 rpms libgcc_s", I found what I was looking for: a 32-bit version of this shared library.

Installing it involved using rpm's "force" switch. That put the shared object in the lib directory:

% rpm -i -p libgcc-3.4.6-3.1.i386.rpm
        package libgcc-3.4.6-9 (which is newer than libgcc-3.4.6-3.1) is already installed
% rpm -i -p libgcc-3.4.6-3.1.i386.rpm --force
% rpm -q libgcc-3.4.6-3.1 -l
/lib/libgcc_s-3.4.6-20060404.so.1
/lib/libgcc_s.so.1
/usr/sbin/libgcc_post_upgrade
/usr/share/doc/libgcc-3.4.6
/usr/share/doc/libgcc-3.4.6/COPYING.LIB

For good measure, I updated the shared library cache by typing "/sbin/ldconfig". After all of this work, I was able to get the correct behavior:

% cd /opt/lampp
% ./lampp startmysql
XAMPP: Starting MySQL...

Scaling this XAMPP installation issue left me with some feeling of accomplishment, but for the most part I'm thinking: did it have to be this hard to install a web server?

Tags: