Security can be a major concern for many people. Whether you need it for a business or in your own home, CCTV cameras can be an excellent deterrent for anything untoward. A lot of systems can be extremely expensive and use proprietary software that you don’t have full control of. This is where ZoneMinder comes in.
ZoneMinder is a FOSS suite that allows you to set up, record and control a complete CCTV system. This means it’s compatible with a range of devices and doesn’t require you to change physical media with everything being stored.
But keeping an eye on your property isn’t the only way to use ZoneMinder. Having a remote camera in a nursery or chicken coop can help you monitor vulnerable people or animals when you can’t be there. In this tutorial we’ll show you how to set it up so you can surveil your property.
Step 01 Set up LAMP server
You’ll need LAMP stack on your ZoneMinder server before you go any further. We’ll be installing it under an Ubuntu-based system, however packages will be similarly named elsewhere. First, get Tasksel:
$ sudo apt-get install tasksel
Step 02 Install LAMP
From here you can install LAMP with:
$ sudo tasksel install lamp-server
Go through the set-up process, including setting a root password for your new MySQL database and it should all be finished quickly. If you’re using a server distro, it may have this installed and set up for you already.
Step 03 Install ZoneMinder
Now you can install ZoneMinder along with FFmpeg so that you can record and keep a log of your videos. Do this with:
$ sudo apt-get install zoneminder ffmpeg
For now, use the default emailer settings. We can add these later if you wish to have email alerts.
Step 04 Configure MySQL
You’ll need to slightly change the config file to allow MySQL to have a delay so it can start properly before ZoneMinder. Open the file with:
$ sudo nano /etc/init.d/zoneminder
Above zmfix -a, add a line that simply says ‘sleep 15’. Save the file and exit.
Step 05 Configure Apache
Link Apache to ZoneMinder’s configuration file so that it knows where to look. You can do this with:
$ sudo ln -s /etc/zm/apache.conf /etc/ apache2/conf.d/zoneminder.conf
…and then reload Apache using:
$ sudo /etc/init.d/apache2 force-reload
This will make some unintended changes that we will fix in the next few steps.
Step 06 Finish up
You need to set up a user with permissions for ZoneMinder with:
$ sudo adduser www-data video
You also need to make sure that Apache is not disabling CGI by using the following command, as ZoneMinder requires CGI to operate.
$ sudo a2enmod cgi
Step 07 First camera
If you’re using a wired/USB webcam, plug it into your system with ZoneMinder on. You can check to make sure it’s seen by the system by going to the terminal and typing the command below. This will list all connected USB devices.
Step 08 Camera details
You need to make sure you know the specs for the camera that ZoneMinder requires. Luckily, it has a useful tool for finding this out. Simply type in the following:
$ sudo zmu -d /dev/video[X] -q -v
Where X is the number your video camera is assigned to, starting at 0. Note down the resolution and formats too.
Step 09 Start ZoneMinder
Now you’re ready to actually start using ZoneMinder. Open up a browser and go to:
If it’s on a remote server or another system on the LAN, enter the IP address or name followed by zm. Here you can begin to add cameras.
Step 10 Add camera
Click on Add New Monitor in order to bring up the Monitor pop-up. Name it whatever you wish, choose Local in source type and make sure you’ve ticked ‘enabled’. You can set a maximum frame rate, however for the time being that doesn’t really matter.
Step 11 Camera settings
Remember the settings that you noted down earlier? Get them out and fill in the Source tab. Once you’ve set the device path, you may need to switch between tabs for the rest of the options to show up. Once you’re done, you can press Save to continue.
Step 12 Preview camera
You can preview what the camera sees by clicking on its name in the main interface. This will launch a pop-up with an image of what the camera is currently pointed at; although you may need to click the screen to get it to advance the picture. If no picture is showing up, you may need to change the device format.
Step 13 Camera modes
While you can use the monitor mode for keeping an eye on a location on demand, it’s not particularly good for proper surveillance. Mark your camera and click Edit to open up the Monitor configuration again and find the drop-down function list.
Step 14 Record differently
There are multiple different modes that ZoneMinder uses for viewing and recording. Monitor will purely have a running stream. Modect is motion detection and will create events based on predetermined motion parameters. Record will create a constant recording while Mocord will record events to file from Modect.
Step 15 Play back events
ZoneMinder keeps data in images; there’s video, only a series of images that will make up a video once played. The monitor interface changes when set to record or motion detect, with the ability to properly rewind and pause the recording. The motion detection creates events you can view in a separate pop-up window, skipping between each event and playing them frame by frame.
Step 16 Networked camera
While USB cameras are nice and easy to set up, they’re not especially practical for a lot of surveillance-style operations. ZoneMinder supports specific networked cameras though, which are listed in the wiki we’ve linked to in the resources. These can be connected similarly to the way normal cameras are.
Step 17 Configure wireless camera
A lot of wireless cameras will use DHCP to assign an IP address when connected to the ethernet for you to then configure in Windows or Mac. That’s not going to work here, so connect it up and then use:
$ nmap -sP [Local].[Network].[Address].*
This should help you find out where it’s added itself. You should then be able to access the settings within the camera to change password and set a static IP on the Wi-Fi.
Step 18 Add wireless webcam
Note down the IP address of the webcam you set, make sure it’s turned on and connected to the wireless before heading back to ZoneMinder. Click on Add New Monitor and change the source type to remote. Set the function to whatever you wish.
Step 19 Webcam IP
Make the remote protocol HTTP and the method Simple. You’ll need to enter the connection details for the webcam as such:
Set the port to the correct port for your device and look up the host path for your camera. This is sometimes videostream.cgi.
Step 20 Storage concerns
If you continue to record events and locations, you’ll quickly run out of storage space. A quick and easy way to fix this is have ZoneMinder record over itself from the beginning when it runs out of space. Go to Filters at the bottom and use the PurgeWhenFull filter. Select a percentage and save it.
Step 21 Create zones
Cameras can be allocated to different groups. A good way to utilise this feature is to create groups for any specific areas you’re keeping an eye on. To do this you’ll need to click on the Monitor field below the date on the main page. Click new, and create a group to assign cameras to them.
Step 22 More to do
ZoneMinder is a powerful tool and you can do more with it as part of CCTV or keeping an eye on things. You can set up an automated email server to send you alerts when there’s activity, for example. There’s even an interface for smartphones, with ZoneMinder apps available on the Google Play Store.