welcome to netwrkspider

Friday, June 12, 2009

LAMP SERVER Installation.

How To Install and Configure Apache/HTTPD 2.2.11, PHP 5.2.9 and MySQL 5.0.81 From Source OpenSUSE 11.

What is Apache / HTTPD ?
Apache is a freely available Web server that is distributed under an open source license. It is the most widely-installed Web server.

What is PHP ?
PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in standalone graphical applications.

What is MySQL ?
MySQL is a relational database management system (RDBMS)[1] which has more than 6 million installations.[2] The program runs as a server providing multi-user access to a number of databases.

In This Tutorial, We will start to install and configure Apache Webserver, PHP and Mysql from Source / tar.gz in O/S OpenSUSE 11.

So I assume you already have OpenSUSE11 installed, up and running.
This tutorial also can be implemented in other O/S such as : Centos and Fedora or other Linux O/S.

1. Download All Packages and Other dependency packages.

Login into your server with root access.

#cd /root
#wget http://www.alliedquotes.com/mirrors/apache/httpd/httpd-2.2.11.tar.gz
#wget http://us.php.net/distributions/php-5.2.9.tar.gz
#wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/mysql-5.0.81.tar.gz

Download GD, Freetype, LibXML2,LIBJPEG, LIBPNG, CURL, OpenSSL, ZLIB, DBI


#wget ftp://xmlsoft.org/libxml2/libxml2-2.6.30.tar.gz
#wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
#wget http://curl.haxx.se/download/curl-7.19.5.tar.gz
#wget http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
#wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.608.tar.gz
#wget http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.35.tar.gz
#wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
#wget http://www.zlib.net/zlib-1.2.3.tar.gz

2. Extract, Configure and Install MySQL Server


#cd /root
#tar -zxvf mysql-5.0.81.tar.gz
#cd mysql-5.0.81

#./configure --prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/var \
--with-pthread
#make && make install

#chown -R mysql.mysql /usr/local/mysql

Copy mysql cnf files from this directory below to /etc/
and change the file to my.cnf

#cd /usr/local/mysql/share/mysql
#cp my-small.cnf /etc/my.cnf

Install mysql DB
#/usr/local/mysql/bin/mysql_install_db --user=mysql

Starting mysql server
#/usr/local/mysql/bin/mysqld_safe --user=mysql &

Create mysql root password
#/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

Add into boot.local
#pico /etc/init.d/boot.local

### add this line below into boot.local ###
/usr/local/mysql/bin/mysqld_safe --user=mysql &

3. Install OpenSSL

#cd /root
#tar -zxvf openssl-0.9.8k.tar.gz
#cd openssl-0.9.8k
#./configure && make && make install

4. Install Apache/ HTTPD Web Server

#cd /root
#tar -zxvf httpd-2.2.11.tar.gz
#cd httpd-2.2.11
#./configure --prefix=/usr/local/apache2 \
--enable-so --enable-mods-shared=most \
--enable-ssl=static --with-ssl=/usr/local/ssl
#make && make install

Starting Apache Webserver
#/usr/local/apache2/bin/apachectl start

Add into boot.local
#pico /etc/init.d/boot.local

### Add this line below into boot.local ###
/usr/local/apache2/bin/apachectl start

5. Install Zlib, FreeType, GD, LibXML2,LIBJPEG, LIBPNG, CURL, DBI

#cd /root
#tar -zxvf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
#./configure && make && make install

#cd ..
#tar -zxvf freetype-2.3.5.tar.gz
#cd freetype-2.3.5
#./configure && make && make install

#cd ..
#tar -zxvf jpegsrc.v6b.tar.gz
#cd jpeg-6b
#./configure --prefix=/usr/local --enable-shared
#make && make install

#cd ..
#tar -zxvf libpng-1.2.35.tar.gz
#cd libpng-1.2.35
#./configure && make && make install

#cd ..
#tar -zxvf curl-7.19.5.tar.gz
#cd curl-7.19.5
#./configure && make && make install

#cd ..
#tar -zxvf libxml2-2.6.30.tar.gz
#cd libxml2-2.6.30
#./configure && make && make install

#cd ..
#tar -zxvf gd-2.0.35.tar.gz
#cd gd-2.0.35
#./configure --with-freetype=/usr/local \
--with-jpeg=/usr/local/lib \
--with-png=/usr/local/lib
#make && make install

#cd ..
#tar -zxvf DBI-1.608.tar.gz
#cd DBI-1.608
#perl Makefile.PL
#make && make install

6. Install PHP


#cd /root
#tar -zxvf php-5.2.9.tar.gz
#cd php-5.2.9
#./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-gd=/usr/local \
--with-jpeg-dir=/usr/local/lib \
--with-zlib-dir=/usr/local \
--enable-ftp \
--with-png-dir=/usr/local/lib \
--with-freetype-dir=/usr/local \
--with-curl=/usr/local
#make && make install

Make sure your Apache Web Server support PHP,
You can check it in apache config files.

#cd /usr/local/apache2/conf/
#pico httpd.conf

### make sure this line below is already there
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php

7. Restart Apache Webserver

#/usr/local/apache2/bin/apachectl stop
#/usr/local/apache2/bin/apachectl start

8. Create a test.php with phpinfo in file



#cd /usr/local/apache2/htdocs
#pico test.php



9. Open a test.php from your Browser


You can try to access test.php from your browser
Example your server ip address is 10.10.10.10

Http://10.10.10.10/test.php

If browser show like below it's mean you are success configure Apache, PHP and Mysql
Please make sure you need to crosscheck with the PHP ext module such as mysql module, GD etc.

No comments: