Compile and Install Apache, PHP, PHPAdmin, Webmin and IPTables on Debian


Please note this is not complete.

 

But this one is Install Apache, PHP, PHPAdmin and its is much better, for a start it works, its complete and we use it in production.

We are launching a Drupal web site and as per best practices require that the web server be built only with the relevant modules required. This mean compiling the Apache code from source, to achieve this there are a few steps to go through as you would expect.

Our partner wants this on the Debian platform which is not my preference but to keep things tidy I have agreed. This is also running on the Amazon AWS platform and therefore additional packages need to be installed as some of the base images are very vanilla.

Again as always apology for some of the basic nature of the syntax i.e. cd .. but these guides are meant for all levels of Linux user and I only class myself as intermediate at best.

You need the following packages on the server to complete the installation

apt-get install gcc make libtool g++ zlib1g zlib1g-dev  

If you plan on using PHP you will need

apt-get install libxml2

If you plan on using mysql with the installation (please note that this will just load the client and my mysql server in on another server)

apt-get install mysql-client libmysqlclient-dev

The start of the installation

cd ~

mkdir software

cd software

download the apr and apr-utility

wget http://mirrors.ukfast.co.uk/sites/ftp.apache.org//apr/apr-1.4.6.tar.gz
wget http://mirrors.ukfast.co.uk/sites/ftp.apache.org//apr/apr-util-1.4.1.tar.gz
tar xzvf apr-1.4.6.tar.gz
tar xzvf apr-util-1.4.1.tar.gz

cd apr-1.4.6

./configure
make
make install

cd ..

cd apr-util-1.4.1
./configure –with-apr=/usr/local/apr

make

make install

cd ..
wget http://sourceforge.net/projects/pcre/files/pcre/8.21/pcre-8.21.tar.gz
tar zxvf pcre-8.21.tar.gz
cd pcre-8.21
./configure
make
make install

To ensure that the server starts make sure you use this command, this creates all the links required for the shared libraries.

ldconfig

To install the Apache server

cd ..

wget http://mirror.catn.com/pub/apache//httpd/httpd-2.4.1.tar.gz

tar zxvf httpd-2.4.1.tar.gz

cd httpd-2.4.1

./configure –prefix=/opt/httpd \

./configure –enable-so \
–enable-authz_host –enable-mod_dir –enable-log_config \
–enable-mime –enable-rewrite –enable-setenvif –enable-alias \
–enable-expires –enable-headers –enable-deflate –enable-include \
–with-included-apr=/usr/local/apr

Note the /opt/httpd (I can not find anywhere a best practice on where to compile the installation so I have chosen /opt as this is for none base packages and even though Apache is always linked with Linux it could be considered third party 🙂 ). If there is anyone who disagrees please let me know and I will change the instructions accordingly.

I found out that if you leave the prefix out you get the default install which is never a bad thing. It will install it in /usr/local/apache2

make

make install

To test if the server starts

cd /usr/local/apache2/bin

./apachectl -k start

./apachectl -k stop

Now the PHP installation

cd ~

cd software

wget  http://uk3.php.net/get/php-5.3.10.tar.gz/from/this/mirror

mv mirror php.tar.gz

tar xzvf php.tar.gz

cd php-5.3.10

./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/include/mysql

make

make install

cp /root/software/php-5.3.10/php.ini-production /usr/local/lib/php.ini

cd /usr/local/apache2/bin

./apachectl -k start

./apachectl -k stop


Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s