Configuration of Zone Minder on Debian

ZoneMinder is an open-source video surveillance software package that provides comprehensive security camera monitoring capabilities. It supports multiple cameras with features like motion detection, remote access, and event recording. Installing ZoneMinder on Debian requires configuring several components including a web server, database, and proper permissions.

This tutorial covers the complete installation and configuration process to get a fully functional ZoneMinder system running on Debian.

Prerequisites

Before installing ZoneMinder, update your Debian system and install the required packages

sudo apt update
sudo apt upgrade -y
sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php zoneminder

This installs Apache web server, MySQL database, PHP with MySQL support, and the ZoneMinder package along with all dependencies.

Database Configuration

ZoneMinder requires a MySQL database to store configuration data, events, and camera information. First, secure your MySQL installation

sudo mysql_secure_installation

Next, create the ZoneMinder database and user. Log into MySQL as root

sudo mysql -u root -p

Execute the following SQL commands to set up the database

CREATE DATABASE zm;
CREATE USER 'zmuser'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Initialize the ZoneMinder database schema

sudo mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
mysql -u root -p -e "use mysql; grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'your_secure_password';"

ZoneMinder Configuration

Configure ZoneMinder to connect to the database by editing the configuration file

sudo nano /etc/zm/zm.conf

Update the database connection parameters

ZM_DB_HOST=localhost
ZM_DB_NAME=zm
ZM_DB_USER=zmuser
ZM_DB_PASS=your_secure_password

Apache Web Server Configuration

Enable necessary Apache modules and configure ZoneMinder virtual host

sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod expires
sudo a2enconf zoneminder

Create an Apache configuration file for ZoneMinder

sudo nano /etc/apache2/sites-available/zoneminder.conf

Add the following configuration

<VirtualHost *:80>
    DocumentRoot /usr/share/zoneminder/www
    ServerName your_server_name
    
    <Directory /usr/share/zoneminder/www>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
    Alias /zm /usr/share/zoneminder/www
    
    <Directory /var/cache/zoneminder>
        AllowOverride None
        Require all granted
    </Directory>
    
    ErrorLog ${APACHE_LOG_DIR}/zoneminder_error.log
    CustomLog ${APACHE_LOG_DIR}/zoneminder_access.log combined
</VirtualHost>

Enable the site and restart Apache

sudo a2ensite zoneminder
sudo systemctl restart apache2

Permissions and Services

Set proper file permissions for ZoneMinder directories

sudo chown -R www-data:www-data /usr/share/zoneminder/
sudo chown -R www-data:www-data /var/cache/zoneminder/
sudo chown -R www-data:www-data /var/log/zm/
sudo adduser www-data video

Enable and start ZoneMinder service

sudo systemctl enable zoneminder
sudo systemctl start zoneminder

Verify the service is running

sudo systemctl status zoneminder

Initial Setup and Usage

Access the ZoneMinder web interface by opening a browser and navigating to http://your_server_ip/zm. The default login credentials are

  • Username: admin

  • Password: admin

After logging in, change the default password immediately through the Options menu. To add a new camera monitor

  1. Click "Add New Monitor" in the console

  2. Configure the General tab with monitor name and function

  3. Set up the Source tab with camera connection details

  4. Save the configuration and start monitoring

Conclusion

ZoneMinder provides a robust, open-source video surveillance solution for Debian systems. With proper database configuration, web server setup, and permissions management, you can create a powerful security monitoring system that supports multiple cameras with advanced features like motion detection and remote access.

Updated on: 2026-03-17T09:01:38+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements