LAMP Quick Installation on Ubuntu

Here are the steps to install LAMP (Linux Apache, MySQL, PHP ) server on Ubuntu.

Apache

Install Apache
sudo apt-get install apache2
Test your Apache Server by opening a web browser and enter http://localhost. You should get — It works!

PHP

Install PHP5
sudo apt-get install php5 libapache2-mod-php5

Restart Apache so that apache can see that PHP is installed.
sudo /etc/init.d/apache2 restart

Time to test to make sure php is working. Create a file within /var/www/testphp.php with the following contents:

Save this new file.Open a web browser and enter http://localhost/testphp.php. If all is correct you will see Test PHP page.

MySQL

Install MySQL Server
sudo apt-get install mysql-server

Once mysql is installed, you need to configure it. Mysql comes with the default configuration which allows connection from localhost only. so you may need to remove this restriction. Follow these steps-

Open the file /etc/mysql/my.cnf
gksudo gedit /etc/mysql/my.cnf

Find the line bind-address = 127.0.0.1 and comment it out then save the file.

Mysql comes with no root password. It may ask to enter root password while installation or you can create as follows:-

mysqladmin -u root password newpassword
mysqladmin -h root@local-machine-name -u root -p password newpassword
sudo /etc/init.d/mysql restart

Now you have LAMP Server ready to work with.

~ by Ajay Pratap Singh Pundhir on November 6, 2009.

Leave a Reply