Google Plus

Install Lamp with 1 command in ubuntu

Written by Mel Kham on . Posted in Linux tutorials

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.

There are many methods to install lamp for example the standart one see our previous howto for ubuntu : Howto: Install Lamp and phpmyadmin on Ubuntu

So lets show you another way to install lamp under ubuntu 9.10 and above.

For Ubuntu 10.10 Maverick meerkat and 11.04 Natty please check this post.


 

First ,under Terminal type the command :

$sudo  tasksel


you will get something like :

Now you have to shoose the LAMP line and SPACE key to select LAMP Server .

After, you will asked to insert root mysql password

After the procedure will start downloading and installing needed packages for LAMP


Of  with  this  command :

sudo apt-get install php5 mysql-server apache2

Or  with :

$ sudo tasksel install lamp-server

Now lets check of its working .

Check the apache2 from your browser :

Http:Ip or hostname

Now check if your Mysql is wokring with:

Check if php is working :

$sudo   vi  /var/www/info.php

and add

{codecitation}<?php
phpinfo();
?>{/codecitation}

save and exit

restart apache2

#/etc/init.d/apache2  restart


and browse again http://ip/info.php


Enjoy and feel free to ask

{loadposition user9}

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

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.
  • Nate

    sudo apt-get install php5 mysql-server apache2

  • http://smallboxadmin.blogspot.com SmallBoxAdmin

    $ sudo tasksel install lamp-server

  • pirat9

    Appreciated and add to the Tutorials
    Thanks again

  • Abe

    No need for any one this, just use XAMPP. It is the best LAMPP I have seen.
    [url]http://www.apachefriends.org/en/xampp.html[/url]

    • http://www.smechains.com neo891

      I found one problem xampp doesn’t run on ubuntu 64 bit
      friend

  • erik witkop

    Run ‘sudo apt-get update’

  • http://ictind.info AL MUBARAK

    Hai.,

    i installed LMAP server in my ubuntu 9.10 but Linux and ajax were working fine but i can’t access my phpmyadmin page and mysql database pages. when i redirected to another pages in my site it will displays like that below.,

    Not Found

    The requested URL /abs/admin was not found on this server.
    Apache/2.2.12 (Ubuntu) Server at localhost Port 80

    but i change the port no into 7900 from 80 then there is no effect in my system.

    Anyine Could help me to rectify this issue.

    Advance in Thannks

  • Pirat9

    AL MUBARAK
    Check the firewall security
    Check the write access on the apache web directory . check if the directory is the same on apache.conf of httpd.conf
    add the hostname and ip to /etc/hosts

    restart apache
    try again

  • Anthony Nandaa

    After going through a number of blogs, I had never come across such an easy way!!!

    Thank sooo much!

  • Kauê

    What if php is not working?

  • birdy

    This was most helpful! I’ve been using linux for a while and never came across tasksel command.

  • Zinovsky

    I see i can not type that code in this page it disappear, i will investigate the problem later but you can copy the code from this page
    http://kb.mediatemple.net/questions/764/How+can+I+create+a+phpinfo.php+page%3F

    :lol:

  • bomber

    Part of the instructions are to add to a info.php file:

    “Chcek if php is working :

    $sudo vi /var/www/info.php

    and add

    save and exit

    restart apache2″

    The problem is you have nothing there to add. When I restart apache and go to localhost/info.php, the computer wants to know what to do with the file.

  • Ron

    I tried running $sudo $sudo tasksel. I used space to select LAMP and also used space to deselect the other packages that were auto selected. Was this a mistake? During the install it asked for a MySQL password and then started deleting what seemed to be necessary components of Ubuntu. The install didn’t even complete and my screen went black. Now when I try to run Ubuntu it is only text based and my password no longer works. Luckily this was a fresh install so I didn’t lose too much. Are you not supposed to uncheck anything? I figured I didn’t need to install packages I already had installed.

    • Zinovsky

      Perhaps you selected Edubuntu server or basic ubuntu server instead of LAMP, that`s why was deleting necessary things of Ubuntu .
      Just follow as described in the screenshots and be sure that you select the right ONE (LAMP) before to press continue.

    • Anonymous

      Apparently if you de-select Ubuntu Desktop (or anything else that is already checked), it will uninstall that item.

  • Jose Oliveira

    Received the message
    “Aptitude failed (100)”

  • Jose Oliveira

    Received the message
    “aptitude failed (100)”

  • Pirat9

    Jose Oliveira
    try with apt command and not with aptitude , and post your output here please

    • Troy

      Hey Pirat9,
      I had the same problem that Jose had and used the alternative input (Like you suggested):
      sudo apt-get install php5 mysql-server apache2

      and it worked perfectly, thanks.

  • Edgar

    Thank you Pirat9. My LAMP is shining bright!

  • Sunny

    I got the same screens show by you. Works like a charm. Thanks for share.

  • http://joelteixeira.net Joel Teixeira

    Damn easy. Thanks a ton!

  • http://www.adminlog.site11.com Yene

    I love this one command line installation, make life easy and not just free :D

  • Itsano

    The php does not work. A dialog pops up asking what to do with the php file.. What’s wrong?

    • derek

      if your php isn’t working, you need to restart apache:

      [code]sudo service apache2 restart[/code]

  • Norman Smith

    $sudo vi /var/www/info.php

    That puts me into a different window, labled "/var/www" with a blinking cursor up top, with a single ~ on each line. Just how does one enter the proffered info?

    Plus, one time I managed to get the info entered, but then how does one save and exit the window, as there are no such options visible?

    I’m using Ubuntu 9.10.

    Norman Smith

  • pirat9

    if you dont know how to use vi editor try with

    gedit /var/www/info.php

  • Kurre

    Try Nano instead of vi, it’s very easy to use. :wink:

    Great tutorial, relay easy to use! :P

  • RobertF

    Now that I turned eth0 on…..

    I had unchecked the auto start box when I was changing from dynamic natted to static public ip and forgot to turn it back on.

    Got my info screen!

    By this time tomorrow, I should have a full Radius Manager 3.8 install sitting on top.

    Many thanks!

  • http://www.yantrajaal.com Prithwis Mukerjee

    could anything be any simpler than this :D

  • osnielf

    vey usefull ! thanks from cuba …

  • Newbie

    M a Ubuntu newbie…. when i typ sudo tasksel only 2 options are there – print server nd ubuntu desktop…i instld ubuntu 8.10…what 2 do now???

  • Saturna Software

    last command should be: sudo /etc/init.d/apache2 restart

  • R@hul

    Very informative n time saving

  • tony

    terminal fails to find host

  • Eric Sutherland

    Keep up the good work and thanks

  • http://www.bestfinance-blog.com ANGIE20Cohen

    According to my investigation, billions of persons all over the world receive the personal loans at well known creditors. Thus, there is good chances to find a auto loan in any country.

  • http://www.bestfinance-blog.com MargieFlowers20

    Cars and houses are expensive and not everybody is able to buy it. Nevertheless, home loans are created to help people in such cases.

  • http://www.bestfinance-blog.com LeannHarding

    One acknowledges that today’s life is expensive, nevertheless people need money for various stuff and not every one earns enough money. Thus to get fast loan or just bank loan should be a proper way out.

  • Taner Temel

    Hello I tried the steps above but couldn’t get it to work, I now have these files on my computer.Could you please tell me how I can now remove these files thanks you

    • Helper

      Taner Temel
      Sudo tasksel ,

      and uncheck the LAMP line Done

      • Taner Temel

        Yes thank you for the reply after looking further I managed to remove the software.

        Thank you!

  • Swati

    I have followed all the given steps, still I am getting "Aptitude failed (100)" error.

    I even tried "sudo apt-get install php5 mysql-server apache2" but it gives me following error:
    ==============================================
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    mysql-server: Depends: mysql-server-5.1 but it is not going to be installed
    E: Broken packages
    ==============================================

    Please help

  • John

    You [b]NEED[/b] to include a warning about tasksel in this tutorial, especially considering it is geared towards noobies.

    It is truly irresponsible to not mention the danger of tasksel removing key system files.

  • Steve

    OK… I know this thread is old… however, the issue remains.

    Running 11.10 and trying to install a LAMP server in this way sorta fails. It DOES install, but does NOT request a root password for MySQL. It also gives me an older version of MySQL than the sever that I am developing for.

    Rather than try and mess with the packages, and/or trying to get phpMyAdmin tied up into this installation, I think I am gonna do it the long way.

    I think I will have better control of the process.

  • http://enteryoursiteURL... ben

    sudo apt-get install php5 mysql-server apache2
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following extra packages will be installed:
    apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5
    libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libhtml-template-perl
    libmysqlclient15off libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.0
    mysql-common mysql-server-5.0 mysql-server-core-5.0 php5-common
    Suggested packages:
    apache2-doc apache2-suexec apache2-suexec-custom php-pear dbishell
    libipc-sharedcache-perl mysql-doc-5.0 tinyca mailx
    The following NEW packages will be installed:
    apache2 apache2-mpm-prefork apache2-utils apache2.2-common
    libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl
    libhtml-template-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl
    libpq5 mysql-client-5.0 mysql-common mysql-server mysql-server-5.0
    mysql-server-core-5.0 php5 php5-common
    0 upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
    Need to get 42,3MB/42,4MB of archives.
    After this operation, 126MB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    WARNING: The following packages cannot be authenticated!
    mysql-common libnet-daemon-perl libplrpc-perl libdbi-perl
    libmysqlclient15off libdbd-mysql-perl mysql-client-5.0 mysql-server-core-5.0
    mysql-server-5.0 libapr1 libpq5 libaprutil1 apache2-utils apache2.2-common
    apache2-mpm-prefork apache2 php5-common libapache2-mod-php5
    libhtml-template-perl mysql-server php5
    Install these packages without verification [y/N]? y
    Err http://archive.ubuntu.com jaunty/main mysql-common 5.1.30really5.0.75-0ubuntu10
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main libplrpc-perl 0.2020-1
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main libdbi-perl 1.607-1
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main libmysqlclient15off 5.1.30really5.0.75-0ubuntu10
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main libdbd-mysql-perl 4.008-1
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main mysql-client-5.0 5.1.30really5.0.75-0ubuntu10
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main mysql-server-core-5.0 5.1.30really5.0.75-0ubuntu10
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main mysql-server-5.0 5.1.30really5.0.75-0ubuntu10
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main libapr1 1.2.12-5
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main libpq5 8.3.7-1
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main libaprutil1 1.2.12+dfsg-8
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main apache2-utils 2.2.11-2ubuntu2
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main apache2.2-common 2.2.11-2ubuntu2
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main apache2-mpm-prefork 2.2.11-2ubuntu2
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main apache2 2.2.11-2ubuntu2
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main php5-common 5.2.6.dfsg.1-3ubuntu4
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main libapache2-mod-php5 5.2.6.dfsg.1-3ubuntu4
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main mysql-server 5.1.30really5.0.75-0ubuntu10
    404 Not Found [IP: 91.189.92.170 80]
    Err http://archive.ubuntu.com jaunty/main php5 5.2.6.dfsg.1-3ubuntu4
    404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-dfsg-5.0/mysql-common_5.1.30really5.0.75-0ubuntu10_all.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libp/libplrpc-perl/libplrpc-perl_0.2020-1_all.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libd/libdbi-perl/libdbi-perl_1.607-1_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-dfsg-5.0/libmysqlclient15off_5.1.30really5.0.75-0ubuntu10_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libd/libdbd-mysql-perl/libdbd-mysql-perl_4.008-1_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-dfsg-5.0/mysql-client-5.0_5.1.30really5.0.75-0ubuntu10_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-dfsg-5.0/mysql-server-core-5.0_5.1.30really5.0.75-0ubuntu10_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-dfsg-5.0/mysql-server-5.0_5.1.30really5.0.75-0ubuntu10_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apr/libapr1_1.2.12-5_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/postgresql-8.3/libpq5_8.3.7-1_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apr-util/libaprutil1_1.2.12+dfsg-8_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-utils_2.2.11-2ubuntu2_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2.2-common_2.2.11-2ubuntu2_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-mpm-prefork_2.2.11-2ubuntu2_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2_2.2.11-2ubuntu2_all.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-common_5.2.6.dfsg.1-3ubuntu4_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/php5/libapache2-mod-php5_5.2.6.dfsg.1-3ubuntu4_i386.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-dfsg-5.0/mysql-server_5.1.30really5.0.75-0ubuntu10_all.deb 404 Not Found [IP: 91.189.92.170 80]
    Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_5.2.6.dfsg.1-3ubuntu4_all.deb 404 Not Found [IP: 91.189.92.170 80]
    E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

  • http://enteryoursiteURL... ben

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

pigmej

|

Just one thing:

What about pep8 in your python code ? How can you give ‘tutorials’ on quite popular website, of such a bad quality ?

Amit Rai

|

I just renamed shared.xml and it logged in and created a new shared.xml.

DB Griffin

|

Larry Page is not being completely honest! The manner in which the PRISM program/project works does not need access from company administrators or owners, so called “direct access”; the access to the information is already there. These tech company CEOs take for granted the actual intelligence of most end users of their products. All it takes is a little digging and reading to go from ignorant to informed on these things especially on exactly how the internet works/functions in the U.S.A. I find Larry Page’s remarks just as laughable as Al Gore’s claim to “inventing” the internet/world wide web!

If you, as an end user, are reading this post; I challenge you to research these matters yourself. It really is quite simple with all the “information sites” that exist on the web today ie Wikipedia, & other online encyclopedias that actually list source material, as well as highly respected tech sites and blogs that also list their source material. Be warned: this is only the tip of the iceberg and these tech CEOs know and understand this; they are scrambling in attempt to perform DAMAGE CONTROL to save the company and what little trust thay have left from their products end users/consumers.

Am I a skeptic? I believe someone has to be or needs to be at this point in time! If your not just a little skeptical of the government, tech companies, and the people that are in charge of these agencies and companies; you need to be, even if just a little skeptic. For your own personal protection and security! I know I was a part of this community for over 14 years!

Anders Jackson

|

As I understand it so do VLC use same encoders as ffmpeg. And yes, there are less code that can break when you use command line instead of a graphical UI.

And may I ask what mono has to do with VLC? *facepalm*

Anders Jackson

|

Just some thoughts about Java.

OpenJDK7 are now THE Java implementation and Oracles are just one more of the reimplementations. So you should not need to install Oracles version.

And you really don’t need to remove the OpenJDK7 installation to also have Sun Java JDK 7. Just run

sudo update-java-alternatives –list

and select which java you want to have as default java of all that is installed.

And if you want to run a program with one special version, check manpage for java-wrappers how to do that.

man java-wrappers

so you can run java program rasterizer like this:

JAVA_FLAVOR=openjdk rasterizer
JAVA_ARGS=-Xmx80m rasterizer

JAVA_BINDIR=/usr/share/

etc

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .