Installing ZoneMinder on Debian Lenny

Introduction

Edit your /etc/apt/sources.list as follows: Where in my original sources.list I have:

deb http://ftp.uk.debian.org/debian/ lenny main
deb-src http://ftp.uk.debian.org/debian/ lenny main

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

Edit this so at the end of each line it reads

deb http://ftp.uk.debian.org/debian/ lenny main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ lenny main contrib non-free

deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free

Then you’ll be wanting to run apt-get update and then:

apt-get install build-essential apache2 mysql-server 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 libdbd-mysql-perl libpcre3-dev php5 php5-mysql \
    libapache2-mod-auth-mysql libmysqlclient15-dev gnutls-bin
    ffmpeg pciutils

Course there’ll be a whole load of dependencies to install so obviously ‘Y’ to the proceeding installation question.

Now might be an idea to CTRL+D, mkdir ~/zminder && cd ~/zminder to keep all the following program files in the same place.

Before the installation can proceed, there’s one more dependancy required, that of Perl’s PHP::Serialisation library. This allows zoneminder to store data on rows in a serialised fashion. If this is the first time you’ve used the perl shell, it’ll ask you some questions. Read them. But you’ll probably be wanting to answer yes to all of them.

(You’ll have to be root - sudo bash or su -)

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

Then back to the folder:

cd ~/zminder
wget http://www2.zoneminder.com/downloads/ZoneMinder-1.24.2.tar.gz
tar -zxvf ZoneMinder-1.24.2.tar.gz

Then to configure:

cd ZoneMinder-1.24.2
./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin \
    --with-webuser=www-data --with-webgroup=www-data --with-libarch=lib \
    --with-ffmpeg=/usr/local

Sometimes (like in my case) there’s a problem with the ssl headers so change the command line as follows:

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

So now that it’s all configured, let’s install:

make
sudo make install

It’s a good idea to stick to a regime of configuration and compiling in a non-root shell. Keeps things tidy - and if it goes bananas (not that it ever has, in my case) you’ll be sure it’s not affecting/ed the rest of your system.

Now it’s installed we may ^D again back into the user shell and get the database up and running.

In the zoneminder folder ~/zminder:

mysql -u root -p < db/zm_create.sql

Finally, a password!

mysql -u root -p -e "grant all privileges on zm.* to 'zminder'@'localhost' \
    identified by 'xXxDybByLzcv9y'"

Now, as default, this password is expected in the .conf is the zuser:zpass combination. We changed this though from the default as expected, so let’s modify:

vi /usr/local/etc/zm.conf

and then change the bottom two configurations to zminder:yourpassword.

One final thing - the apache2 install is as default not enabled with php5. If you’re running php already with apache2, you’re not going to have to do this, but otherwise:

a2enmod php5 && apache2ctl restart

Done!

Now take your web browser to http://serveripaddress/zm (as default) or if on localhost, http://localhost/zm

You may of course configure apache2 outwith these specs to provide access on a vhost, but I will leave that up to yourselves.

So that’s the basic installation done. From here, you may add your cameras, monitors and so forth.