Set up LAMP in Ubuntu
Install Apache
sudo apt-get update
sudo apt-get install apache2Open browser, and enter server’s ip address, if it displays “It works!”, means everything’s good
#Install MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installationRemember to enter password for root. Enter Y for all options.
#Install PHP
sudo apt-get install php5 libapache2-mod-php5 php5-mcryptChange directory index file
sudo vim /etc/apache2/mods-enabled/dir.confAdd index.php to the beginning of index files:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>#Configure Apache Permision
adduser to www-data group
sudo adduser username www-dataChange folder ownership and set permission
sudo chown -R username:username /var/www/html
sudo chmod 775 -R /var/www/html#Add virtual hosts
Create new config file
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite.com
sudo vim /etc/apache2/sites-available/mysite.comModify ServerName to mysite.com
Modify <VirtualHost *:80> info ..
Modify DocumentRoot to DocumentRoot /var/www/html
#Activate Host
sudo a2ensite mysite.com#Restart Apache
sudo service apache2 restart