Remove RPM Versions of the Applications
Before we start with our source code install, we need to remove all the existing RPM files for these products. To find out what RPMs are already installed, use the RPM query command:
rpm -qa
in conjunction with grep to filter your results:
rpm -qa | grep -i apache
rpm -qa | grep -i httpd
rpm -qa | grep -i php
rpm -qa | grep -i mysql
The 'httpd' search is in case you have Apache2 installed via RPM.
To remove the RPMs generated by these commands, do
rpm -e filename
for each RPM you found in the query. If you have any content in your MySQL database already, the RPM removal step should not delete the database files. When you reinstall MySQL, you should be able to move all those files to your new MySQL data directory and have access to them all again.
1. Download Apache
Download the latest version from Apache HTTP Server Project . Current stable release of Apache is 2.2.9. Move the source to /usr/local/src and extract it as shown below.
# cd /usr/local/src
# gzip -d httpd-2.2.9.tar.gz
# tar xvf httpd-2.2.9.tar
2. Install Apache
View all configuration options available for Apache using ./configure –help (two hyphen in front of help). The most commonly used option is –prefix={install-dir-name} to install Apache on a user defined directory.
# cd httpd-2.2.9
# ./configure --help
In the following example, Apache will be compiled and installed to the default location /usr/local/apache2 with the DSO capability. Using the –enable-so option, you can load modules to Apache at runtime via the Dynamic Shared Object (DSO) mechanism, rather than requiring a recompilation.
# ./configure --enable-so
# make
# make install
Note: During the ./configure, you may get the following error message.
# ./configure --enable-so
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
configure failed for srclib/apr
Install the gcc and the dependent modules as shown below and try ./configure again to fix the above issue.
# rpm -ivh gcc-4.1.2-14.el5.i386.rpm glibc-devel-2.5-18.i386.rpm glibc-headers-2.5-18.i38
6.rpm kernel-headers-2.6.18-53.el5.i386.rpm
Preparing... ########################################### [100%]
1:kernel-headers ########################################### [ 25%]
2:glibc-headers ########################################### [ 50%]
3:glibc-devel ########################################### [ 75%]
4:gcc ########################################### [100%]
3. Start Apache and verify installation
# cd /usr/local/apache2/bin
# ./apachectl start
Go to
http://local-host, which should display the default message “It Works!”
[root@localhost RPMS]# rpm -ivh gcc-3.4.4-2.i386.rpm glibc-devel-2.3.4-2.13.i386.rpm glibc-headers-2.3.4-2.13.i386.rpm
warning: gcc-3.4.4-2.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
error: Failed dependencies:
kernel-headers is needed by glibc-headers-2.3.4-2.13.i386
kernel-headers >= 2.2.1 is needed by glibc-headers-2.3.4-2.13.i386
Suggested resolutions:
glibc-kernheaders-2.4-9.1.98.EL.i386.rpm
[root@localhost RPMS]# rpm -ivh gcc-3.4.4-2.i386.rpm glibc-devel-2.3.4-2.13.i386.rpm glibc-headers-2.3.4-2.13.i386.rpm glibc-kernheaders-2.4-9.1.98.EL.i386.rpm
warning: gcc-3.4.4-2.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:glibc-kernheaders ########################################### [ 25%]
2:glibc-headers ########################################### [ 50%]
3:glibc-devel ########################################### [ 75%]
4:gcc ########################################### [100%]
4. Start Apache automatically during system startup
Modify the /etc/rc.d/init.d/httpd script and change apachectl and httpd variable to point to the appropriate new location as shown below. Please note that this httpd script was originally installed as part of the default Apache from the Linux distribution.
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
Now, you can perform the following to stop and start the Apache
# service httpd stop
# service httpd start
Setup the Apache to automatically startup during reboot as shown below.
# chkconfig --list httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig --level 2345 httpd on
# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off