Configuration of Zone Minder on Debian

Home security is a top priority for many people, and installing a security camera system is a great way to keep an eye on your property. One popular solution for camera monitoring is ZoneMinder, an open-source software package that provides video surveillance capabilities. ZoneMinder is a powerful tool that can be used to monitor a single camera or multiple cameras, with features like motion detection, remote access, and much more.

If you're using Debian, the installation and configuration process for ZoneMinder is relatively straightforward. In this article, we'll go through the steps needed to get ZoneMinder up and running on your Debian machine. We'll cover the following topics −

  • Installing necessary packages − We'll install the necessary packages, including Apache, MySQL, and PHP.

  • Creating a database − We'll create a MySQL database for ZoneMinder to use.

  • Installing ZoneMinder − We'll download and install the ZoneMinder package.

  • Configuring Apache − We'll configure Apache to serve the ZoneMinder web interface.

  • Adjusting permissions − We'll give Apache permission to access the ZoneMinder files.

  • Using ZoneMinder − We'll show you how to add cameras and view their feeds.

By the end of this article, you should have a fully functional ZoneMinder installation that you can use to monitor your cameras.

Installing necessary packages

Before we can install ZoneMinder, we need to make sure that the necessary packages are installed on the system. In a terminal window, run the following command to install Apache, MySQL, and PHP −

sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php

This will install Apache, MySQL, and PHP, as well as the necessary PHP modules for connecting to MySQL.

Creating a database

Now that we have the necessary packages installed, we need to create a MySQL database for ZoneMinder to use. In a terminal window, log in to the MySQL server as the root user −

sudo mysql -u root -p

You will be prompted to enter the root password for MySQL. Once you've logged in, create a new database for ZoneMinder −


This will create a new database named "zm". Next, create a new MySQL user for ZoneMinder to use −

CREATE USER 'zmuser'@'localhost' IDENTIFIED BY 'zmpass';

This will create a new user named "zmuser" with the password "zmpass". Next, grant the new user access to the database −

GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost';

This will grant the "zmuser" user all privileges on the "zm" database. Finally, exit the MySQL prompt −


That's it! You now have a MySQL database set up and ready to go for ZoneMinder. In the next section, we'll install the software.

Installing ZoneMinder on Debian

First things first, you'll need to install ZoneMinder on your Debian machine. Fortunately, it's available in the default repositories, so you can simply use apt to install it −

sudo apt update sudo apt install zoneminder

This will install all the necessary dependencies and get ZoneMinder up and running. However, we'll need to configure a few more things before we can start using it.

Configuring MySQL

ZoneMinder uses MySQL to store its data, so we'll need to set up a database and user for it. First, let's install MySQL −

sudo apt install mysql-server

During the installation process, you'll be prompted to set a root password for MySQL. Make sure you remember this password, as you'll need it later.

Once MySQL is installed, we'll create a new database and user for ZoneMinder. Log in to the MySQL server as root −

sudo mysql -u root -p

Enter the root password you set during installation. Once you're in the MySQL shell, create a new database and user −


This will create a new database called zm and a new user called zmuser with the password zmpass. Make sure to replace zmpass with a secure password of your choice.

Configuring Apache

ZoneMinder also requires a web server to display the camera feeds and interface. Apache is the most commonly used web server, so we'll use that for this tutorial.

First, let's install Apache −

sudo apt install apache2

Once Apache is installed, we'll need to configure it to work with ZoneMinder. Open the Apache configuration file −

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

Add the following lines to the file −

<Directory /usr/share/zoneminder>
   Options Indexes FollowSymLinks
   AllowOverride All
   Require all granted

Alias /zm /usr/share/zoneminder

<Directory /var/cache/zoneminder/temp>
   Options Indexes FollowSymLinks
   AllowOverride None
   Require all granted

Save and close the file. Then, enable the new configuration −

sudo a2enconf zoneminder

Finally, restart Apache to apply the changes −

sudo systemctl restart apache2

Configuring ZoneMinder

Now that all the dependencies are installed and configured, we can start configuring ZoneMinder itself. First, open the ZoneMinder configuration file −

sudo nano /etc/zm/zm.conf

Find the following lines −


Make sure the values match the database and user you created earlier. If you used different values, update these lines accordingly.

Next, we'll configure ZoneMinder to use the web server we installed earlier. Find the following line −


Make sure the path matches the Alias we added to the Apache configuration earlier. If you used a different path, update this line accordingly.

We're almost done! The last step is to give Apache permission to access the ZoneMinder files. Run the following commands −

sudo chown -R www-data:www-data /usr/share/zoneminder/
sudo chmod -R 740 /usr/share/zoneminder/
sudo adduser www-data video

This will change the owner and permissions of the ZoneMinder files to the Apache user (www-data), and add the www-data user to the video group so it can access the cameras. Finally, restart ZoneMinder to apply the changes −

sudo systemctl restart zoneminder

Using ZoneMinder

Congratulations, you've successfully configured ZoneMinder on your Debian machine! Now you can start adding cameras and monitoring your home or office.

To access the ZoneMinder web interface, open a web browser and go to http://localhost/zm (assuming you're accessing it on the same machine). You should see the login page for ZoneMinder. Enter the username and password you set during installation to log in.

To add a camera, click on the "Add New Monitor" button in the top right corner of the interface. Follow the prompts to configure the camera settings and save the monitor.

You can view the camera feeds by clicking on the "Montage" button in the top navigation bar. This will display a grid of all your cameras. You can also view the feeds individually by clicking on the monitor name in the list on the left.


Setting up a security camera system can be a daunting task, but with ZoneMinder and Debian, it's relatively straightforward. By following the steps outlined in this article, you should be able to get ZoneMinder up and running on your Debian machine in no time. Once it's set up, you can add as many cameras as you need and monitor them from anywhere with an internet connection.

Updated on: 22-Jun-2023


Kickstart Your Career

Get certified by completing the course

Get Started