Friday, November 25, 2011

Quick install LAMP server on Ubuntu

Here is the site I am going to summarize here: https://help.ubuntu.com/community/ApacheMySQLPHP
I am using Ubuntu 10.10 for this install. It should take 10 minutes or so to follow these steps.
The fastest way to install Appache2, PHP5.3, and MySQL is to use this command:
sudo tasksel install lamp-server
If you are using 11.04 then tasksel might not be installed. Then use this to install it:
sudo apt-get install tasksel
Tasksel will install the Lamp server but won't remove it, but we won't need to remove it.
At this point go to http://localhost and it should say "It works!"
Next use this command to make a new site:
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite gksudo gedit /etc/apache2/sites-available/mysite
Make a folder in your home folder called webhome or anything you want to put your website in instead of the default var/www because I like to be able to edit the website files from my home so I own them and don't have to use sudo to edit them as root. Edit the DocumentRoot line to point to your new web root: /home/user/webhome/
Change the Directory directive by fixing the path to point to your webhome folder. Instead of <Directory /var/www/> use <Directory /home/user/public_html/>
After saving the file in gedit use these commands to disable the default website and enable the new website.
sudo a2dissite default && sudo a2ensite mysite sudo /etc/init.d/apache2 restart
Next make a index.php file in the webhome folder that says:
<?php phpinfo(); ?> Now go to: http://localhost
You should see the php configuration showing all the php settings.
This was pretty easy. They have streamlined alot of these steps.

No comments: