Google Plus

Howto: Install Lamp and phpmyadmin on Ubuntu

LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform that uses Linux as operating system, Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language.
In this Simple tutorial we will explain you how to install LAMP server on your Ubuntu Desktop work also for the new  Ubuntu9.04 (Jaunty Jackalope).
The installation will be done in 3 steps:
Apache, PHP and MySQL, after that we will install phpmyadmin the administration software tool for MySql.

1- Apache2 installation

sudo apt-get install apache2  

to check that Apache has been installed without problems, go to your browser and type

 http://localhost

if everything is correct you will see the message :

It works

Now we will go and try to install PHP5

2- PHP5 and dependencies installation:

sudo apt-get install php5 libapache2-mod-php5 

A restart of apache2 is needed to make this one see PHP5, to restart apache2 use the command:

sudo etc/init.d/apache2 restart

3- MySql Installation :

To install MySql type the command

sudo apt-get install mysql-server  

During the installation you will got this screen (package configuration) to set root password for MySql, enter your password and retype it

if you diden`t got the screen to setup root password for mysql then you have to do it manually, to setup root password for mysql :

mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('YOURPASSWORD');   

Don`t forget to change YOURPASSWORD with the password you want to use The basic installation of LAMP is ready. Now we will install phpmyadmin,

phpMyAdmin is a free graphical software tool to handle the administration of MySQL, this will make it easy for you to create, import/export and delete

databases. Install phpmyadmin using the command:

 

sudo apt-get install phpmyadmin  

During the installation a blue screen will appear asking you which server you want to use apache, apache2 …. choose then apache2 and click ok

and is done, now Point your browser to: http://domain/phpmyadmin you will got this screen

Pic

if you diden`t receive any screen of psckage configuration during the installation of phpmyadmin then you will have

To set up phpmyadmin under Apache manually, all you need to do is include the following line in /etc/apache2/apache2.conf, first type the following command to open up this file:

sudo gedit /etc/apache2/apache2.conf

Add the following line of code inside apache2.conf:

Include /etc/phpmyadmin/apache.conf

Now restart Apache:

sudo /etc/init.d/apache2 restart

and is done, now Point your browser to: http://domain/phpmyadmin (see pic above)

If you have any problem please report it .Thanks.

For questions please refer to our Q/A forum at : http://ask.unixmen.com

  • http://blog.codeunit.co.za Craig

    Brilliant little tutorial, worked first time for me!

    Quick note though: Shouldn\’t

    \”sudo etc/init.d/apache2 restart\”

    read perhaps:

    \”sudo /etc/init.d/apache2 restart\”

    Other than that, perfection! :)

  • Thomas Rendleman

    Couldn\’t get it to work on Ubuntu 10.04 Desktop 64bit

  • Zinovsky

    Hi, Normally should work, did you get any error message?
    If doesen`t work try this one [url=http://www.unixmen.com/linux-tutorials/570-install-lamp-with-1-command-in-ubuntu-910]Install LAMP with one command in Ubuntu[/url]

  • http://www.ronnie-samuel.com Ronnie

    Muchas gracias amigo, el tutorial me fue de gran ayuda, solo un error cuando intento reiniciar apache con la linea:
    sudo /etc/init.d/apache2 restart
    me dice comando no encontrado. Gracias.

  • begueradj

    it works for me
    begueradj

  • Andy

    thank you guys

  • http://blogtips.org peter

    I am a novice. An absolute novice. Just wanted to be able to develop websites on my laptop. It took me 2 days to install Ubuntu, but with your post, it only took me 1 hour to install LAMP (something I was warned to be very complex)…

    Very well done!!!

  • Steve

    Newbie on linux here, running Ubuntu 11.10 with the dreaded Unity.

    I have to say, I am working at getting better at linux, and especially the command line.

    Normally, I have found, I learn most when something in one of the tutorials simply doesn’t work, and leaves trying to modify a file I have never heard of in a folder I can’t find or access with commands that I don’t understand.

    I learned nothing at all from your tutorial… in fact, it worked exactly as you showed, with no modifications or playing around. I didn’t even have to try and compile something from source.

    Could you work on that?

    Other than that, this was a beautiful tutorial.

    • Steve

      Lol! Nevermind… I think I’m learning again!

      For some reason, whenever I pull up a local page written in .php, the system simply downloads the page rather than interpreting it and feeding it to the browser.

      More strangely, this only seems to apply to subfolders… testphp.php works fine (in the main public folder), yet, once I put in localhost/WebApp, it downloads the index.php file from that location.

      Any ideas?

  • Jim

    Fantastic walk-through! Thanks.

  • Mkpandey

    plz make a small correction to restart apache.
    sudo  /etc/init.d/apache2 restart

  • Mkpandey

    plz make a small correction to restart apache.
    sudo  /etc/init.d/apache2 restart

  • Mkpandey

    plz make a small correction to restart apache.
    sudo  /etc/init.d/apache2 restart

  • Mkpandey

    plz make a small correction to restart apache.
    sudo  /etc/init.d/apache2 restart