LAMP on Ubuntu 10.10
I recently installed Ubuntu 10.10 on my laptop and one of the things I had to set up Apache, Mysql and PHP for development purposes. I wanted to note down the steps I took to set this up for future reference.
Install tasksel (if not already installed) by opening up a command prompt and typing in the following command:
Once tasksel is installed, type in the following command: sudo tasksel Select the “LAMP Server” option You will be asked to enter a password for MySQL (don’t leave this blank) Let the installation finish! Once the installation is finished, open up a web browser window and type the following into the address bar: http://localhost/ – If apache was installed correctly, you will see a message stating that “It works!”.
Configure Apache User Directories
In a command prompt, type the following command:
Restart apache by typing in the following command:
Note: you can also use sudo service apache2 reload
Create a the public_html directory on your home folder and if not already set, make sure the permissions are set to 755 (using chmod).
Configure Apache mod_rewrite module
Type in the following command:
Restart apache:
Test PHP Installation
cd into your public_html folder and create a file called info.php and enter the following code:
If all is set up and running, you have successfully tested PHP!
Note: If when you try to access the info.php file your browser asks you to download it, you will have to do one additional step. Apparently Debian and Ubuntu by default disable php scripts from running in a users home directory (apparently this is an issue with Ubuntu 10.10 but does not appear in Ubuntu 10.04). To get php scripts to work, follow these additional steps:
Edit file:
Comment out the following lines:
Save the Changes Restart apache with the following command:
You should now be able to view your test php file.
Leave a comment