Last week I published a new version of my ZoneMinder Virtual Appliance. The virtual appliance is great if you want to easily deploy ZoneMinder without having to spend time setting it up. However, in some situations, you want to run ZoneMinder directly on the hardware. Perhaps you need better performance or simply need to capture video streams from V4L-devices.

Since I already spent the time getting it running, I thought I’d share the instructions for getting it running. It’s pretty straight forward, but there are a few minor things that took me some time to get around.

Installation

Optional: I personally prefer to install the do ‘minimal’ version of Ubuntu. You can install this mode by simply hitting F4 right at boot.

Other than the installing the ‘minimal’ system, the only things you would need to keep in mind are to install “LAMP” and “OpenSSH” under the Software selection. You will also need to pick a MySQL password, which will be used later.

Configuration

Upgrade the package repository:
sudo apt-get update && sudo apt-get upgrade

Install all required dependencies:
sudo apt-get install build-essential ffmpeg libmysqlclient-dev libjpeg-dev libssl-dev libdate-manip-perl wget liblwp-useragent-determined-perl libavformat-dev libphp-serialization-perl libswscale-dev joe

Get Zoneminder:
wget http://www.zoneminder.com/downloads/ZoneMinder-1.24.2.tar.gz

Extract Zoneminder and change permission:
sudo tar xvfz ZoneMinder-1.24.2.tar.gz -C /usr/local/
sudo chown -R `whoami` /usr/local/ZoneMinder-1.24.2

Configure Zoneminder:
cd /usr/local/ZoneMinder-1.24.2
./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin/ --with-webuser=www-data --with-webgroup=www-data ZM_DB_USER=zm ZM_DB_NAME=zm ZM_DB_PASS=yourpassword ZM_SSL_LIB=openssl

Resolve a bug (discussed more here):
joe src/zm_utils.cpp (or your favorite editor)
Add the line ‘#include ‘ on row 22 (or somewhere in that general area). To exit and save with Joe, press ctrl+k x.

Build and install Zoneminder
make
sudo make install

Configure the database:
mysql -uroot -p < db/zm_create.sql
echo "GRANT ALL PRIVILEGES ON zm.* TO 'zm'@'localhost' IDENTIFIED BY 'yourpassword'; FLUSH PRIVILEGES;" | mysql -uroot -p

Install Cambozola:
cd
wget http://www.charliemouse.com:8080/code/cambozola/cambozola-latest.tar.gz
tar xvfz cambozola-latest.tar.gz
sudo cp cambozola-0.76/dist/cambozola.jar /var/www/zm/

Make Zoneminder the root-page in Apache:
sudo joe /etc/apache2/sites-enabled/000-default

Change “DocumentRoot /var/www” to “DocumentRoot /var/www/zm” and “Directory /var/www/” to “Directory /var/www/zm/”

Restart Apache:
sudo /etc/init.d/apache2 restart

Change some system parameters:
sudo sysctl kernel.shmall=134217728
sudo sysctl kernel.shmmax=134217728

Make the system parameters permanent:
sudo joe /etc/sysctl.conf

Add the following lines at the end:
kernel.shmall=134217728
kernel.shmmax=134217728

Install the startup-script (from the official site):
sudo wget http://viktorpetersson.com/upload/zm -O /etc/init.d/zm
sudo chmod +x /etc/init.d/zm
sudo update-rc.d zm defaults
sudo /etc/init.d/zm start

That’s it. You should now have a fully working version of ZoneMinder. All you need to do now is to point your browser to the IP address of the server.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Slashdot
  • StumbleUpon

Tags: , ,

  • Dave

    SELECT command denied to user 'zmuser'@'localhost' for table 'Config' I finnaly got a log In screen after a dozen tries. I'm using ubuntu 10.04 with a WinTv all in wonder pvr 250 card. I was able to get it working in windows, but in linux… I'm now getting the above error. Your help would be great.

  • Boga

    Its is stupid tutorial. Make it work on your pc first and then suggest people.

  • Saint

    @”resolve a bug” you should use html code for < < and > > or the browser will read it as a html tag

  • Saint

    @”resolve a bug” you should use html code for < < and > > or the browser will read it as a html tag

  • Anonymous

    Well, obviously I did get it to work using these exact instructions, otherwise I wouldn’t have been able to produce the virtual appliance referred to in the opening of the article.

  • Tavo Tell

    I have a problem…

    root@Server:~/Descargas# sudo /etc/init.d/zm start
    Starting ZoneMinder: DBI connect(‘database=zm;host=localhost’,'zm’,…) failed: Access denied for user ‘zm’@'localhost’ (using password: YES) at /usr/local/share/perl/5.10.1/ZoneMinder/Config.pm line 89
    Can’t call method “prepare_cached” on an undefined value at /usr/local/share/perl/5.10.1/ZoneMinder/Config.pm line 91.
    BEGIN failed–compilation aborted at /usr/local/share/perl/5.10.1/ZoneMinder/Config.pm line 100.
    Compilation failed in require at /usr/local/share/perl/5.10.1/ZoneMinder.pm line 33.
    BEGIN failed–compilation aborted at /usr/local/share/perl/5.10.1/ZoneMinder.pm line 33.
    Compilation failed in require at /usr/local/bin/zmpkg.pl line 46.
    BEGIN failed–compilation aborted at /usr/local/bin/zmpkg.pl line 46.
    failure

  • Anonymous

    Sounds like you’re having problem with the database access. Try connecting to the database by hand with:
    “mysql -uzm -p zm”
    When prompted, enter the database password for the Zoneminder user under “Configure the database.”

    If you’re able to connect, go back to the “Configure Zoneminder” and make sure the password in the line is the same as you entered above.

  • Spy

    Hi,
    I got it working with the instructions above. thanks!!
    As mentioned, you have to be careful with password sections and those should set correctly then it is working.

blog comments powered by Disqus