This was tested on a Ubuntu 12.10 server and motion 3.2.12
(http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome)
How I setup motion rough guide.
Install as LAMP server
sudo su
apt-get update
apt-get install motion
(note that the version of motion is 3.2.12 from the repos has no mysql module compiled, this is the main reason for this project as I had many problems trying to compile from source and encountered bugs)
mkdir /cameras
chmod 777 /cameras
nano /etc/apache2/sites-available/default (need to check as working from memory)
changed the default web folder from /var/www to /cameras
mkdir /etc/motion/CameraConfigs
added all camera config thread files in this directory. Make sure that the output path
of the camera is directed to /cameras so for example will be /cameras/cam1
nano /etc/motion/motion.conf
changed image capture to first (for jpg) and video saving to avi (msmpeg)
changed deamon to on
copy the files from here (index.php, error.php and style.css) to /cameras
reboot server and make sure motion is running.
you should be able to go to http://your_server/index.php or http://your_server
This is a very basic setup guide..