Video Surveillance With ZoneMinder On Ubuntu

Want to support HowtoForge? Become a subscriber!
 
Submitted by wisu (Contact Author) (Forums) on Fri, 2007-09-07 15:19. :: Ubuntu

Video Surveillance With ZoneMinder On Ubuntu

ZoneMinder is the top Linux video camera security and surveillance solution. In this document I will cover how to get ZoneMinder up and running on Ubuntu 6.06.1 LTS or Dapper Drake with the recent updates included.

 

Hardware Requirements

The surveillance system I am covering here utilizes 4 Dome CCTV cameras hooked up to a single Kodicom kmc-8800 capture card, in addition I also used infrared LEDs so my cameras could see in the dark (honestly I'm abit scared to look). ZoneMinder also does a good job with IP Cameras, unfortunatly they are considerably expensive in my part of the world, hence 4 cameras would blow my budget.

For an in-depth guide of supported hardware one may refer to this link http://www.zoneminder.com/wiki/index.php/Supported_hardware.

In building a system like this one must be aware that it would be storage hungry, therefore an LVM partitioning scheme would be wise to anticipate growth of the system.

In my experience a rig with 4 cameras clogged up my Pentium 4 1,7GHz test system therefore on a production system I used the following resources.

egrep "processor|name" /proc/cpuinfo

processor : 0
model name : Intel(R) Pentium(R) 4 CPU 3.06GHz
processor : 1
model name : Intel(R) Pentium(R) 4 CPU 3.06GHz

cat /proc/meminfo | grep MemTot

MemTotal: 515264 kB

First step after assembly of hardware and strategically placing each CCTV camera, is the Operating System installation. Here I installed a base system without any X-window.

Then we must set an static IP for the system:

cat /etc/network/interfaces

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.202
netmask 255.255.255.0
gateway 192.168.1.1

cat /etc/hosts | grep cctv

192.168.1.202 cctv.bigwisu.com cctv

Then we edit the /etc/apt/source.list to include mulitverse and universe repositories.

deb http://id.archive.ubuntu.com/ubuntu/ dapper main restricted multiverse universe

Afterwards we update and upgrade our system:

sudo apt-get update
sudo apt-get upgrade

In my setup a reboot was required. Next step after reboot is to install Apache, php and MySQL:

sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

Then we need to install the following applications and libraries:

sudo apt-get install ffmpeg libarchive-tar-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl

sudo apt-get install libjpeg62 libmime-perl libstdc++6 libwww-perl zlib1g

Afterwards we download the .deb from the maintainer website:

wget ftp://www.northern-ridge.com.au/zoneminder/ubuntu/dapper/zoneminder_1.22.3-8_i386.deb

Next we install it with the following command:

sudo dpkg -i zoneminder_1.22.3-8_i386.deb

My system had a few dependancy errors, therfore I ran:

sudo apt-get -f install

which automagically fixed any problems.

Here we have already installed all the required packages, next we need some configuration.

First we configure Apache:

sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
sudo /etc/init.d/apache2 force-reload

This surveillance application is run by the apache, therefore to enable access to the Video device we must add www-data to the video group:

sudo adduser www-data video

Now we can access the ZoneMinder GUI, from our favorite browser we type in the URL:

http://IP_ADDRESS_CCTV_SYSTEM/zm

From this interface first step is to add cameras:

CCTV New Video 1

Here we specify the device, dimension and color:

CCTV New Video 2

Result of the newly added camera:

CCTV New Video 3
Click to enlarge

Then we tell ZoneMinder how to process captured images:

CCTV New Video Options

In my case I chose to Motion Detect my system, where recording will only take place upon movement.

I can also choose which area to monitor for movement, here is a sample on the main entrance:

CCTV Motion Detect Zone
Click to enlarge

Here is my 4 camera CCTV system:

CCTV Montage
Click to enlarge

It requires resources as follows:

CCTV CPU Utilization
Click to enlarge
CCTV Utilization RAM
Click to enlarge

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by sethuper (not registered) on Sun, 2013-10-20 21:17.

I have followed step by step in this tutorial, everything is describe, how to install and configure ZoneMinder on Debian/Ubuntu.

http://terminal28.com/how-to-install-and-configure-zoneminder-linux-cctv-debian/

Submitted by ip cctv (not registered) on Mon, 2012-10-08 14:29.
The range and the clarity of this CCTV camera is really awesome. I recently have a new IP CCTV camera that i bought from an online store and the clarity of that is much better than what you have shown here...
Submitted by Br*an with an I (not registered) on Wed, 2011-04-13 00:43.
Thank you for the easy to follow document, seamless integration with (3) DCS 930L's over wireless!!
Submitted by Jorge Mendes (not registered) on Tue, 2011-05-03 17:27.

I can't find the directory: zoneminder/ubuntu/dapper? Is there any other?

Cheers

Submitted by Jesse Taylor (not registered) on Sun, 2011-03-06 21:03.

This guide was much more helpful than the Zoneminder guide for Ubuntu. Thanks for taking the time to put this together.

Submitted by Anonymous (not registered) on Fri, 2010-05-28 16:52.

Hello,

Just to say that it is highly recommanded to use the option -f  [in apt-get command] with extreme precaution as it could generate some problems..

Another way to install ZM on debian like system is to use squeeze dist (it contains zm version 1.24..) which is really straight forward in that it eliminates the headache of dependencies :-)

So if u choose this way of doing, edit /etc/apt/sources.list, comment everything and add the following:

deb http://ftp.us.debian.org/debian/ squeeze main

then:

# apt-get update

# apt-get -y install zoneminder

# ln -s    /etc/zm/apache2.conf     /etc/apache2/zoneminder.conf

(I am not sure if in your installation you will have the same names but i guess it will be ok in 98%.. )

if u need help write me


 

Submitted by El Habib BIROUK (not registered) on Sat, 2010-05-29 12:09.

An error had occured in my previous message: for the symbolic linking the correct command is the following

# ln -s    /etc/zm/apache.conf     /etc/apache2/conf.d/zoneminder.conf

Submitted by Anonymous (not registered) on Tue, 2014-06-03 10:41.

I am getting this error 

ln: failed to create symbolic link ‘/etc/apache2/conf.d/zoneminder.conf’

Submitted by BepOS Libre BC (not registered) on Thu, 2014-08-28 01:52.

Hi,
in debian testing (jessie) and in ubuntu 14.04.1 LTS Trusty, you should replace conf.d with conf-enabled

~# ls -la /etc/apache2/conf-enabled/zoneminder.conf
lrwxrwxrwx 1 root root 19 ago 27 17:45 /etc/apache2/conf-enabled/zoneminder.conf -> /etc/zm/apache.conf

Submitted by Dave (not registered) on Tue, 2010-05-25 17:16.
Great article, I'm just about to give it a go on a Hyper-V box!
Submitted by Anonymous (not registered) on Sat, 2010-03-06 21:57.

Hi,

 I was just following your guide and MAN ! it rocks.. helpet me ALOT!

 so thank you very very much,

i just got a little update, the ftp link for zoneminder that you provited does NOT work anymore, but i found this instead for a version thats newer:

ftp://www.northern-ridge.com.au/zoneminder/1.24/ubuntu/jaunty/zoneminder_1.24.2-1_i386.deb

just wanted to tell :)

and again, thanks for the awesome guide !

Submitted by Skibais (not registered) on Mon, 2009-12-21 23:29.

hi, can you write to me on skype ? nick: aarnijs152

 or you can there give ansver on my question ?

 how can i set on zoneminder on modect> events time lenght, it makes only max 22 second record on motiopn, but i need in motion option , but i want set in motion event , to record min one week, or month ,,, ?

 

 can you help me ? any body ? 

 thanks :) 

 

Submitted by Anonymous (not registered) on Thu, 2010-06-10 01:44.
Which part of "Do not use this space to ask for help" did you don't understand ?
Submitted by Steve (not registered) on Sat, 2009-07-11 23:21.

After finally getting ZM working with Ubuntu, I've added a tutorial at http://www.zoneminder.com/wiki/index.php/Ubuntu_9.04_Jaunty_desktop_with_graphical_interface which addresses some of the problems we ran into, which hopefully will help others too.  I thought I'd link to it from here as this seems to be a popular tutorial and hopefully my extra hints will complement it.  Good luck!

Steve

Submitted by Mike (not registered) on Fri, 2009-08-28 02:42.

Thank you for this tutorial

Submitted by Jarrod (not registered) on Fri, 2009-05-08 02:52.

New versions are also available, give this one a shot:

ftp://www.northern-ridge.com.au/zoneminder/1.24/ubuntu/9.04/zoneminder_1.24.1-pre-1_i386.deb

For a directory listing goto ftp://www.northern-ridge.com.au/zoneminder/

 

Submitted by Steve (not registered) on Fri, 2009-03-20 18:16.

I'm a newbie in terms of setting up video surveillance using a linux system so please bear with me.

How well does this setup work at recording the video feeds from all four cameras?  Is this only a monitoring station or can it be used to record the feeds to a large enough hard drive installed on the system?

 I'm looking for a cheaper solution then shelling out the $$ for a full on DVR surveillance system.

Thanks...very cool page.

 

 

Submitted by Anonymous (not registered) on Mon, 2009-02-23 18:47.

Thanks for the page! 

But, couldn't most of your from-source instructions be replaced with a simple apt-get call?

sudo apt-get install zoneminder

Your last two command line instructions, however, I found to be very much necessary.

 sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf

 sudo adduser www-data video

(I executed this first one, then lost track of this web page, spent hours trying to debug the black screen "shared memory not initialized by capture daemon" / "shared memory not valid" / "can't get shared memory id"  issues and finally found that I could fix them with "chmod 606 /dev/video0"... but turns out that your adduser fix is the more appropriate fix )

 Everything appears to be working now!  Thanks!

Submitted by Anonymous (not registered) on Mon, 2009-11-09 22:14.

I can confirm that this works in Ubuntu 9.10 also  - add the zoneminder package and then either edit the apache.conf or link as you did, then

sudo adduser www-data video

I'm using a 4 port capture card from Bluecherry (PV143) and it works great. Thanks!

 

Submitted by Anonymous (not registered) on Mon, 2009-11-16 21:05.

As a follow up, I've just gone through a reinstall with the PV143 card (bttv) on Ubuntu Server 9.10 - here are the steps:

Base Install followed by sudo apt-get update and sudo apt-get upgrade

sudo apt-get install zoneminder

sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf 

sudo adduser www-data video

sudo nano /etc/modprobe.d/bttv.conf and then add the following line:

options bttv gbuffers=32 card=77 tuner=4 radio=0 coring=1 full_luma_range=1 chroma_agc=1 combfilter=1 autoload=0 triton1=0 vsfx=0

Reboot and add a monitor!

Submitted by Remote Camera (not registered) on Wed, 2009-05-27 14:22.

Hi 

Sorry for ask from here 

how can i fix these errors ? Please


 

 zmwatch.log

05/27/09 15:03:01.020779 zmwatch[2716].ERR [Can't get shared memory id '7a6d0001', 1: No such file or directory]
05/27/09 15:03:11.021439 zmwatch[2716].ERR [Can't get shared memory id '7a6d0001', 1: No such file or directory]
05/27/09 15:03:21.022613 zmwatch[2716].ERR [Can't get shared memory id '7a6d0001', 1: No such file or directory]

zm_Debug.log

05/27/09 16:12:42.088896 zmc_m1[8860].INF-zm_debug.c/292 [New Debug Level = 0, New Debug Log = /tmp/zm_debug.log.08860]
05/27/09 16:12:42.105799 zmc_m1[8860].INF-zmc.cpp/186 [Starting Capture]
05/27/09 16:12:42.271182 zmc_m1[8860].ERR-zm_remote_camera_http.cpp/99 [Can't connect to remote camera: No route to host]
05/27/09 16:12:42.271250 zmc_m1[8860].ERR-zm_remote_camera_http.cpp/1019 [Unable to connect to camera]
05/27/09 16:12:42.271269 zmc_m1[8860].ERR-zmc.cpp/251 [Failed to pre-capture monitor 1 (0/1)]

 zmdc.log

05/27/09 15:02:07.316738 zmdc[2686].INF [Server starting at 09/05/27 15:02:07]
05/27/09 15:02:10.447738 zmdc[2686].INF ['zmc -m 1' starting at 09/05/27 15:02:10, pid = 2708]
05/27/09 15:02:10.554589 zmdc[2686].ERR ['zmc -m 1' exited abnormally, exit status 255]
05/27/09 15:02:10.554802 zmdc[2686].INF [Starting pending process, zmc -m 1]

Submitted by Anonymous (not registered) on Fri, 2010-12-31 16:00.
Did you ever solve this ?
Submitted by Carlo (not registered) on Thu, 2009-06-04 12:12.

For shared memory related problems see the short page

http://www.riccardotempesta.com/informatica/53-zoneminder-e-shared-memory

 Carlo

Submitted by Mamunk2 (not registered) on Mon, 2008-11-24 08:51.

Hi,

I was trying to follow this instruction!

But when I type the following command in the terminal

wget ftp://www.northern-ridge.com.au/zoneminder/ubuntu/dapper/zoneminder_1.22.3-8_i386.deb

then the following result shown

 

$ wget ftps://www.northern-ridge.com.au/zoneminder/ubuntu/dapper/zoneminder_1.22.3-8_i386.deb
ftps://www.northern-ridge.com.au/zoneminder/ubuntu/dapper/zoneminder_1.22.3-8_i386.deb: Unsupported scheme.
mamunk2@mamunk2-laptop:~$ wget ftp://www.northern-ridge.com.au/zoneminder/ubuntu/dapper/zoneminder_1.22.3-8_i386.deb
--07:46:43--  ftp://www.northern-ridge.com.au/zoneminder/ubuntu/dapper/zoneminder_1.22.3-8_i386.deb
           => `zoneminder_1.22.3-8_i386.deb'
Resolving www.northern-ridge.com.au... 202.61.194.152
Connecting to www.northern-ridge.com.au|202.61.194.152|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /zoneminder/ubuntu/dapper ...
No such directory `zoneminder/ubuntu/dapper'.

Could you tell me whats wrong there?

Thanks

Mamun
 

Submitted by david (not registered) on Sun, 2009-11-15 18:03.
clicked on the link for new zoneminder. It actually went and dloaded and tried to install. a first after years of trying to get ubuntu to do anything. But it complains about unresolvable dependencies. WHy cant linux programmers write standalone code or have the routines compiled into their code. My biggest problem with linux is all the libs and and headers needed that after a month are no longer up to date or supported.  Programs should run not make you pull out your hair looking for hacks to make it work.
Submitted by Gio (not registered) on Mon, 2008-12-15 06:05.

looks like the directories are different now...i did alittle investigating and it seems that the correct link in that line would be

ftp://www.northern-ridge.com.au/zoneminder/1.22.3/ubuntu/dapper/zoneminder_1.22.3-10_i386.deb

Submitted by Bob (not registered) on Sun, 2008-09-14 13:27.

Thank you.

For the clear instructions.

For the actual commands which I cut and pasted.

For my successful install.

Been trying for 3 days to get Zoneminder to work with no luck until now.

Thanks again

Submitted by Anonymous (not registered) on Sun, 2012-09-02 18:33.
Does this Zoneminder works on fedora series?
Submitted by Leszek (registered user) on Fri, 2007-09-07 18:07.

Hi!

This tutorial seems to be nice but the images are to small to see anything on them. 

Submitted by Anonymous (not registered) on Mon, 2010-09-06 16:28.

nice Tutorial,

Did try some of the setting but still blank ... :(

Submitted by wisu (registered user) on Sun, 2007-09-09 15:14.

Agreed!!!

Should be large enough now... Thanks 

Submitted by Franck (not registered) on Mon, 2009-09-07 10:09.

This tutorial seems really nice and will be usefull for my video surveillance company

Submitted by Anonymous (not registered) on Thu, 2011-06-30 18:32.

Sorry, ¿it are ip cams or analog cams?

Submitted by Anonymous (not registered) on Tue, 2011-12-20 15:25.
yes, both of them are supported, as well usb cams