ZoneMinder
ZoneMinder is an integrated set of applications which provide a complete surveillance solution allowing capture, analysis, recording and monitoring of any CCTV or security cameras attached to a Linux based machine. It is designed to run on distributions which support the Video For Linux (V4L) interface and has been tested with video cameras attached to BTTV cards, various USB cameras and also supports most IP network cameras.
Installation
Install the zoneminderAUR package. The development branch is also available as zoneminder-gitAUR.
Automatic configuration
The zoneminderAUR package includes an optional helper script which can automate the setup process by modifying your web server and database configurations, and also starting (but not enabling) the required systemd services for ZoneMinder and its dependencies.
After the script has done its work, ZoneMinder's web interface will be accessible at http://localhost:8095
Manual configuration
Apache
1) Edit Apache's /etc/httpd/conf/httpd.conf
and uncomment the following lines:
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule cgid_module modules/mod_cgid.so
2) In the same file, enable ZoneMinder's configuration by adding the following line at the end:
Include conf/extra/zoneminder.conf
Now start or restart httpd.service
.
Nginx
1) Edit Nginx's /etc/nginx/nginx.conf
and add the following line at the end:
include sites-enabled/*.conf;
2) Create the /etc/nginx/sites-enabled
directory if it does not already exist:
# mkdir -p /etc/nginx/sites-enabled
3) Link ZoneMinder's configuration file from /etc/nginx/sites-available
to /etc/nginx/sites-enabled
:
# ln -sf /etc/nginx/sites-{available,enabled}/zoneminder.conf
Now start or restart fcgiwrap-multiwatch.service
and nginx.service
.
fcgiwrap-multiwatch.service
complains that a socket already exists and refuses to start, check the status of fcgiwrap.socket
and fcgiwrap.service
and stop them if they are active.MariaDB
1) If you have not already done so, stop mariadb.service
and initialize MariaDB's default database:
# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 2> /dev/null
2) Start mariadb.service
and create a database and user for ZoneMinder:
-p
option.# mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql # mysql -u root -p -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
Final steps
Run the following command to create some volatile files and directories that are required by ZoneMinder during runtime:
# systemd-tmpfiles --create
Then, in addition to any services already started in the above steps, start php-fpm.service
and zoneminder.service
. ZoneMinder's web interface will be accessible at http://localhost:8095.
Troubleshooting
Logs by default are kept in /var/log/zoneminder
. You can also inspect the log within the web interface.
See the upstream wiki page: Troubleshooting.
Flushing application data
This is useful for developers or users that need to wipe all ZoneMinder and start fresh.
Recreate the database
Drop the ZoneMinder MySQL database and delete the MySQL user:
# mysql -u root -p
DROP DATABASE zm; DROP USER 'zmuser'@'localhost';
Recreate the database and user:
# mysql -u root -p
CREATE DATABASE zm; CREATE USER 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'; GRANT CREATE, INSERT, SELECT, DELETE, UPDATE ON zm.* TO 'zmuser'@'localhost'; exit
Import the preconfigured tables into your newly created zm database:
# mysql -u root -p zm < /usr/share/zoneminder/db/zm_create.sql
Flush the cache folders
# rm -Rf /var/cache/zoneminder/events/* /var/cache/zoneminder/images/* /var/cache/zoneminder/temp/*
Local video devices
It is important that the user running httpd (usually http) can access your cameras, for example:
$ groups http
video http
$ ls -l /dev/video0
crw-rw----+ 1 root video 81, 0 Oct 28 21:54 /dev/video0
That is, add the http user to the video group.
To add a user to the group run the command:
# usermod -aG video http
Multiple local USB cameras
If you observe an error like, libv4l2: error turning on stream: No space left on device when using multiple USB video devices (such as multiple webcams), you may need to increase the bandwidth on the bus.
Test first by stopping zoneminder.service
, then:
# rmmod uvcvideo # modprobe uvcvideo quirks=128
Start zoneminder.service
and if the issue is resolved, persist the change by adding the module option to /etc/modprobe.d/uvcvideo.conf
. For example:
options uvcvideo nodrop=1 quirks=128
See also
- https://wiki.zoneminder.com/index.php/Arch_Linux — Upstream project page.