How to install LAMP in Ubuntu 11.10

 

L.A.M.P. is an acronym for solution stack of free and open source software. In order to create a viable general purpose web server, this term has been coined from the first letters of Linux (Operating System), Apache HTTP server, MySQL (database software) and Perl/Python/PHP. Generally “P” is taken to be as PHP but it may also refer to Perl or Python. PHP, Perl and Python are web scripting software.

Each package can be configured and installed separately. Here we will see how to install them at one shot. In earlier version of Ubuntu we used to have “tasksel” and “sudo tasksel” to bring various options including “lamp-server”. Simply selecting lamp-server use to do the work. But we don’t have tasksel in latest Ubuntu. No worries, we still can install the lamp stack in one shot.

Open your terminal. Either press “ctrl+alt+T” or from dash type “terminal” and press enter.

sudo apt-get install php5 mysql-server apache2

The above command will install latest version of PHP which is version 5 and mysql-server with apache http server 2.
You will be prompted in terminal as shown in figure. Give a password for your MySQL “root” user (you can create more users too).

Now to check if its working or not just open your favorite browser and type “localhost” in the address bar. You should see something like this-
(note: this comes from the file index.html located in /var/www/ folder of your system.)

Now to check if php is working or if not, let us create a small php file

Open your terminal and type- sudo vi /var/www/info.php

or you can open the same from gedit or any other editor as

sudo gedit /var/www/info.php

and write:
<?php
phpinfo();
?>

save the file and exit. Restart the apache2 service by typing the command in terminal

sudo service apache2 restart

open your browser and type in address bar the following.

localhost/info.php

and you should see something like this:

yay! you are done now! :-) cheers!

Oh wait. Let us also install phpmyadmin . phpmyadmin helps to take control over our database. It can be done graphically from the browser or from the command line.

to install

sudo apt-get install phpmyadmin

You will be prompted to screen like this-
press space to select apache2 server and enter.

configure phpmyadmin with dbconfig-common. Press yes to configure. give your passwords.

When you are done type “localhost/phpmyadmin” in your address bar of browser, you should see something like this-

give user as “root” and password which you had given before.
you will be taken to phpmyadmin page.
on this page you can create databases, users and many more.

:)


Chandan is a free software evangelist and founder of www.linuxcandy.com .

Advertisement

  • Pingback: A Complete guide to Ubuntu 11.10 Oneiric Ocelot | Linux Candy

  • Pingback: [How to] install wordpress in Ubuntu/Debain system or server | Linux Candy

  • Khasyapnaveendvg

    i am getting like this!!!!!!!!!!!!!!
    root@ubuntu:~# sudo service apache2 restart
     * Restarting web server apache2                                                 … waiting                                                             [ OK ]
    root@ubuntu:~# 

    • linuxcandy

      Thats perfectly fine buddy :) go ahead with next steps!

  • http://twitter.com/explodingwalrus Carl Draper

    I do

    sudo apt-get install tasksel
    sudo tasksel

    Then select ‘LAMP Server’ using Tab and Enter :)

    • linuxcandy

      Thats neat and simple :) will update the post with this alternative style too . Thanks Carl

  • http://www.facebook.com/gauravchauhan2811 Gaurav Chauhan

    Thanks very much.

  • Pingback: There’s No Place Like 127.0.0.1 « Marianne Rogers CSCI462

  • Kertoff2

     I’ve an error once I configured phpmyadmin with dbconfig-common. When I type in my pwds the following error is returned: “ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: YES)”.

    There my terminal is freezing. If ever someone get an idea about this, it would be just great.

    • Someone

       most probably this is the case where you are entering your password mistakenly… did you remember that the password for “root” is same as you typed ? Please check!

    • Kertoff2

       AZERTY QWERTY mismatch… it’s now solved!

  • http://www.cangkal.info/2012/02/mengatasi-phpmyadmin-404-not-found-di.html cangkal

    phpmyadmin not found i just edit on apache2.conf (/etc/apache2/apache2.conf)
    add include phpmyadmin
    code is
    include  /etc/phpmyadmin/apache.conf

    now restart apache
    it’s work! ^_^

    • Some1

      glad to see you posting the solution too rather than just the problem :) Cheers!

  • http://www.facebook.com/Ali.H.Al.Iraqi Ali Al-Iraqi

    Thank you so much

  • Guest

    Gigady gigady

    When restarting apache:

    If you got a message saying “apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName“, do the following:Create a new file /etc/apache2/conf.d/fqdn using a text-editor like sogksudo “gedit /etc/apache2/conf.d/fqdn”Add to the fileServerName localhostSave and close the fileRestart Apache using the command in the previous section. It should now restart without the above message.

    • Someone

      thanks for that update :)  

  • Rick Kalin

    I got the phpMyAdmin page but when I enter my password I get error ’1045 can not log in to MySQL server’. How can I correct the passwors?

    • Some1

      probably you are not using right combination of username and password.. did you use “root” as username ? may be you can try remembering the right username and password or installing it once again (just the phpMyAdmin part)

      • Rick Kalin

        The problem was with the password to MySQL. I was able to reset it using mysqld as shown at:
         http://ubuntu.flowconsult.at/en/mysql-set-change-reset-root-password/

        • http://www.facebook.com/people/Sandesh-Yadav/1166626200 Sandesh Yadav

          glad you were able to solve the problem :)  

  • Pitsein

    why i cannot open localhost/phpmyadmin?? just see this error
    Not Found

    The requested URL /phpmyadmin/ was not found on this server.

    Apache/2.2.20 (Ubuntu) Server at localhost Port 80plz help me…

    • Someone

      are you able to login to your mysql via terminal ? 
      are you able to see the page with php info described above ? 
      if above both are done then php and mysql are installed and there might be issues with phpmyadmin installation.. at which step did you stuck ? please describe your problem properly!

      • Esteban

        in my case, phpmyadmin has ben installed in usr/share/phpmyadmin, try to copy the folder (phpmyadmin) to var/www

        now are working!

        • John Nevill

          You’d probably be better off dropping in a new virtualhost at /etc/apache2/sites-enabled/000-default so that you don’t move your phpmyadmin files outside of the path where apt expects them.  Otherwise you will miss upgrades.  

          Just pop that file open (with sudo) and add a new virtualhost by sticking this in there:

                  Alias /phpmyadmin “/user/share/phpmyadmin”
                 
                          Options Indexes FollowSymLinks MultiViews
                          AllowOverride None
                          Order allow,deny
                          allow from all
                  Honestly, though, this should already be taken care of when you installed phpmyadmin via apt-get. 

  • Pingback: LAMP howto to install a http: server | LUG Nijmegen

  • Innox2010

    when am trying to type localhost/phpmyadmin am getting this message
    “Not Found

    The requested URL /phpmyadmin was not found on this server.

    Apache/2.2.17 (Ubuntu) Server at localhost Port 80″ what can i do? have installed phpmyadmin.

    • Ezekia Matabaro

      Even me The same who can help us please!!!???

      • http://twitter.com/sapatuButut Puspa Bangun Subekti

         hey… try this command

        sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadminthen browse http://localhost/phpmyadmin/

  • Jean C.

    Obrigado por compartilhar… (Thanks for share this) #fromBrazil

  • Efren Morales

    follow all your steps and Voíla!!! XD great!! thank’s
     

  • Sharaf Al Islam

    add libapache2-mod-php5 otherwise php5 alone with not work with apache2

    • some1

      is this true?

  • Freddy Z

    Muy buen aporte. Gracias.
     

  • Simn_stv

    Very quick and straightforward; though i prefer the tasksel better!

  • http://www.facebook.com/MandyDuhan Mandeep Duhan

    you must give some information about “How to configure manually Mysql with PHPMyadmin”

  • María Constanza Rodríguez

    Nice! =) Everything worked just fine. Thanks!

  • Pingback: Linux Candy » How to set up Virtual Hosts with Apache in Linux

  • Pingback: Linux: Como Instalar o servidor LAMP no Ubuntu 11.10 « Luiz Guanabara

  • Pingback: site

  • Pingback: virtual hack