Thursday 19 November 2015

How To Install LAMP on Ubuntu 12.04

Linux         Apache         MySQL             PHP

Step One—Install Apache

open terminal and type in these commands:

sudo apt-get update
sudo apt-get install apache2

Step Two—Install MySQL

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
 
Once you have installed MySQL, 
we should activate it with this command:
sudo mysql_install_db
 
Finish up by running the MySQL set up script:
sudo /usr/bin/mysql_secure_installation
 
Remove anonymous users? [Y/n] y                                            
 ... Success!
Disallow root login remotely? [Y/n] y
... Success!
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reload privilege tables now? [Y/n] y
 ... Success! 

Step Three—Install PHP

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

It may also be useful to add php to the directory index,
 to serve the relevant php index files:


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

Add index.php to the beginning of index files. The page should now look like this:

<IfModule mod_dir.c>
 DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

Step Four—RESULTS: See PHP on your Server

Apache document root is "/var/www" So give full permission.
sudo chmod -R 777 /var/www
  
To set this up, first create a Test Page:
sudo nano /var/www/info.php
 
Add in the following line:
<?php
 phpinfo();
?>

Restart apache so that all of the changes take effect:
sudo service apache2 restart

Step Five

http://localhost/info.php

 

 


 

 


How To Install LAMP on Ubuntu 12.04

L inux         A pache         M ySQL             P HP Step One—Install Apache open terminal and type in these commands: s udo apt-ge...