How to install and Configure LAMP in Ubuntu ( Linux ) Manually ?
As I mentioned in Installation of Xampp for windows , XAMPP package is also available for Ubuntu and other Linux distributions .So you can download that from http://www.apachefriends.org/en/xampp.html .
To learn how to install LAMP using XAMPP package , Click Here .
What I am going to explain here is , installation all the components of PHP,MySQL,Apache2 manually without installing it as a package .
I am using Ubuntu 12.10 Linux distribution . You can try the same steps in other distributions also and I hope it works , if any problem , kindly comment here . We will help you .
Here is the step by step Manual :
Step 1 :
Install Apache Web Server
> goto your terminal
> type the following command and hit enter
sudo apt-get install apache2
It may prompt for password , just provide it .
It will take few moments to download and install apache server in you machine .
Once it installed successfully , Just restart the apache server .
Type the following code in the terminal window and hit enter .
sudo /etc/init.d/apache2 restart
After the installation , open your browser , in the address bar type localhost and hit enter .
If it shows something like “It works” . Then it means apache web server is installed in your system .
Step 2 :
Now let us install the PHP .
Goto terminal and type the following command and hit enter .
sudo apt-get install php5 libapache2-mod-php5
It may prompt for confirmation , type Y and hit enter .
Now the installation will begin and goes for few minutes or seconds depends upon your INTERNET connection .
Once it installed successfully , Just restart the apache server .
Type the following code in the terminal window and hit enter .
sudo /etc/init.d/apache2 restart
Now we have to verify the installation .
To do that , open a text editor and type the following php code inside it and save it .
<?php phpinfo(); ?>
Save it with .php extension , for example save it as verify.php . You have to save in the location , /var/www/verify.php .
To make the task simple , go to terminal and type the following command and hit enter .
gksu gedit /var/www/verify.php
It will open text editor now type <?php phpinfo(); ?> and press CTRl + S to save it .
Open your browser now , go to address bar , type localhost/verify.php .
It should display a php information page , if so everything is perfect till now . Proceed to next step .
Step 3 :
Now you have to install mysql .
go to terminal , in this case , you have to install more than one tool . Run all the following 6 codes in the terminal window one by one and install all the 6 packages .
- mysql-client
- mysql-client-5.5
- mysql-client-core-5.5
- mysql-server
- mysql-server-5.5
- mysql-server-core-5.5
Sometimes mysql may not work properly ,so install all the 6 packages in your system .
During installation , mysql may ask for root password , so provide it and remember it for future use .
Once it installed successfully , Just restart the apache server .
Type the following code in the terminal window and hit enter .
sudo /etc/init.d/apache2 restart
To check the installation of MySQL , goto terminal and type mysql -h localhost -u root -p
hit enter .
it will prompt for password , provide your mysql password , not your Ubuntu system login password !
now the terminal will show some mysql related information and its prompt looks like this
mysql>
it means MySQL installed properly and is ready to use .
you can check further by entering the following command in mysql> prompt
mysql> show databases;
It will list the predefined databases
information_schema
information_schema
If its fine , now type exit and exit out of mysql prompt .
Step 4 :
Now optionally you can install phpmyadmin .
It is a gui based mysql and php interaction system .
This is not required but will be helpful surely , go ahead and install it using the command .
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
Step 5 :
Now you have to make few changes to the php configuration file .
Go to terminal and type the following command .
gksudo gedit /etc/php5/apache2/php.ini
It will open the configuration in a text editor .
Find this line
;extension=mysql.so
and change that to
extension=mysql.so
just remove the semicolon in front of extension and save it .
Now find this line in the same file
display_errors = off
change it like this
display_errors = on
If there are any semicolon just remove that and save it once again ( CTRL+S ) .
Type the following code in the terminal window and hit enter .
sudo /etc/init.d/apache2 restart
Step 6 :
That’s it you are done . Next step is learn php/MySQL and start developing dynamic web pages
If you find any difficulty in following my tutorial , just comment here , We are ready to help you
Prev – Installing XAMPP in Windows .
Next – First PHP Web page .
(766)








2 pings
What you need to get start with PHP/MySQl ? - Technical Repository
December 21, 2012 at 10:52 PM (UTC 5.5) Link to this comment
[...] To Know how to install and Configure PHP, MYSQL , Apache ( LAMP ) in Ubuntu , Read Here [...]
Your first PHP web page - Technical Repository
December 21, 2012 at 11:01 PM (UTC 5.5) Link to this comment
[...] Prev – Installing XAMPP in Ubuntu ( LINUX ) . [...]