Install and Configure LAMP on Ubuntu


In this article, I will share my experience install and configure LAMP on Ubuntu Linux.

1. Launch Terminal
First open up Applications->Accessories->Terminal.

2. Install Apache
Type the following line of command:

sudo apt-get install apache2

3.Install PHP5
Execute the following command by typing the following line in the Terminal and hit enter:

sudo apt-get install php5 libapache2-mod-php5

4. To Stop/Restart Apache
Execute the following command in the Terminal:

Stop/Restart Apache

5.Install MySQL Server

sudo apt-get install mysql-server

6.Set mysql root password
You’ll need to set a password for local computer gets root access.

a. First type the follwing line and hit enter to avoid being prompted for password:

sudo su

b. now you must kill the running mysql server. The process id is grabbed from /var/run/mysqld/ and inserted into the kill statement. Note there are ticks (`) around the process id, not single quotes (’).

kill `cat /var/run/mysqld/mysqld.pid`

c. Now you need to run a command to cause the server not to use the privilege system at all, which gives anyone with access to the server unrestricted access to all databases.

mysqld –skip-grant-tables & mysql -u root

d. Set the password:
UPDATE mysql.user SET Password=PASSWORD (’newpassword’) WHERE User = ‘root’;

e. execute the following commands one by one to finish the password setup.
exit
kill `cat /var/run/mysqld/mysqld.pid`
mysqld &
mysql -u root -p

7.Install MySQL Administrator

sudo apt-get install mysql-admin

8. Refresh Gnome Panel

killall gnome-panel

9. Install MySQL for Apache HTTP Server

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

10. To get PHP to work with MySQL, open the php.ini file

gksudo gedit /etc/php5/apache2/php.ini

11. Add the following line somewhere in the opened up file:

extension=mysql.so

12. Restart Apache
sudo /etc/init.d/apache2 restart

Now you are done!

Related Articles:
Install and Configure phpMyAdmin on Ubuntu LAMP
Create a Subdomain Virtual Host on Ubuntu

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Twitter
  • Yahoo! Bookmarks

,

  1. #1 by zirvap on March 12, 2008 - 7:12 am

    This is so far the most complete guide I have found. There are many instruction out there, your one is similar to the one i read at http://www.supriyadisw.net/2006/12/lamp-installation-on-ubuntu, but yours is far more precise. It’s like a combination of all the incomplete blog tutorials. Good job!

  2. #2 by Siva shankari on August 23, 2008 - 2:50 am

    Hi, tis s a wonderful work.. bt, i want to know how to proceed after this in Ubuntu. How to launch LAMP in Ubuntu? Plz do help me, im totally new to both Ubuntu and LAMP. Im getting ample info. for XAMP installation. bt, nothin regarding LAMP.

  3. #3 by admin on August 24, 2008 - 2:52 am

    hi, Siva shankari maybe you can read Related Articles – Create a Subdomain Virtual Host on Ubuntu, it teaches you how to actually run PHP code and execute it from browser.

  4. #4 by rakesh on September 28, 2008 - 8:43 am

    really really helped me .. thank you very much..

    regards
    rakesh

  5. #5 by Pradeeban on December 17, 2008 - 10:33 pm

    Wonderful job. Keep it up.. Regards…

  6. #6 by Alex on August 9, 2009 - 10:10 am

    Hello i want to know how I create subdomain’s to ubuntu

  7. #7 by dihan on August 20, 2009 - 8:14 pm

    thank you very much for this post. it’s very helpful for me.

  8. #8 by dilbagh ali on February 1, 2010 - 9:34 pm

    thank you very much for the post
    this is very useful
    it has helped me a lot :)
    than you onec again
    god bless you my dear :)

(will not be published)