From ArchWiki
(Redirected from 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.


Install the zoneminderAUR package.

Note: It is very important that a LAMP (Linux, Apache, MySQL, PHP) stack is installed and properly configured in order for ZoneMinder to work.


1) Edit Apache's /etc/httpd/conf/httpd.conf and uncomment the following lines:

LoadModule proxy_module modules/
LoadModule proxy_fcgi_module modules/
LoadModule rewrite_module modules/
LoadModule cgid_module modules/

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.


Warning: Before using ZoneMinder with Nginx, make sure you have installed the optional dependencies fcgiwrap, spawn-fcgi and multiwatchAUR.
Note: The following instructions will create a modular setup for Nginx similar to the one used in Debian-based distributions.

1) Edit Nginx's /etc/nginx/nginx.conf and add the following line at the end of the http block:

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.

Tip: If 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.


1) If you have not already done so, 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:

Note: If you have not set a password for MariaDB's root user (which you really should) you must omit the -p option in the following commands.
# 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.


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 USER 'zmuser'@'localhost';

Recreate the database and user:

# mysql -u root -p
CREATE USER 'zmuser'@'localhost' IDENTIFIED BY 'zmpass';

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

Warning: This removes all images and events.
# 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