Possible Duplicate:
What's the easiest way to set up a LAMP stack?

I would like to install Apache and PHP on my new machine, running Ubuntu 11.10, but I can't see either of them listed in the software centre. What do I need to do to install them? So far as I know, any version will do. I just need to find out how to install them in the way I am least likely to get wrong.

marked as duplicate by Lekensteyn, Jorge Castro, Bruno Pereira, jrg, htorque Jan 18 '12 at 23:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Search for synaptic package manager in the Software Center and install it. Fire it up and then search for apache2 and php5-cli. Install both. Also install libapache2-mod-php5 so you can execute php scripts on your apache server. Good luck!


LAMP Linux, Apache, MySQL, PHP are external packages. Each package can be configured and installed separately. You may use the following steps to install manually.

Open your terminal and type:

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 to give a password for your MySQL "root" user

After the the installation finished check Apache is working. Open your favorite browser and type localhost in the address bar. You should see a message "It works!"

Also check if php is working or if not,

Open your terminal and type: sudo gedit /var/www/info.php

copy and past the following info text


Save and exit.

Restart apache:

sudo service apache2 restart

open your browser and type:


and you will see the PHP info page.

Not the answer you're looking for? Browse other questions tagged or ask your own question.