Setting up a nice LAMP environment on Ubuntu
This is more to aid my memory the next time I have to set up a LAMP development environment on a fresh install of Ubuntu (can you tell what I’ve been up to this weekend?). The nice thing about starting from a blank slate is that it gives me a chance to really think through the overall installation setup and find solutions to issues that I’m normally too busy to track down.
Note: this is intended for local development purposes only, not production servers.
- Set up the base LAMP system
sudo apt-get install apache2 php5 php5-cli php5-mysql mysql-server mysql-client
Note: for ease of development access, I prefer to leave the root MySQL password blank.
- Set up some optional but useful PHP modules
sudo apt-get install php5-gd php5-curl php5-sqlite php-pear smarty
- Set up subversion for source code control
sudo apt-get install subversion
- Prevent Apache error “Could not determine the server’s fully qualified domain name”
echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn
- Enable public_html userdirs, e.g. http://localhost/~username/
sudo a2enmod userdir
- Enable url rewriting for pretty URLs
sudo a2enmod rewrite
- Restart Apache
sudo /etc/init.d/apache2 force-reload


I removed the section on editing userdir.conf to enable full .htaccess support because that doesn’t seem to be an issue with Ubuntu anymore (as of v8.10).