The LAMP installation process

Posted: April 29, 2013 in General linux

A few words before we start. This is not a step by step instruction guide to install LAMP. This is how I completed the LAMP installation successfully!!! You may find some stuff  just as waste 😛 Please don’t put the blame on me for that 🙂

Ok. Let’s start

I referred the below URL to start LAMP installation.


http://lamphowto.com/lampssl.html

As mentioned here, before starting the installation, I checked for the RPM versions of below services.


rpm -qa | grep -i apache
rpm -qa | grep -i httpd
rpm -qa | grep -i php
rpm -qa | grep -i mysql
rpm -qa | grep -i openssl
rpm -qa | grep -i mod_ssl

Found rpm versions of httpd, aopache and openssl. Removed them using the below commands.


rpm -e httpd-2.2.3-43.el5.centos.
rpm -e vzdummy-apache-1.0-1.swsoft
rpm -e openssl-0.9.8e-12.el5_4.6

Then I downloaded below tar balls to /usr/local/src.


wget http://apache.mirrors.tds.net//httpd/httpd-2.2.23.tar.gz
wget http://us.php.net/get/php-5.3.15.tar.gz/from/this/mirror
wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.5/mysql-5.5.18.tar.gz
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
wget http://www.modssl.org/source/mod_ssl-2.8.30-1.3.39.tar.gz

Unzipped them using the below commmands.


tar zxf httpd-2.2.23.tar.gz
tar zxf mysql-5.5.28.tar.gz
tar zxf php-5.3.15.tar.gz
tar zxf openssl-1.0.1c.tar.gz
tar zxf mod_ssl-2.8.30-1.3.39.tar.gz
tar zxf mod_ssl-2.8.30-1.3.39.tar.gz

I decided to start with the mysql installation.

Created a group ‘mysql’ and user ‘mysql’ with the following commands.


groupadd mysql
useradd -g mysql -c “MySQL Server” mysql

Moved to ‘mysql-5.5.28’ and ran ‘./configure’, but recieved ‘command not found’ error. From the Internet, understood that from mysql-5.5, cmake is used instaed of ./configure.
Ran ‘cmake mysql-5.5.28’ and again received ‘command not found’ error.

Understood that cmake needs to be installed. Downloaded ‘cmake-2.8.3.tar.gz’, unzipped, and moved to ‘cmake-2.8.3.tar.gz’.

Ran ‘./configure’ and encountered ‘gcc’ not found error.

Made yum working and installed ‘gcc’ and ‘gcc-c++’ using yum.

Then I installed ‘cmake ‘ using the below commands.


./configure
gmake
gmake install
—‘cmake mysql-5.5.28’

After removing ‘CMakeCache.txt’, ran ‘cmake mysql-5.5.28’ and encountered ‘curses library not found’ error. Installed ‘ncurses-devel’ and ran ‘cmake mysql-5.5.28’. At the end, saw the warning ‘Bison executables not found’. Ignored it and gone ahead with ‘make’ and ‘make install’. However, running ‘./scripts/mysql_install_db’ was not successful. With the assumption that installation is corrupted, tried to reinstall several times but failed as before.

Exported the bison path as below but did not help.


export PATH=$PATH:/usr/local/bison/bin

I left the mysql installation there and went for apache installation. Since I was not convinced with the installation of apache mentioned at ‘http://lamphowto.com/lampssl.html’, went for another link and got the below link.


http://www.thegeekstuff.com/2011/03/install-apache2-ssl/

I followed the instructions here and upon compiling, encountered ‘libssl not found’error.
Installed ‘libssl-dev’ using yum and compiled apache with ssl support, and successfully installed apache-2.2.17.

I came back to the mysql installation and tried to uninstall source installation using the below command, but it wasn’t successful.


make -n uninstall

I did a detail study on source installation of mysql and understood that the new installation will overwrite the old one. Also, read that it is better to download the tar ball from mysql’s site.

So, I downloaded ‘mysql-5.5.27.tar.gz’ from the below URl.


wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.27.tar.gz

>From the URL ‘http://dev.mysql.com/doc/refman/5.5/en/installing-source-distribution.htm’. understood that bazar, bison and perl needs to be installed before mysql. Installed perl and bazar using yum and bison from the source. After that, I successfully installed mysql-5.5.27.

However, the command mysql was not working since the server fails to identify the binary. So, I included the following line in the root’s .bashrc and .bash_profile and this fixed the issue.


PATH=${PATH}:/usr/local/mysql/bin

Then I went for the installation of ‘php-5.3.15’ with mysql support. Upon compiling, I received the ‘configure: error: xml2-config not found’ error. So, I installed ‘libxml2-devel’ using yum. When I recompiled, again ended with the error ‘configure: error: Cannot find MySQL header files under yes’. Then I specified the path of mysql as below and the compilation eneded with another error, cannot allocate memory.


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

Then I recompiled using the option ‘disable-fileinfo’ as below and successfully installed ‘php-5.3.15’.


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

Created a phpinfo page at ‘/usr/local/apache2/htdocs’ and upon loading, it was just showing the code instead of info page. However, the page was displaying properly when using the php command:
php -r ‘print_r(phpinfo());’
I had been copied the ‘development’ version of php.ini to /usr/local/lib/php/ini. Upon checking, I could find that the ‘short_open_tag’ has the value ‘Off’ for ‘development’ version. Changed it to ‘On’ and loaded the info page successfully.
Thus, I completed the most interesting ‘LAMP’ installation.

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