Installing LAMP on Ubuntu 10.04 and 10.10 (Lucid Lynx, Maverick Meerkat)

April 29, 2010 by Linerd
Filed under: HowTo, linux, Ubuntu, web development 

Page 1 Page 2

If you're developing websites, it's nice to be able to test your code in the privacy of your own computer rather that out in the public internet. In order to do that, you'll need to install a web server on your development computer. LAMP (Linux, Apache, MySQL, php) is one of the most common web hosting platforms, so it's a perfect environment for you to build and test your website code. If you carefully follow these step by step instructions, you'll have your own Ubuntu LAMP web server on installed, configured, and running in no time.ย 

Install LAMP Web Server on Ubuntu

The Ubuntu developers have made it easy to install and configure the LAMP server packages with a single command. Simply open a terminal window and enter the following.

sudo apt-get install lamp-server^

No, that's not a typo. Please make sure to include the caret (^). The command will not work without it.

spacer

sudo apt-get install lamp-server^

The apt package manager will show all the packages that need to be installed. Hit <Enter> to confirm that you want to install them.

spacer

LAMP packages

You will then be prompted to change the password for the root user on theย MySQL database.

spacer

Set MySQL root password

Enter the password you want. You'll be prompted to enter it a second time to confirm.

After you confirm your password, apt will continue to install the rest of the packages.

Congratulations, your LAMP installation is now complete! That was the easy part, now you need to get a few things configured to make your system easy to work with.

Test Apache

Open a web browser and enter the address localhost/. You should see a web page that says "It Works!"

spacer

Testing Apache

Test php

Now that you know Apache works, you'll want to test the php installation. You'll need to create a file in /var/www called testing.php. Open a terminal and enter:

sudo nano /var/www/testing.php

Enter the following line into the text editor, save the file and exit.

<?php phpinfo(); ?>

Next, restart Apache with the following terminal command:

sudo /etc/init.d/apache2 restart

Now go back to your web browser and enter the address localhost/testing.php/. You should see a page displaying version information for your php installation.

spacer

php Information

Configure MySQL

Since I'm installing LAMP for a web development environment, I want the MySQL database to be bound to the localhost IP address. This should be 127.0.0.1 for your system. You can verify it with this terminal command.

cat /etc/hosts | grep localhost

You'll now want to verify that the correct bind address is set up in MySQL's my.cnf file.

cat /etc/mysql/my.cnf | grep bind-address

You should see a line that looks like this:

bind-address		= 127.0.0.1

If the IP address doesn't match the one for your system, you'll need to edit the my.cnf file to correct it.

Page 1 Page 2

Tags: Apache, HowTo, LAMP, linux, Lucid Lynx, phpMyAdmin, Ubuntu, web development, web server

Comments

498 Responses to “Installing LAMP on Ubuntu 10.04 and 10.10 (Lucid Lynx, Maverick Meerkat)”

« Older Comments
  1. spacer Izak says:
    January 17, 2013 at 11:44 AM

    The best step by step configuration document I have ever come across, thanks for the work it was simply brilliant and easy to follow.

    Reply
  2. spacer Varun says:
    February 2, 2013 at 11:40 AM

    I'm new to linux and i think this was the easiest installation procedure i came accross. thanks!

    Reply
  3. spacer Marcos says:
    February 11, 2013 at 3:03 PM

    Nao esta funcionando comigo segue o erro:
    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

    Reply
« Older Comments
Click here to cancel reply.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a class="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Subscribe by email

    Enter your email address:

    Delivered by FeedBurner

    spacer
  • Top Content

    • How To Control Fan Speeds in Ubuntu
    • Remove Old Kernels In Ubuntu With One Command
    • Review: Linux Mint 14 MATE Edition
    • How to Configure Apache Web Server on Linux
    • Installing LAMP on Ubuntu 12.04 Precise Pangolin
    • How To Rotate The Screen in Ubuntu With The Nvidia Driver
    • Fade Out Images with GIMP
    • Install SSH and SFTP on Ubuntu or Linux Mint
    • Create a Bootable FreeDOS USB Drive on Windows
    • Installing LAMP on Ubuntu 10.04 and 10.10 (Lucid Lynx, Maverick Meerkat)
  • Categories

  • Archives

    • ▼ 2013 (3)
      • ► Jan (3)
    • ► 2012 (19)
    • ► 2011 (26)