How to Install Apache with Friends on Red Hat 9

Updated: 12. November-2003

This is an example of how I installed Apache and friends on a cleanly installed Red Hat 9 system. More precisely the below software was installed:

The following is a recipe of how to compile an Apache server with PHP and mod_perl support. PHP will have modules for later running the Horde/IMP webmail interface. The paths might not apply to you, but it should be trivial to abstract from that. I was using the BASH shell. My base install directory was '/opt/download'. On the Red Hat 8 system used, there were these RPM installed: [ RPM list ]

Fetch the sources

Put everything into /opt/download

wget http://ftp.leo.org/pub/comp/general/infosys/www/daemons/apache/dist/httpd/apache_1.3.29.tar.gz wget http://www.modssl.org/source/mod_ssl-2.8.16-1.3.29.tar.gz wget http://www.openssl.org/source/openssl-0.9.7c.tar.gz wget http://www.php.net/get/php-4.3.4.tar.bz2/from/de3.php.net/mirror wget http://perl.apache.org/dist/mod_perl-1.0-current.tar.gz wget ftp://ftp.cac.washington.edu/imap/c-client.tar.Z (needed for PHP)

Unpack everything:

tar xzf apache_1.3.29.tar.gz tar xzf mod_ssl-2.8.16-1.3.29.tar.gz tar xzf openssl-0.9.7c.tar.gz tar xzf mod_perl-1.0-current.tar.gz tar xjf php-4.3.4.tar.bz2 tar xZf c-client.tar.Z

Compile OpenSSL:

We will compile OpenSSL, but not install it systemwide.

cd openssl-0.9.7c ./config make make test

Patch Apache source with mod_ssl:

Apache will be installed in "/opt/apache".

cd ../mod_ssl-2.8.16-1.3.29 ./configure --with-apache=../apache_1.3.29 --with-ssl=../openssl-0.9.7c \ --prefix=/opt/apache --enable-module=info --enable-module=so \ --enable-module=rewrite

Build Apache:

cd ../apache_1.3.29 make make certificate make install

Afterwards it can be usefull to remove the passphrase from the server key. This lessens security, but you will avoid having to type in the passphrase each time you want to start Apache. Pretty handy if you want to make sure that Apache comes back up after an unexpected reboot.

This will remove the passphrase from you server key:

cd /opt/apache/conf/ssl.key/ cp server.key server.key-with-passphrase openssl rsa -in server.key -out server.key chmod 400 server.key cd -

Start and test if the Apache webserver works:

/opt/apache/bin/apachectl startssl

Compile Mod_perl:

Mod_perl is only included here to serve my failing memory. It is not required or used by Horde/IMP webmail, but I need it for something else. You can skip this section if you do not plan on use mod_perl yourself.

cd ../mod_perl-1.29 perl Makefile.PL USE_APXS=1 WITH_APXS=/opt/apache/bin/apxs EVERYTHING=1 make make install

Compile IMAP client for PHP:

cd .. cd imap-2002e make slx SSLTYPE=none (answer 'yes') ln -s c-client include mkdir lib cd lib ln -s ../c-client/c-client.a libc-client.a cd ..

Compile PHP:

cd ../php-4.3.4 ./configure --with-apxs=/opt/apache/bin/apxs --with-config-file-path=/opt/apache/conf --with-mysql=/opt/mysql --with-zlib --enable-ftp --with-gettext --with-imap=../imap-2002e --with-bz2 --with-gd --with-png-dir --with-jpeg-dir --with-pear=/opt/apache/php-pear make make test make install cp php.ini-dist /opt/apache/conf/php.ini

Ammend the httpd.conf to make sure PHP works with Apache. You need to do the following to the /opt/apache/conf/httpd.conf file:

Restart the Apache webserver to enable PHP. If you create a small PHP program with the command 'phpinfo()' then you can have a closer look at all the PHP settings.

Now you should have a powerfull Apache installation ready for installing the webmail interface IMP and many other things. You can see how to install IMP 3.2 here: [ Installation of the webmail interface IMP 3.2 on Red Hat 9 ]

Back to Geek Stuff

--

Thomas Willert, thomas@willert.dk