January 24, 2008

Installing ZoneMinder 1.23 under Debian 4.0r2 Etch

ZoneMinder is an open source CCTV application for Linux. A friend of mine first showed it off to me on his Ubuntu system and since having my own dedicated Linux box and a spare webcam lying around, I decided to install it.

The installation requires a basic LAMP installation and a few Perl modules. I have Debian 4.0r2 Etch with already Apache2, MySQL 5 and PHP4 installed. I started with the following guide on ZoneMinder's website: http://www.zoneminder.com/wiki/index.php/Yadig

Installation was easy to follow except when I came to compile and had a couple of issues locating the correct Perl modules. The guide is written for slightly older versions of everything I had installed. Essentially the only module that seems to not be available from Etch's main repositories was PHP::Serialization. After several unsuccessful hunts on Google, I came across the following CPAN site: http://search.cpan.org/~jbrown/PHP-Serialization-0.27/. This is what I wanted, I downloaded, compiled and installed it and was then able to continue the rest of the ZoneMinder installation.

Step-by-Step installation

1. Run apt-get install with with the required packages. I also accepted any recommended packages by apt-get:

# apt-get install apache2 mysql-server libmysqlclient15-dev php4 php4-mysql g++ make netpbm libssl-dev libjpeg62-dev libmime-perl libwww-perl libarchive-tar-perl libdate-manip-perl libarchive-zip-perl libmime-lite-perl libdbi-perl libdbd-mysql-perl libpcre3-dev

2. Download, compile and install the PHP::Serialization module:

# cd /usr/local/src/
# wget
http://search.cpan.org/CPAN/authors/id/J/JB/JBROWN/php-serialization/PHP-Serialization-0.27.tar.gz
# tar -xzvf PHP-Serialization-0.27.tar.gz
# cd PHP-Serialization-0.27
# perl Makefile.PL
# make
# make test
# make install

3. Download, compile and install ZoneMinder:

# cd /usr/local/src/
# wget
http://www2.zoneminder.com/downloads/ZoneMinder-1.23.1.tar.gz
# tar -xzvf ZoneMinder-1.23.1.tar.gz
# cd ZoneMinder-1.23.1
# ./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data
# mysql -u root -p < db/zm_create.sql
# mysql -u root -p
mysql> grant select,insert,update,delete on zm.* to
'zmuser'@localhost identified by 'zmpass'; quit;
# make install

4. Create a Debian init.d script as per instructions here and then restart Apache, MySQL and ZoneMinder:

# /etc/init.d/apache2 restart
# /etc/init.d/mysql restart
# /etc/init.d/zm restart

6. Connect to http://yourserver/zm/ and modify the following two parameters:

  • Under Options, System, set ZM_AUTH_RELAY to none.
  • Under Options, Paths, set ZM_PATH_ZMS to /cgi-bin/zms

7. That's it! Just connect your camera and configure!

Update #1: As mentioned on ZoneMinder's Wiki, you should also increase the amount of shared memory, especially if your camera supports 640x480 as it probably won't be possible to use it at higher resolutions until you've done this. If you do have issues getting 640x480, you can instantly test this by issuing the following command and restarting ZoneMinder:

# echo 134217728 >/proc/sys/kernel/shmall && echo 134217728 >/proc/sys/kernel/shmmax

However upon reboot, this will need to be done again so it's best to edit /etc/sysctl.conf to add kernel.shmmax = 134217728. You can quickly do this by issuing:

# echo kernel.shmmax = 134217728 >> /etc/sysctl.conf

11 comments:

Anonymous said...

Hey dirk diggler, here are my snippets: http://zeitvernichtung.blogspot.com/

Lee n Sarah Go Where? said...

Rob,

Great article helped me out no end. Just a quick question why the change of path for ZM_PATH_ZMS as nph-zms also exits in the cgi bin?

Many thanks

Lee

jay said...

hi !thanks dor the tips , but i have got a prob, as i did what you posted .

at here it stucked.

:/usr/local/src/ZoneMinder-1.23.1# ./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data

configure: error: zm requires gnutls/openssl.h

Lee n Sarah Go Where? said...

Jay,

You will be missing a dependency at a guess try

apt-get install gnutls-bin

Then re-run the install

jay said...

thanks for the tip ,numenory , but still get the " configure: error: zm requires gnutls/openssl.h " sorry !

jay said...

thanks for the tip ,numenory , but still get the " configure: error: zm requires gnutls/openssl.h " sorry ! and i did check the dependency you said it seems there and updated !!!!!!1

Anonymous said...

Excellent article - Jay try addingto the end ZM_SSL_LIB=openssl e.g

./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data ZM_SSL_LIB=openssl

it worked for me.

Andres Gregori said...

very good post! Thank you!

I've installed on Debian Lenny without problem with your steps.

I want to add just a tip:

you can more easy install PHP::Serialization with:

# perl -MCPAN -e shell
install PHP::Serialization
exit

Congratulations.
Regards.
Andres.

Anonymous said...

Hi i am trying to install Zoneminder 1.24 source code on Ubuntu 9.10. i did not see any errors while compiling. i followed the same steps given above.
when i try to run /etc/init.d/zm start i am getting the below error /etc/init.d/zm: command not found.

the problem is i did not see zm folder. and also i did not see /etc/zm folder too.

gangadhar said...

when i instal zone minder using make install i get the error that
chown:invalid user:apche:apache
please some one help me

ddbekesi said...

I solved the "chown:invalid user:apache:apache" problem by using the --with-webuser=www-data --with-webgroup=www-data options when configuring Zoneminder