-----------------------------------------------------------------------
-- PREREQUISITES --
-----------------------------------------------------------------------
These instructions assume that you are already running php5 under apache2 
with MySQL 5.0 or later. This site has not yet been tested under Windows 
or IIS. I have written these instructions for Fedora 10, but they will 
easily work with other Fedora / RedHat distributions.

For help, check out the forums: http://www.getlifebox.org/forums

Just to make sure you have the prerequisites, you should probably run as root:
yum install httpd mysql-server mysql php-mysql mysql-libs php php-common php-pdo wget vim

-----------------------------------------------------------------------
-- STEP BY STEP INSTRUCTIONS --
-----------------------------------------------------------------------
1. Download and extract the files to the web root.

	cd /var/www/
	sudo wget http://www.getlifebox.org/latest.tar.gz
	sudo tar -xzvf latest.tar.gz

2. Make sure the files are readable and have the appropriate permissions.
	
	sudo chmod 755 lifebox -R
	sudo chown username.root lifebox -R(replace username with your username)

3. Add lifebox to the bottom of httpd.conf so it knows where the scripts are
	
	vim /etc/httpd/conf/httpd.conf
	
	NameVirtualHost *:80
	<VirtualHost *:80>
		DocumentRoot /var/www/lifebox/html/
		ServerName photos.example.com # <-- REPLACE WITH YOUR SITE NAME
		<Directory />
			Options FollowSymLinks
			AllowOverride All
		</Directory>
	</VirtualHost>
	
	#Make sure modrewrite is enabled and installed. Uncomment the below line in httpd.conf
	LoadModule rewrite_module modules/mod_rewrite.so

	#Then, restart the apache server
	sudo /etc/init.d/httpd restart

4. Install the required packages:

	# Start installing from your home directory
	cd ~

	#mediainfo v0.7.9 or greater
	#http://mediainfo.sourceforge.net/en/Download
	#Download all 3 packages: libzen0 libmediainfo0, CLI
	#At the time of writing this, it was a little 
	#tricky to find the exact filenames through sourceforge. 
	#But they should look something like the below:

	Once downloaded, install them (Your package names may differ):
	sudo rpm -ivh libzen0-0.3.8-1.i386.Fedora_10.rpm
	sudo rpm -ivh libmediainfo0-0.7.11-1.i386.Fedora_10.rpm
	sudo rpm -ivh mediainfo-0.7.11-1.i386.Fedora_10.rpm

	#imagemagick 6.3.7.9 or greater
	#This package requires a bunch of dependencies.
	#If you're using debian or ubuntu, apt-get makes this really easy:
	sudo yum install ImageMagick

	#ufraw 0.13-1build2 or greater
	#This is required if your site is required to process RAW images. 
	#Probably a good idea to have just in case.
	sudo yum install ufraw

5. Enable video support

	Fedora makes this really easy when we add 
	rpmfusion to our rpm index. I generally don't 
	like to break from compiled rpms, so we're 
	going to use these tested binaries and simplify 
	our install process.

	-------------------------------
        - Install ffmpeg with h264 support
        -------------------------------
	#First, make sure your repository list contains the 
	#sources we require:
	rpm -Uvh http://ftp-stud.fht-esslingen.de/pub/Mirrors/rpm.livna.org/livna-release-10.rpm \
		 http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm \
		 http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

	#Then, install ffmpeg and all required libraries
	sudo yum install ffmpeg x264-libs faac lame-libs xvidcore faad2-libs ffmpeg-libs

	-------------------------------
	- qt-faststart
        -------------------------------
	When videos are streamed from the site, we need to make 
	sure the information bit is at the front of the video 
	so we get the nice progress bar and can play while 
	downloading. We have to re-arrange most videos to do this, 
	and this application does it really nicely. There is no 
	binary for this file, so we have to download the source 
	for ffmpeg using subversion, compile a small part of it, 
	then copy the single binary.

	#From inside the ffmpeg directory from the step above
	cd ~/
	yum install subversion
	svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
	cd ffmpeg
	./configure
	make tools/qt-faststart
	sudo cp tools/qt-faststart /usr/local/bin/qt-faststart

6. Set write permissions for the directories where lifebox will 
store its template cache, thumbnail cache, and database cache.

	#Set write permissions for the dump directory
	sudo chmod 775 /var/www/lifebox/dump/* -R
	sudo chown root.apache /var/www/lifebox/dump/* -R

7. Configure the database

	#Create the database
	mysqladmin -p -u root create lifebox

8. Launch the lifebox installer to configure the rest.

	http://photos.example.com/
