Disclaimer - I did my best to compile these instructions. If your dog gets hurted as a consequence of following these instructions - do not blame me. You should have your own head on your shoulders. As Vladimir Uljanov said once upon a time - do trust, but do double-check!
1. Download Debian 4 r1 CD and start the installation from it. I will not describe things that are available in Debian installation manuals. Equally this is not the place to teach you to use vi editor, ALT+Fx multiscreens etc.
Install the "Base" system only, do not install X/win, databases or anything else. The reason is simple - you are building a server not a desktop machine. Otherwise, if this is your first touch with ZM or Linux, do install X/Win, because you need programs like xawtv for testing purposes.
Define HTTP or FTP as the installation source. Restart the system to see whether you will survive the next boot.
2. Modify your /etc/apt/apt.conf.d/70debconf file or create etc/apt/apt.conf file to overcome a Debian "feature". Here is the line to be added (and the exact value of the number is not critical):
Code: Select all
APT::Cache-Limit "50000000";
Have a look at my example below, p6.
4. Now let's study how to upgrade the Debian. apt-get update will read in what Debian repository has for you, and apt-get upgrade will bring the state of your installation onto "testing" level.
Code: Select all
apt-get update
apt-get upgrade
lynx - is the text-only capable replacement for IE or Firefox
ssh - eh you want to access your box over the network?
mc - a Norton Commander clone (a simple but effective file manager)
zip, bzip2 - these are packing options you might need
htop - will show the proccess list to you, it really excels over default "top".
Sometimes the command you need is available as an utility within a bigger package - then you need some googling to define what the actual package name is under Debian.
Code: Select all
apt-get install lynx ssh mc zip unzip bzip2 htop
6. Let's modify your /etc/apt/sources.list again. But this time let's include 4 more lines containing "unstable". And believe me, the "unstable" is rather stable for the purpose. Debian way of thinking is that you will expose your camera server directly at the hostile Internet what certainly is not the case (I hope so). At that stage, you could comment out the "etch" and "cdrom" lines at all.
Here is the result (and, use your local servers not these in Estonia, eh?):
Code: Select all
#
# deb cdrom:[Debian GNU/Linux 4.0 r4a _Etch_ - Official i386 NETINST Binary-1 20080804-15:10]/ etch contrib main
# deb http://ftp.ee.debian.org/debian/ etch main
# deb-src http://ftp.ee.debian.org/debian/ etch main
# deb http://security.debian.org/ etch/updates main contrib
# deb-src http://security.debian.org/ etch/updates main contrib
# Date, Comment
deb http://ftp.ee.debian.org/debian/ testing main
deb-src http://ftp.ee.debian.org/debian/ testing main
deb http://security.debian.org/ testing /updates main contrib
deb-src http://security.debian.org/ testing/updates main contrib
# Date, Comment
deb http://ftp.ee.debian.org/debian/ unstable main
deb-src http://ftp.ee.debian.org/debian/ unstable main
deb http://security.debian.org/ unstable /updates main contrib
deb-src http://security.debian.org/ unstable/updates main contrib
Code: Select all
apt-get update
apt-get upgrade
Code: Select all
apt-get install linux-image-686
linux-latest-modules-2.6.26-1-686
8. Now is the time to learn googling. For a reason or two you could find these things useful to obtain:
jpegsrc-6b-x86simd-1.02.tar.gz - makes library 1.5x faster
mjpg-streamer_r64-1_i386.deb - you absolutely need this for IP and UVC cameras
sn-webcam-0.8.0.tar.gz - possibly you won't need it but who knows.
The rule is that *.tgz stuff need compiling crom the source and *.deb stuff is suitable for direct installation. Search and download with lynx - you will later need this antique art. lynx http://www.google.com is the command you need.
9. Update the PCI and USB definitions up to the latest level. This will not necessarily ensure your latest gadget be useful under Linux, but at least it gets recognized.
Code: Select all
update-usbids
update-pciids
gspca-modules-2.6.26-1-686 - self-explaining
libjpeg62 - some graphic libraries. Although ZM should install these automatically, see how to re-install these manually in case you mock up your jpegsrc-6b-x86simd substitution.
mjpg-streamer_r64-1_i386.deb - you downloaded it before. Now install it.
luvcview, w3cam - you could need these as test tools.
Code: Select all
apt-get install gspca-modules-2.6.26-1-686
apt-get install libjpeg62
dpkg -i mjpg-streamer_r64-1_i386.deb
apt-get install luvcview
apt-get install w3cam
Code: Select all
apt-get install zoneminder
Code: Select all
chmod 4755 /usr/bin/zmfix
12. Now the easy part is over. Configure your WWW paths.
You have ZM running but Apache has its own idea about where are its documents. Thus go for /etc/apache2/sites-enabled/000-default and do change the some lines. /usr/share/zoneminder is what ZM is initially configured under Debian (see /etc/zm/zm.conf) while Apache prefer /var/www. Look at my example but still think yourself. You need to verify both DocumentRoot and Directory lines.
ZM is absolutely not critical about where are it's files located but ZM's knowledge must be in accordance with what Apache thinks about it. The /etc/zm/zm.conf will also take care of MySQL path.
In 000-default file - two values should be OK - DocumentRoot /home/www/ and Directory /home/www/.
( The XSS security of this forum did not permit me to post the excerpt from the actual file.)
And do not forget restarting the running daemons with /etc/init.d/apache2 restart and/or /etc/init.d/zoneminder restart each time you changed the relevant configuration. After successfully completing with this step you probably can access your ZM web interface. Use another computer for the purpose.
13. Do something to ensure your clock will be in sync with the rest of the world from now till the eternity. Nothing is more annoying in the security world as the random clock drifts.
Code: Select all
apt-get install ntp
hwclock --systohc
apt-get install ntp-doc
14. Google a bit to find a little usbtree script (Perl). Install it in /usr/sbin and chmod 0755 it.
15. Prepare your environment for C compiling. You could need it for jpegsrc-6b-x86simd-1.02.tar.gz . And believe me or not, it'll mostly compile without any error. Google for the zoneminder context (why at all you need this lib).
Code: Select all
apt-get install gcc make nasm
16. Now you have to fiddle with the configuration options. Some short advisory:
If in doubt, always use Deep filesystem hierarchy (Options Paths) and remember, changing it later will erase ALL your events. Start every monitor with 320x240 3fps to avoid exotic problems. Set monitor names and better define timestamps mimicking ISO standards: (%N - %Y-%m-%d %H:%M:%S)
In case you have many USB cameras (difficulties with the boot order of /dev/video* devices), better disable (erase) the /etc/rc3.d/S20zoneminder link and tune things manually.
17. Your mileage could vary but I prefer having my data files under a separate disk and separate file system. My personal preference for the mountpoint is /home not /var or /usr because, on errors, a missing /home will not bring the Linux to its knees while others probably will.
Choose your file system type - could ReiserFS or xfs be better than ext3?
After you have copied the /home files onto a new disk, fix the permissions with chown www-data:www-data /home/www. You might even use linking instead of copying:
Code: Select all
cd /usr/share/zoneminder
ln -s /usr/lib/cgi-bin cgi-bin
ln -s /home/www/zm/events events
ln -s /home/www/zm/images images
ln -s /home/www/zm/temp temp
Code: Select all
proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro 0 1
/dev/sda5 none swap sw 0 0
/dev/hda1 /home ext3 defaults,errors=remount-ro 0 2
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
Additions and corrections are welcome.