Introduction: Computerized Video Security Setup.

Picture of Computerized Video Security Setup.
We are going to use Zoneminder as sort of a computerised video security system for both home and small to large businesses. This would also be good for keeping an eye on babysitters or for use in a child care center. This will allow you to keep an eye on your property and record suspicious movement by employees or others. The great thing about this project is that an older or lower end computer will work just fine for this project. You can access the video cameras via the web so you do not have to baby sit the computer running zoneminder.

We were able to do this whole set up in a manner of minutes. The set up is not as scary as some people might think. Excepting one glitch (the fix is  documented), this was a a piece of cake to set up. You might want to visit a security store to get some hidden cameras to make the system even more secure and hidden. We just used some inexpensive web cams from a local electronic store. Also have an ip camera (networkable camera) so you do not have to directly connect the camera to the host computer. I will add our set up of it later. The video at the end of the instructable should for how to set one of those up.

Notice: this instructable requires knowledge of linux via the command line. But do not let the command line scare you. I set the whole thing up in minutes very easily.

Note: You could certainly use an internet enabled touch pad to keep an eye on things. On the last panel is a little blurb about motion which is another video capture program. It is perfect for low end machines. It had no problem with the webcam I hooked up.

Not my video, but worth looking at:


Step 1: Prerequisites

Picture of Prerequisites
Hardware prerequisites:
Networkable (preferably hard wired to the network and not wifi enabled) computer with battery backup capable of running Ubuntu Linux 10.4 and as much memory as you can install in the system. One or more zoneminder supported webcams and enough usb ports to support them and or ipcameras (Warning: wireless units are easy to hack).

Software Prerequisite:

You should have a vanilla install of Ubuntu 32- or 64-bit up and running. Run updates before proceeding (System > Administration > Update Manager).

Do not install XAMPP, LAMPP, Apache, MySQL, etc. I thought I was going to be smart and bypass a bunch of installation steps by doing this, but it's just not necessary. If you do have LAMPP on your system and you still plan to use it, you better go read some docs on how to get it to start on another port, because the ZM installation is going to overtake all the default ports. If you have LAMPP and anything is running, stop all the services now with

sudo /opt/lampp/lampp stop

If you have existing Apache or MySQL running, you're on your own. This guide is meant for installing ZM on a dedicated box. Feel free to leave suggestions to include information on how to integrate zoneminder with a functioning Apache/PHP/MySQL setup.


Step 2: Installation

Picture of Installation
You can open a terminal from the desktop of the intended machine. I had already installed ssh and openssh-server, so I could do a remote install. of course if you do a remote install you will want to substitute nano or vim for gedit. Installing zone minder will automatically install your lamp server for you.  You will want to write down the root mysql password that you choose for use later during the install and or in case you forget it.

  1. open a terminal window (Applications > Accessories > Terminal)
  2. $ sudo apt-get install zoneminder
  3. $ sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
  4. $ sudo /etc/init.d/apache2 force-reload (restarts Apache)
  5. $ sudo mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
  6. mysql -u root -p (this brings you into a mysql shell)
  7. > grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
  8. > flush privileges;
  9. > quit (this exits the mysql shell)
  10. $ sudo chmod 4755 /usr/bin/zmfix
  11. $ zmfix -a
  12. $ sudo adduser www-data video
  13. $ sudo gedit /etc/sysctl.conf (this launches gedit)
  14. scroll to the bottom of the file and paste in the following: (Note: This only takes effect after a reboot)

kernel.shmall = 134217728

kernel.shmmax = 134217728

  1. To increase the shared memory on a live system;
  2. $ echo 134217728 >/proc/sys/kernel/shmall
  3. $ echo 134217728 >/proc/sys/kernel/shmmax
  4. save the file (File > Save or CTRL+S)
  5. exit gedit
Note: Do not change the password for zmuser for now. Leave it at "zmpass".

You should be ready to go now.

Step 3: Testing.

Picture of Testing.

Testing

Visit this URL (on the machine running zoneminder) in your browser to check that Zoneminder is running: http://localhost/zm

or go to a nearby machine and use http://ipaddress/zm  i.e. http://192.168.1.???/zm
Via mobile, access: http://{IP.ADDRESS.OF.MACHINE}/zm/?skin=mobile You can find the local IP address of the machine by entering ifconfig  or "sudo ifconfig" at the terminal and looking for the address printed after 'inet addr:'. It probably starts with 192.168.

Note: you may want to reserve an ipaddress in your router so that you always get the same ipaddress for this system. See your router manual for more details.

Troubleshooting

If you know your webcam is working but do not get any input try:

Add the following line to the file zmdc.pl in /usr/bin/ just before the line my @daemons :

Code:
$ENV{LD_PRELOAD} = '/usr/lib/libv4l/v4l1compat.so';

Other issues:
* if installation of zoneminder failed due to broken dependencies, run sudo apt-get -f install, then start over.
* are you using Ubuntu Server? this was written for Ubuntu Desktop 32- or 64-bit.

* If Zoneminder does not start on boot, it may be trying to start before mySQL is running. To fix:

$ sudo update-rc.d -f zoneminder remove
$ sudo update-rc.d zoneminder defaults 92


 

Step 4: Add an Internet Camera.

Picture of Add an Internet Camera.
For more flexibility, you may want to add an ipcamera. Ipcameras are stand alone cameras that connect through the internet. The following video should give you more details about setting one up.




Step 5: MSWindows?

Picture of MSWindows?

To my knowledge there is not a Microsoft Windows version, but you might use this as a start for doing a virtual machine. http://www.zoneminder.com/wiki/index.php/MS_Windows/Virtual_Appliance

Step 6: Motion

Picture of Motion
There is an alternative project called Motion. Nice thing about it is that it only saves pictures if there is motion or movement detected. You can install it with:

$ sudo apt-get install motion

Except for adjusting where you want to save the pictures it runs pretty much out of the box. Setting up the web cam to be seen remotely via a web page requires a small setting to be changed. There is quite a bit of documentation for the project.  It is good for running on headless servers and or low nas units that can support web cams.

http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome

Example setup for the raspberry pi

PICT0194.JPG
It is wonderful that the Raspberry Pi (aka RPi)  is supported by Debian linux. There already so much software for debian that the Raspberry Pi can take advantage of. One such pice of software is Motion. Motion is a security cam server software than does not require a gui, That is you can run Motion without a gui installed or activated on the Raspberry Pi.

Let's get your system up to date (might take a while if you have not updated very recently).

$ sudo apt-get update ; sudo apt-get upgrade
$ sudo apt-get dist-upgrade

Now let's install Motion

$ sudo apt-get install motion.

Does the RPi see your camera?  (aka list usb devices attached.)

$ lsusb

...
Bus 001 Device 004: ID 046d:08a9 Logitech, Inc. Notebook Deluxe
...

if not, you may need to get a more mainstream camera. usually Logitech sets the standard. I just used a cheap refurbished knickoff. Your output will vary..

Do a liittle configuration:

$ sudo nano /etc/motion/motion.conf

In here there are a few basic changes that you need to perform:

  • Daemon = OFF to ON
  • webcam_localhost = ON to OFF
You can change other settings but it’s recommend you don’t take more than 2 frames, and you been the default frame pixel size, for stability.

To ensure that the motion service will actually start as a daemon we need to change another configuration setting, so enter the following:

sudo nano /etc/default/motion

Then change the value “start_motion_daemon=no” to “yes”


Let's get started:

Finally you can start the motion service to stream the web cam images

sudo service motion start
Then after about 30 seconds browse to the new web interface, which should be at the below URL (where 192.168.0.100 is your Raspberry PI’s IP address yours may vary)

http://192.168.0.100:8081

Hint: if you do not have direct access to your RPi, you can use https://www.instructables.com/id/Red-October-network-discovery/ to find iit on the network Frequently I will hook up the RPi to the network without a keyboard, mouse, or monitor and then remote into the unit,

Also:


Note if you want to use an ipcamera it is easy but you have to know about the camera. I ended up going to the zoneminder wiki and found the answer for my camera. Setup is the same, but you have to add two lines to motion.conf.

 netcam_url http://19.168.10.85/videostreadlocationsomekindof.cgi
 netcam_userpass user:password

For us  it was:

 netcam_url http://192.168.10.85/video.cgi
 netcam_userpass user:password

Comments

tazboyz16 (author)2017-03-20

I have ZM installed on my Media Server that runs multiple programs including Apache, email server, and Mysql with no issues. I dont know if the earlier stages of Zm was picky like that but its more friendly now

joespicnictables (author)2011-10-08

neat! do this to my room! :P

Cool. I also thought of maybe using this for a pod casting setup also.

davijordan (author)2011-06-17

Awesome. I was easily able to set up a video surveillance system at home and at work. Thanks!

About This Instructable

1,483views

12favorites

License:

Bio: computoman.blogspot.com Bytesize articles instead of a trilogy in one post.
More by Computothought:Coffeepot mealsEasy sun hatEasy cakes and pies.
Add instructable to: