Recent Posts ¶

Installing ZoneMinder on Debian Lenny

Ronald MacDonald <ronald@rmacd.com> Mon May 03 09:22:16 GMT 2010

Article History
  • 3 May 2010 - main article
  • 26 May 2010 - minor corrections (thanks Jordan)

Introduction

Pre-install

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

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 for Ubuntu users)

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

Then back to the folder:

[ctrl+d ]
cd ~/zminder
wget http://www2.zoneminder.com/downloads/ZoneMinder-1.24.2.tar.gz
tar -zxvf ZoneMinder-1.24.2.tar.gz

Then obviously:

cd ZoneMinder-1.24.2

and then

./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, how about some funky shizzle?

make
su <pass>
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

That’ll actually create the DB as well as set it up. But one last thing: A password!

This is probably a good point to instil another habit upon you: Just because you’re going to set a MySQL user with a particularly easy password to only be able to authenticate via lo1calhost does not make your DB secure. Granting shell access to a system, for example, typically allows for a user to forward ports, meaning they may connect to your DB with the simple username/password combination and edit your data.

For this, I tend to use the following web site: https://www.grc.com/passwords.htm. These very high-quality strings can be used to secure your database, so (selecting only a portion of the random alpha-numeric string):

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

Remember the ' and the '' at the end of the string!

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.

Have fun! And please email any problems or corrections to ronald@rmacd.com