Computerized Video Security Setup.
by Computothought in Circuits > Linux
2765 Views, 16 Favorites, 0 Comments
Computerized Video Security Setup.
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:
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.
Installation
- open a terminal window (Applications > Accessories > Terminal)
- $ sudo apt-get install zoneminder
- $ sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
- $ sudo /etc/init.d/apache2 force-reload (restarts Apache)
- $ sudo mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
- mysql -u root -p (this brings you into a mysql shell)
- > grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
- > flush privileges;
- > quit (this exits the mysql shell)
- $ sudo chmod 4755 /usr/bin/zmfix
- $ zmfix -a
- $ sudo adduser www-data video
- $ sudo gedit /etc/sysctl.conf (this launches gedit)
- 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
- To increase the shared memory on a live system;
- $ echo 134217728 >/proc/sys/kernel/shmall
- $ echo 134217728 >/proc/sys/kernel/shmmax
- save the file (File > Save or CTRL+S)
- exit gedit
You should be ready to go now.
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
Add an Internet Camera.
MSWindows?
Motion
$ 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
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
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