Build LAMP Server (step by step guide)

Share your expert knowledge and show off your skills.
nasacis
Battalion Havaldaar Major
Posts: 269
Joined: Sat Dec 13, 2003 3:58 pm
Location: Faisalabad
Contact:

Build LAMP Server (step by step guide)

Postby nasacis » Fri Jul 25, 2008 9:08 am

This document will walk you through the installation of what is known
as a "LAMP" Linux, Apache, MySQL and PHP system.

OS: CentOS 5.2
Apache: httpd-2.2.9.tar.gz
MySQL:mysql-5.0.51b.tar.gz
PHP:php-5.2.6.tar.gz
Method: tar-ball

Build and Install MySQL
groupadd mysql
useradd -g mysql -c "MySQL Server" mysql
cd /usr/local/src/mysql-4.1.22
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

Configuring MySQL

./scripts/mysql_install_db
chown -R root:mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/data
cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig
cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
/sbin/chkconfig --level 3 mysql on
cd /usr/local/mysql/bin
ln -s /usr/local/mysql/bin/* /usr/bin/

Security Issue
Edit /etc/my.cnf and uncomment the line (delete the leading #).
skip-networking

Start MySQL
/etc/rc.d/init.d/mysql start
mysqladmin version
mysqladmin -u root password new-password #replace new-password with
your actual password of your database

Test Mysql
mysql -u root -p #provide password which you set with above command
and you will see mysql prompt
mysql>
drop database test;
use mysql;
delete from db;
delete from user where not (host="localhost" and user="root");
flush privileges;
update user set user="sqladmin" where user="root";
flush privileges;
create database foo;
drop database foo;
\q


Build and Installing APACHE
./configure --prefix=/usr/local/apache
make && make install

Build and Install PHP
./configure --with-apxs2=/usr/local/apache/bin/apxs --disable-debug --
enable-ftp --enable-inline-optimization --enable-magic-quotes --
enable-mbstring --enable-wddx=shared --enable-xml --with-gd --with-
gettext --with-mysql=/usr/local/mysql --with-regex=system --with-zlib-
dir=/usr/lib
make && make test && make install
cp php.ini-dist /usr/local/lib/php.ini
ln -s /usr/local/lib/php.ini /etc/php.ini
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
vi /etc/httpd.conf #and add these content type in apache conf file
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.htm index.html

Start Apache
ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S90httpd
/etc/rc.d/init.d/httpd start

Regards
Nafees Ahmed
Cell: +92.300.8653568
UAN: 041-111432432
Nexlinx Faisalabad
www.nexlinx.net.pk
nafees29@gmail.com

x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

LAMP on Ubuntu

Postby x2oxen » Fri Jul 25, 2008 9:25 am

Last edited by x2oxen on Mon Aug 18, 2008 10:39 am, edited 1 time in total.
Muhammad Usman
+92-321-6640501
Chemonics International
http://usmanpk.com

mudasir
Captain
Posts: 565
Joined: Tue Oct 17, 2006 5:23 am
Location: Dubai
Contact:

Postby mudasir » Tue Aug 05, 2008 3:52 pm

AOA,

Good work... Its worth an appreciation.
Kind Regards
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com

nasacis
Battalion Havaldaar Major
Posts: 269
Joined: Sat Dec 13, 2003 3:58 pm
Location: Faisalabad
Contact:

Postby nasacis » Tue Aug 05, 2008 7:04 pm

thanks for appreciation
Nafees Ahmed

Cell: +92.300.8653568

UAN: 041-111432432

Nexlinx Faisalabad

www.nexlinx.net.pk

nafees29@gmail.com

lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Postby lambda » Tue Aug 05, 2008 8:48 pm

php step 2 is broken.
Watch out for the !
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?

nasacis
Battalion Havaldaar Major
Posts: 269
Joined: Sat Dec 13, 2003 3:58 pm
Location: Faisalabad
Contact:

Postby nasacis » Wed Aug 06, 2008 9:43 am

Nafees Ahmed

Cell: +92.300.8653568

UAN: 041-111432432

Nexlinx Faisalabad

www.nexlinx.net.pk

nafees29@gmail.com

lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Postby lambda » Wed Aug 06, 2008 2:09 pm

Watch out for the !
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?

nasacis
Battalion Havaldaar Major
Posts: 269
Joined: Sat Dec 13, 2003 3:58 pm
Location: Faisalabad
Contact:

Postby nasacis » Wed Aug 06, 2008 6:17 pm

Nafees Ahmed

Cell: +92.300.8653568

UAN: 041-111432432

Nexlinx Faisalabad

www.nexlinx.net.pk

nafees29@gmail.com

x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

Postby x2oxen » Fri Aug 08, 2008 8:26 am

This is what my aptitude search showed up.

root@proxy:~# aptitude search php5
p libapache2-mod-php5 ---------server-side, HTML-embedded scripting language (apache 2 module)
p libgv-php5---------Php5 bindings for graphviz
p php5---------server-side, HTML-embedded scripting language (meta-package)
p php5-apache2-mod-bt---------PHP bindings for mod_bt


Its working fine for me!
Muhammad Usman

+92-321-6640501

Chemonics International

http://usmanpk.com

lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Postby lambda » Fri Aug 08, 2008 9:10 am

the phptest step is broken.
Watch out for the !
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?

LinuxFreaK
Site Admin
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
Location: Karachi
Contact:

Re:

Postby LinuxFreaK » Mon Aug 18, 2008 7:35 am

Farrukh Ahmed

x2oxen
Major General
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Location: Faisalabad
Contact:

Postby x2oxen » Mon Aug 18, 2008 10:39 am

Muhammad Usman

+92-321-6640501

Chemonics International

http://usmanpk.com


Return to “Howto's & Tip n' Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest