As you probably know, latest software versions are rarely available to be installed as rpms. So, you need to compile them yourself. In this article I will briefly describe a process of installing, configuring and upgrading latest Apache and PHP.
Please remember, that installing from sources can sometimes break working system. So, please use this guide carefully.
Prerequisites
You will need to install prerequisites only once per machine.
Let’s create folder where we will download new sources to:
- mkdir /usr/local/fractal
Now check if your system has yum (Yellow dog Updater, Modified). Type in the following:
- yum –help
If you will see a message about command not found, you will need to install yum first. See this article about installing yum on Linux here.
Now execute the following commands
- yum remove httpd\* mysql\* php\*
- yum upgrade yum\*
- yum install autoconf libtool gcc gcc-c++ nano zlib-devel bzip2-devel gmp-devel libxml2-devel openssl-devel curl-devel libidn-devel libpng-devel libjpeg-devel libXpm-devel krb5-devel libmcrypt-devel libmhash-devel ncurses-devel bison bison-devel flex aspell-devel libtidy-devel libxslt-devel
- yum upgrade autoconf libtool gcc gcc-c++ nano zlib-devel bzip2-devel gmp-devel libxml2-devel openssl-devel curl-devel libidn-devel libpng-devel libjpeg-devel libXpm-devel krb5-devel libmcrypt-devel libmhash-devel ncurses-devel bison bison-devel flex aspell-devel libtidy-devel libxslt-devel
Writting such long commands, I suppose you know, that you can copy them from here and then paste them to Putty window using right-click
Installing Apache
Visit http://httpd.apache.org/download.cgi to get the link to Unix source of latest apache version. At the moment of writting it is http://www.sai.msu.su/apache/httpd/httpd-2.2.9.tar.gz
- cd /usr/local/fractal
- wget http://www.sai.msu.su/apache/httpd/httpd-2.2.9.tar.gz
- tar -zxvf httpd-2.2.9.tar.gz
- cd httpd-2.2.9
Now let’s configure Apache. All configuration options that are available you can find here. We will just list the most used ones
- ./configure –silent –enable-rewrite –enable-deflate –with-mpm=worker –enable-so
If you had any error, to find out it’s reason you can find out it’s reason you can repeating configure command omitting –silent key to get more information on the error source.
Now execute
- make
- make install
and we are almost done. Now we need to create a symlink to some apache binaries we will need. This can be done by the following command:
- cp -s /usr/local/apache2/bin/apachectl /usr/local/sbin/apachectl
- cp -s /usr/local/apache2/bin/apxs /usr/local/sbin/apxs
- cp -s /usr/local/apache2/bin/httpd /usr/sbin/httpd
Now we need to add Apache to the list of autostarting services on server startup. For this we will need to create a small script in /etc/rc.d/init directory.
- nano /etc/init.d/httpd
Copy and paste the following contents to the editor
#!/bin/sh
# chkconfig: - 98 02
# description: Apache2 HTTP Server Startup
# processname: httpd
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
KIND="Apache2"
start() {
echo -n $"Starting $KIND services: "
/usr/local/sbin/apachectl start
echo
}
stop() {
echo -n $"Shutting down $KIND services: "
/usr/local/sbin/apachectl stop
echo
}
restart() {
echo -n $"Restarting $KIND services: "
/usr/local/sbin/apachectl restart
echo
}
graceful() {
echo -n $"Restarting $KIND services gracefully: "
/usr/local/sbin/apachectl graceful
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
graceful)
graceful
;;
*)
echo $"Usage: $0 {start|stop|restart|graceful}"
exit 1
esac
exit $?
Now press Ctrl-X and exit from editor, saving the file. Now let’s set Apache service to autostart at system startup:
- chkconfig –add httpd
- chkconfig httpd on
Enabling Apache service management via service script:
- chmod 0777 /etc/init.d/httpd
Now let’s install MySQL… See next page for instructions.

