Monday, December 30, 2013

LAMP Server Setup (WAMP alternative) on UBUNTU

LAMP is an acronym of Linux, Apache, PHP and MySQL bundle. These four components are all free and open-source software. The last three components depends on client. Here I am going to describe how to setup a LAMP bundle includes Apache, PHP and MySQL software. Linux operating system should already be established. Therefore, we have to setup the last components "AMP".

Run Terminal (Ctrl+Alt + T)
sudo apt-get install apache2 
sudo apt-get install mysql-server
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install phpmyadmin

Now, you are able to type 127.0.0.1 or "localhost" on your address line through the browser. This is first but not the last step to complete LAMP. 

Default index.html file is in /var/www folder. The problem, it is not allowed to read and write. That means you have to change the main directory of LAMP. 

To copy the default file: 
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite

Create a new config file by using nano (or gedit) text editor: 
sudo nano /etc/apache2/sites-available/mysite

 Change the DocumentRoot (/var/www) to the new location site: 
/home/user/www/
user is the root name of your Linux system.

Restart Apache2 to activate new settings: 
sudo /etc/init.d/apache2 restart

That's all.

No comments: