Difference between revisions of "Zoneminder(HOW TO)"

From SME Server
Jump to navigationJump to search
Line 60: Line 60:
  
  
Install the webapps-common contrib according the [[Webapps-common|'''how-to''']]. Then (as per example for https://cctv.mydomain.com) issue the following as root:
+
Install the webapps-common contrib according the [[Webapps-common|'''how-to''']]. Then (as per example for https://cctv.myserver.com) issue the following as root:
 
  db domains set cctv.myserver.com domain Description "CCTV" Content Primary \
 
  db domains set cctv.myserver.com domain Description "CCTV" Content Primary \
 
  Nameservers internet TemplatePath WebAppVirtualHost \
 
  Nameservers internet TemplatePath WebAppVirtualHost \

Revision as of 08:53, 6 January 2016

Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


About

ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child, family member or home monitoring and other domestic care scenarios such as nanny cam installations. It supports capture, analysis, recording, and monitoring of video data coming from one or more video or network cameras attached to a Linux system. ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom cameras using a variety of protocols. It is suitable for use as a DIY home video security system and for commercial or professional video security and surveillance. It can also be integrated into a home automation system via X.10 or other protocols.


Important.png Note:
Zoneminder is available as a contribs, but that is a very old one for SME server 7. Today, Zoneminder has it's own easy repository, and hopefully these instructions can be turned into a new updated contrib. For now, this how-to is intended to be used with IP camera's only.


Installation

Requirements

Zoneminder is available from the Zoneminder repository. You need to configure the zmrepo as explained here.

Install Zoneminder from the zmrepo

yum install zoneminder --enablerepo=zmrepo

Zoneminder's configuration file is located at /etc/zm.conf. Not really known if it is required, but you can change the Apache user in the zm.conf file from apache:apache to www:www, and double check the database credentials in the same file with the ones you have used.

MySQL database

Zoneminder works 'best' with InnodeDB enabled. As root issue:

db configuration setprop mysqld InnoDB enabled
expand-template /etc/my.cnf
sv t /service/mysqld

Zoneminder uses MySQL for the storage of picture data, so we need to create a new database. As root issue:

mysql
create database zm;
grant all privileges on zm.* to zmuser identified by 'zmpass';
flush privileges;
exit

Then we populate the new database:

mysql zm < /usr/share/zoneminder/db/zm_create.sql

The above bold credentials should be replaced by your own information.


Important.png Note:
Once somebody starts creating a contrib, the above credentials should be in a db key e.g. zoneminder and DBUser, DBPass, so the configuration files will be templated and auto generated by an event


Create custom templates

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
cp /etc/httpd/conf.d/zoneminder.conf /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/98zoneminder
rm -f /etc/httpd/conf.d/zoneminder.conf
sed -i "18i AddType application/x-httpd-php .php" /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/98zoneminder
sed --in-place '/DELETE/d' /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/98zoneminder
expand-template /etc/httpd/conf/httpd.conf
service httpd-e-smith restart
Important.png Note:
Please note that the above templates do not implement any authentication to access the Zoneminder portal (webinterface)


Start Zoneminder at boot

config set zoneminder service status enabled 
ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S98zoneminder
Important.png Note:
We still need to add the various TCPPort(s) to the db to open up the firewall if remote (off LAN) camera's are being used.



You can now start Zoneminder manually:

service zoneminder start

And access the Zoneminder portal at http://yourserver.com/zm, and login as admin admin

Acces Zoneminder via sub domain

Instead of accessing the Zoneminder portal at http://myserver.com/zm, it is possible to change this to e.g. https://cctv.myserver.com. For this the easiest and comfortable way is to use the webapps-common contrib.


Important.png Note:
This part assumes you have followed the complete above installation procedure.



Install the webapps-common contrib according the how-to. Then (as per example for https://cctv.myserver.com) issue the following as root:

db domains set cctv.myserver.com domain Description "CCTV" Content Primary \
Nameservers internet TemplatePath WebAppVirtualHost \
DocumentRoot /usr/share/zoneminder/www RequireSSL enabled
signal-event domain-create cctv.myserver.com


Next you need to adjust the existing (from above) custom template (make a backup copy first):

sed --in-place '/Alias/d' /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/98zoneminder

Followed by:

signal-event webapps-update

to activate all changes. Now you can reach your zoneminder portal at https://cctv.myserver.com