How to install LAMP on Ubuntu

Install Apache :

open up the terminal and run following commands.

sudo apt-get update
sudo apt-get install apache2

this should install apache on your machine.

what does “sudo apt-get update” does??

Install MySQL :

run the following command on the terminal.

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

while running this you would be asked to set a root password.

after installing MySQL it has to be activated.run the following command to do so.

sudo mysql_install_db

then run the following MySQL set up script

sudo /usr/bin/mysql_secure_installation

when running above script you will be asked several questions.If you want you can change root password here.for other questions better to go with the default options.

Now only one step is remaining.it is to install PHP.

Install PHP :

Open the terminal and type the following command.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

if will be usefull if you add php to the directory index.run the following command to do so.

sudo nano /etc/apache2/mods-enabled/dir.conf

add index.php to the begining of index files listed in the above file.

There are so many PHP modules that are very useful in your future developments.For the moment those are not required.Those can be installed in this way.

Now you are all set to go.restart the apache server so that the changes will take effect.run following command to restart apache server.

sudo service apache2 restart
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.