UP | HOME

BOBYE'S HOME

Note: L inux + A pache + M ySQL + P HP/ P erl together commonly known as LAMP Server.

Table of Contents

Build Your Own Debian/Ubuntu LAMP (Local) Server

Any web developer, designer, or webmaster can benefit from having a local web server. Even if that developer has no interest in securing and maintaining the server his or her websites live on, a local server can act as a convenient mirror for testing updates, trying new designs, and other general sand-boxing activities.

Before proceeding to install, update the necessary packages with debian with this command.

apt-get update
apt-get upgrade

Installing Apache + PHP

Apache is one of the most famous web server which runs on most linux based servers. With just few commands you can configure apache to run with PHP 4 or PHP 5.

apt-get install apache2 php5 libapache2-mod-php5

Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www.

To check whether php is installed and running properly, just create a test.php in your /var/www folder with phpinfo() function exactly as shown below.

nano /var/www/test.php
# test.php
<?php phpinfo(); ?>

Point your browser to http://ip.address/test.php or http://domain/test.php and this should show all your php configuration and default settings. If it doesnot work, and alternatively your browsers is downloading our test PHP file rather than Apache processing it first, you may try to add the two lines below into your configuration file.

AddType application/x-httpd-php .php
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

Additionally, to enable the Per-user web directories, hence each user can be permitted to have a web site in their home directory using the UserDir directive. You should probably add the two lines below to your configuration file.

LoadModule userdir_module /usr/lib/apache2/modules/mod_userdir.so
UserDir public_html

Installing MySQL Database Server

Installing mysql database server is always necessary if you are running a database driven ecommerce site. Remember running mysql server to a fair extend requires atleast 256mb of RAM in your server. So unless you are running database driven sites you dont absolutely need mysql. The following commands will install mysql 5 server and mysql 5 client.

apt-get install mysql-server mysql-client php5-mysql

During the installation process, it will automatically consult for passwd for root user. Make sure you have specified properly.

The configuration file of mysql is located at: /etc/mysql/my.cnf

PhpMyAdmin is a nice web based database management and administration software and easy to install and configure under apache. Managing databases with tables couldnt be much simpler by using phpmyadmin.

apt-get install phpmyadmin

The phpmyadmin configuration file is located at: /etc/phpmyadmin folder.

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf:

Include /etc/phpmyadmin/apache.conf 

Now restart Apache:

/etc/init.d/apache2 restart

Point your browser to: http://domain/phpmyadmin

That's it! MySQL and phpMyAdmin are ready. Log in with your mysql root password and create users to connect to database from your php script.

Author: YE JIANBO <yelpoo[AT]gmail.com>

Date: 2010-08-31 22:24:01 CST

HTML generated by org-mode 6.33x in emacs 23