Sunday, December 27, 2009

how to install lamp on debian/ubuntu

1. Installing Apache +php

#apt-get install apache2 php5 libapache2-mod-php5

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.

vim /var/ww/test.php

copy the folllowing lines in that file

# test.php 
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.
 

2. Installing MySQL Database Server

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

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

Creating users to use MySQL and Changing Root Password

By default mysql creates user as root and runs with no password. You might need to change the root password.
To change Root Password

#mysql -u root -p
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

3. PhpMyAdmin Installation

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.
All you need to do is:
#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.


 

No comments:

Post a Comment