LAMP Stands for Linux,Apache,MySQL and PHP. Most of the websites
works with the above combination. if you think the above combination
will be only on servers where the hosting are made, that is wrong you
can made on your own PC which has Linux. The installtion of LAMP on
Ubuntu is simple quiet when compared to other Linux environment.
In other Linux environment you need to install all the packages
separately. But in Ubuntu you can install in one command. Here i am
listing the steps to install LAMP in one command.
Installing Linux:
You can find the tutorial about installing Ubuntu 14.10
here.
Installing AMP (Apache,MySQL and PHP).
Copy and Paste the line in the Terminal.
$ sudo apt-get install lamp-server^
[sudo] password for raj:
Once entered the command, it will ask you to enter the password for the
user. it will search the required package for LAMP server, in the end it
will prompt you to confirm the downloading and installation of
packages. Type Y and then press enter.
After the installation of the all packages it will prompt you to
configure the MySQL root password. Type new root password for MySQL in
the Next Screen.
Repeat the root password.
After that it will continue to install the other packages that are required for AMP.
Testing Apache:
To make sure everything installed correctly we will now test Apache
to ensure it is working properly, The default location of the
documentroot is /var/www/html, you can place your web pages for your
website.
1. Before testing Apache, restart the Apache server.
$ sudo /etc/init.d/apache2 restart
2. Open up any web browser and then enter the following into the web address:
http://localhost/ or http://127.0.0.1
You will get the following page, it means the Apache is working fine.
Apache’s default document root is /var/www/html on Ubuntu, the
configuration file is /etc/apache2/apache2.conf. Additional
configuration files are stored in the /etc/apache2/*-available
directory.
Testing PHP:
For testing the PHP, Place one PHP file on to the default directory of the Apache.
Step 1. In the terminal copy/paste the following line:
$ sudo nano /var/www/html/phpinfo.php
This will open up a file called phpinfo.php.
Step 2. Copy/Paste this line into the phpinfo file:
<?php phpinfo(); ?>
Step 3. Now open you’re web browser and type the following into the web address:
http://localhost/phpinfo.php or http://your-ip-address/phpinfo.php
Configuring MySQL:
This is optional, MySQL will normally listen on the localhost only.
if you want it to listen on the other IP, you will need to edit the
/etc/mysql/my.cnf file.
$ sudo nano /etc/mysql/my.cnf
Change the following line and put your ip on the place of 127.0.0.1.
bind-address = 127.0.0.1 -------> bind-address = 192.168.12.8
That’s all!. Now the Ubuntu 14.10 is ready with AMP. You can put your web pages in the /var/www/html directory for single site.
source : http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/setup-lamp-apache-mysql-php-on-ubuntu-14-10.html