The installation playbook for ZM1.23-3 and Debian Etch
Posted: Wed Dec 10, 2008 5:53 pm
I have tried to document a suitable installation sequence of ZM 1.23 on Debian Etch. I believe this is a valuable information because as for me, I spent 4 weeks on details and 3 temporary installations to learn and plan a proper installation (and I have 15 yrs of Unix administration and teaching experience - ).
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):
3. Modify your /etc/apt/sources.list file. First double the 4 lines which contain "etch" and then, for the copied 4 lines, change the each occurrance of etch to testing. This way you will have 4 lines describing "etch" sources and another 4 describing "testing" sources. BTW, etch is the codename of the Debian distribution, there were sarge and woody before it.
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.
5. Then it's time to install some useful utilities. This is my choice:
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.
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?):
This time you need to upgrade it to the next (unstable) level to ensure the automatic installation of ZM. Again, the "unstable" status is a Debian quirk. ZM makes the use of Debian only as a platform, not needing the full security Debian usually is offering for installations.
7. Next - go for a new (unstable) kernel. What really is heard to be unstable with ZM, is the 2.6.25 kernel. And what we all are waiting (because uh as many new camera drivers in it, is 2.6.27). However, as of December 2008, you probably should command:
And now please REBOOT your machine with "init 6" command to be extremely sure that it is bootable with the new kernel.
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.
10. Familiarize yourself with installation of some ZM prerequisites:
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.
11. Now arrives the holy moment - get and install Zoneminder. apt-get is a clever command thus the dependencies (like mysql) will be installed, too.
As some manuals state, you need to override the Debian perceived security with the command:
It sets the setUID bit on this binary so that you can correct your /dev/video* permissions even over the Web GUI (which fact probably deeply shocked the security maintainers of Debian )
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.
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).
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:
Rename the old /home into something else and create a new /home as the mountpoint. Enter the knowledge about your new disk into /etc/fstab with the mount priority 2. In my fstab (not yours) it looks like this:
18. Keep your server running at heavy load during 1-2 weeks. This way you will test the motherboard and software are really OK for a server installation. Some MB's or cards certainly are not OK.
Additions and corrections are welcome.
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.