Tuesday, 16 October 2012

Linux-Apache-Mysql-PHP (LAMP) Installation from Source



1. Installation Of Apache Web server:


1)Download apache from apache site httpd-2.2.22.tar
2)Then
# gzip -d httpd-2.2.22.tar.gz ///if it is a zip file
# tar -xvf httpd-2.....tar ///extracting file
3)# cd httpd-2.2.22
4)# ./configure --prefix=/usr/local/apache
# make
# make install
5)Edit the configuration file /usr/local/apache2/conf/httpd.conf
NameVirtualHost 192.168.1.109:80
<VirtualHost 192.168.1.109:80>
DocumentRoot /home/www/www/
ServerName test007.server.com
</VirtualHost>
6)Restarted the service for apache
# cd /usr/local/apache2/bin
# ./apachectl start
7)No response if start was perfect
8)If there is a problem with listening ports then
remove httpd
9)http://test007.server.com/
We get a output as "IT WORKS" if installation is correct....
10)For forbidden errors
chmod a+x /home/www/www
If it still persist then give the following but no recommended
chmod 705 /
chmod 705 /home
chmod 705 /home/www
chmod 705 /home/www/www/
chmod 644 /home/www/www/index.html
11)http://test007.server.com/

2. Installation Of MYSQL:


1)Download mysql package mysql-5.0.91 from the website
2)then
# gzip -d mysql-5.0.91.tar.gz ///if it is a zip file
# tar -xvf mysql-5.0.91.tar ///extracting file
3)Run the following commands to configure Mysql
# cd /home/test007/mysql-5.0.91
# chown -R root.root *
# ./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--disable-maintainer-mode \
--with-mysqld-user=mysql \
--with-unix-socket-path=/tmp/mysql.sock \
--without-comment \
--without-debug \
--without-bench
# make
# make install
# ./scripts/mysql_install_db
4)Setting the ownership
# chown -R root:mysql /usr/local/mysql/
# chown -R mysql:mysql /usr/local/mysql/data
5)Copy the default configuration file for the expected size of the database
# cp support-files/my-medium.cnf /etc/my.cnf
# chown root:sys /etc/my.cnf
# chmod 644 /etc/my.cnf
6) # echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
# ldconfig
7)Create a startup script
# cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
# chmod +x /etc/rc.d/init.d/mysql
8)Then set up symlinks for all the MySQL binaries
# cd /usr/local/mysql/bin
# for file in *; do ln -s //usr/local/mysql/bin/$file /usr/bin/$file; done
9)Start Mysql
# /etc/rc.d/init.d/mysql start
# /etc/rc.d/init.d/mysql stop
10)Now set Mysql password for the user "root"
# mysqladmin -u root password redhat
11)login into mysql
# mysql -u root -p
Enter password : redhat



3. Installation Of PHP:


1)Download php package php-5.3.8 from the website
2)then
#gzip -d php-5.3.8.tar.gz ///if it is a zip file
#tar -xvf php-5.3.8.tar ///extracting file
3)Configure the PHP source for your particular platform and personal requirements
$./configure --prefix=/usr/local/ --with-apxs2=/usr/local/apache2/bin/apxs
An Error occured stating that libxml2 was not present
libxml2-devel was installed to continue
4)PHP package is build and installed at specified location
$make
$make install
5)A php page is created at document root of apache
<?php
phpinfo();
?>
6) chmod 644 info.php
7) chown root:root info.php
8) chmod 705 www/
9)Now open the Apache conf file ie, httpd.conf and add lines to enable Php extension.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


10)Add index.php to the list of valid Directory Index files so that your "default page" in a directory can
be named index.php
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>
11) Apache daemon is started
$cd ../bin/
$./apachectl start
12)http://test007.server.com/info.php , php info page gets displayed





try this........ :-)



No comments:

Post a Comment