How to Install ZoneMinder on the Raspberry Pi

In this tutorial, we will show you how to install ZoneMinder on the Raspberry Pi.

Raspberry Pi ZoneMinder

ZoneMinder is free, open-source software that allows you to monitor your CCTV feeds from one location. Best of all, thanks to being open-source software, it has support for most analog or IP cameras.

The Raspberry Pi makes an excellent pick for running ZoneMinder, especially when you don’t have many cameras since it is relatively low-powered and can be left running 24/7.

To make the most of ZoneMinder, you will need to know your cameras’ IPs and how to connect to them. Thanks to ZoneMinders popularity, you can often search for your camera brand name followed by “ZoneMinder” and find connection guides.

Over the following sections, we will cover how to install all of the software required to get ZoneMinder running on a Raspberry Pi.


Below is a list of the equipment we used to set up ZoneMinder on the Raspberry Pi.



This tutorial was tested on a Raspberry Pi 400 running the latest version of Raspberry Pi OS Bullseye.

Installing ZoneMinder to the Raspberry Pi

This section will show you how to install and prepare ZoneMinder on the Raspberry Pi. These steps involve us installing and setting up other elements, such as the MySQL server and the Apache web server.

The following sections will be entirely within the command line. If you are using Raspberry Pi OS Desktop, you can open the terminal by pressing CTRL + ALT + T on your keyboard.

Installing Any Required Packages

1. Before installing ZoneMinder and its dependencies on our Raspberry Pi, we need to update the package list cache.

You can update this list cache by using the following command in the terminal.

sudo apt update

2. Once the package list update completes, we can move on to installing all of the software we require.

You can install, Apache2, MariaDB, and lsb_release by using the following command within the terminal.

sudo apt install apache2 mariadb-server

3. After installing the database server, you should run the MySQL secure installation script.

This script helps remove weak security settings from the database server.

sudo mysql_secure_installation
  1. When prompted to enter the password for the root user, leave it blank and press the ENTER key.
  2. Since the root user is configured by default to use “unix_socket” authentication. Type in “n” then press the ENTER key.
  3. You will then be prompted to change the root password. Since “unix_socket” is being used, type “n” then press ENTER.
  4. For the rest of the options you are presented with, type in “Y“, then press the ENTER key. The rest of the options will improve the security of your database server.

Installing ZoneMinder from the Official Repository

4. To be able to install ZoneMinder from the official repository to our Raspberry Pi we need to first save the GPG key. The advantage of using the official repository is that you will get the latest release.

You can save and store the GPG key to your system by using the following command.

curl -L | gpg --dearmor | sudo tee /usr/share/keyrings/zoneminder-archive-keyring.gpg >/dev/null

5. With the GPG key saved, we can proceed to add the ZoneMinder repository to the sources list.

To add this repository, use the command below within the terminal.

echo "deb [signed-by=/usr/share/keyrings/zoneminder-archive-keyring.gpg] $(lsb_release -cs)/" | sudo tee  /etc/apt/sources.list.d/zoneminder.list

6. Since we have made changes to our sources, we will need to perform an update of the package list cache.

You can update that cache by using the following command.

sudo apt update

7. With the repository added, you can now install ZoneMinder to your Raspberry Pi by using the following command.

sudo apt install zoneminder

Setting up the ZoneMinder Database on the Raspberry Pi

8. Our next step is to set up ZoneMinder on our Raspberry Pi’s database server.

To begin this process, you will want to type in the following command.

sudo mysql

9. Our first step is to create a database where we will store the ZoneMinder database.

You will want to use the following command to create a database with the name “zm“.


This database must be called “zm” due to the way ZoneMinder has written its SQL creation file.

10. With the database created, our next step is to create a SQL user that we will use to interact with it.

To create a user called “zoneminder_usr“. you will want to use the following command.

Ensure you replace “PASSWORD” with a secure password of your choosing.

CREATE USER 'zoneminder_usr'@'localhost' IDENTIFIED BY 'PASSWORD';

If you want a password manager to generate and keep your passwords secure, we highly recommend checking out NordPass. NordPass is a password manager developer by the same team behind NordVPN. (Affiliate Link)

11. With our user created, we need to grant it all privileges on our “zm” database.

To do this, you will want to run the following command within the SQL command line.

GRANT ALL PRIVILEGES on zm.* to 'zoneminder_usr'@'localhost';

12. Since we have changed the permissions on our Raspberry Pi’s database server, we will need to flush the privileges.

You can flush the privileges on your database by using the following command.


13. With that done, you can exit out of the SQL command line by typing in the following.


14. Our final step is to import the Zoneminder SQL file to our Raspberry Pi’s database. This SQL file contains a series of commands that will set up all the tables within the database.

We can import this database by using the following command.

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

Correcting your Raspberry Pi’s Timezone

15. The Zoneminder software requires you to have your Raspberry Pi’s time zone configured. This must be configured for the device itself and PHP.

Let us start by setting the Pi’s timezone using the Raspberry Pi configuration tool. You can open this tool by using the following command.

sudo raspi-config

16. Within the tool, navigate to “Localisation Options“, then to “Timezone“, and follow the prompts to set the time zone.

You can navigate this menu using the ARROW keys to move up and down, then the ENTER key to select an option.

17. Our next step is to modify the PHP timezone by adjusting the configuration files.

Since the default version of PHP can change depending on the OS, we can grab the version number by using the following line

PHP_VERSION=$(php -v | head -n 1 | tail -n 1 | cut -d " " -f 2 | cut -c 1-3)

18. Now that we have the PHP version stored in an environment variable, we can easily edit the correct configuration file.

Begin modifying PHP’s configuration file by using the following command.

sudo nano /etc/php/$PHP_VERSION/apache2/php.ini

19. Within this file, you will want to find the following line. Since we are using the nano text editor, you can search using CTRL + W.

;date.timezone =

Once found, you want to set this value to your time zone and remove the semicolon (;). You can find the correct value for your time zone by using PHP’s list of supported timezones.

For example, we would use the following line to set the time zone to Hobart, Australia.

date.timezone = Australia/Hobart

20. Once done, you can save and quit by pressing CTRL + X, followed by Y, then the ENTER key.

Configuring ZoneMinder on the Raspberry Pi

21. At this point, we finally have everything set up correctly. The only major thing we need to do is modify ZoneMinder’s configuration file.

You can edit the software’s configuration file using the following command.

sudo nano /etc/zm/zm.conf

22. The first value we need to update is the name of the SQL user ZoneMinder will connect using on our Raspberry Pi.

To change this, search for the following line within the file.


Replace the above line with the following.


23. With the user updated, we next need to set the password for this user within this file.

Locate the following line that declares the password for the SQL user.


Replace that line with the following, ensuring you swap “PASSWORD” out with the one you used when creating the SQL user.


24. With the database username and password set, you can save and quit by pressing CTRL + X, followed by Y, then the ENTER key.

25. Since the user that operates the web server will need to grab the configurations from this file, we will need to grant it ownership of it.

You can use the following chown command to give the “www-data” user ownership of the ZoneMinder config file.

sudo chown www-data: /etc/zm/zm.conf

Giving ZoneMinder Access to Attached Video Cameras

26. For ZoneMinder to be able to access any cameras that are attached to your Raspberry Pi we will need to add the “www-data” user to the “video” group.

The “video” group is used to give users access to attached devices like a webcam.

Add the “www-data” user to the “video” group by using the following command.

sudo usermod -aG video www-data

Enabling the ZoneMinder Apache Configuration

27. We are finally at the point that we can safely enable the ZoneMinder Apache configuration.

ZoneMinder automatically created the correct config files during installation on our Raspberry Pi. We simply need to enable them.

To enable the ZoneMinder Apache configuration, run the command below.

sudo a2enconf zoneminder

28. While we are setting up our Apache configuration, we should also ensure that the “rewrite mod” is enabled.

We can enable this mod by using the command below in the terminal.

sudo a2enmod rewrite

29. Our next task is to restart Apache2, which can be done by simply using the following command.

sudo systemctl restart apache2

Starting the ZoneMinder Service on the Raspberry Pi

30. We almost have ZoneMinder entirely up and running on our Raspberry Pi.

Our next few steps will involve enabling the service so that it starts at boot, then finally starting the software itself.

Run the command below to enable ZoneMinder to automatically start when your device boots.

sudo systemctl enable zoneminder

31. Now, use the following command to start the ZoneMinder camera monitor software.

sudo systemctl start zoneminder

32. At this point, you finally have ZoneMinder running on your Raspberry Pi. It can now be put to use to monitor your various cameras.

Accessing the ZoneMinder Web Interface

With ZoneMinder finally installed on our Raspberry Pi, it is now basically driven entirely through its web interface.

This section will show you how to access its web interface and point you toward adding cameras.

1. To access the web interface, you will need to know the IP address of your Raspberry Pi.

One of the easiest ways of getting the IP address is to utilize the hostname command.

hostname -I

2. Once you know the IP address of your device, you will want to go to the following address in your favourite web browser.

Replace “IPADDRESS” with the IP address of your Raspberry Pi.


3. When you first visit the ZoneMinder web interface, you will be asked to agree to a privacy policy.

Read through the text, and if you agree, click the “APPLY” button in the screen’s bottom-left.

Accept ZoneMinder Privacy Statement

4. You will now be greeted by your Raspberry Pi’s ZoneMinder dashboard. This dashboard is where you will see all of your available cameras after adding them to ZoneMinder.

To add a camera to ZoneMinder, you will want to click the “ADD” button.

Add new Camera to Raspberry Pi ZoneMinder

5. We won’t be diving into how exactly to add a camera to ZoneMinder we will cover the basic settings you will need to set.

On the first page, you will want to give a name to your camera (1.), so you can easier identify it within the interface.

After that, the other main settings you will want to adjust are within the “Source” tab (2.).

Set General Camera Settings

6. The source tab allows you to set how ZoneMinder will interact with your cameras.

The source path (1.) is where you will specify the path to where ZoneMinder can access your camera. If you are using an IP camera, this is highly likely an RTSP link. You can Google your camera to find out exactly how it works.

The other thing you might need to change is the “Method” (2.). Select the method that matches the connection type.

Set ZoneMinder Camera source


At this point in the tutorial, you should now have ZoneMinder running on your Raspberry Pi.

ZoneMinder is a powerful application that can monitor and record footage from numerous cameras. While we haven’t covered adding cameras within the web interface, you can check the official documentation.

Please comment below if you have any issues with installing ZoneMinder on your device.

Be sure to check out our many other Raspberry Pi projects, such as our guide on setting up a webcam server.


  1. Avatar for CJ
    CJ on

    What does “…ZoneMinder does not provide ARM64 builds, so the package will be tr” mean? specifically “tr”? As it stands now, this article has you install zoneminder twice. once from the raspian repository, then once again from ZoneMinders repository. Is that because of the arm64 issue? or is that a mistake?

    1. Avatar for Emmet
      Emmet on

      Hi CJ,

      Thank you for pointing out those mistakes. Both of the issues have now been corrected in the tutorial. Additionally, it looks like ZoneMinder now provides builds for Arm64 as well so that mistyped line has been removed completely.


    2. Avatar for CJ
      CJ on

      Beautiful! Best lookin guide for this. Thank you. Just got on to use it 🙂

  2. Avatar for Gourav Kumar
    Gourav Kumar on

    For anyone following this tutorial, there is a minor error here. In step no. 19 of first part, you need to search for date.timezone instead of data.timezone.

    Also, Zoneminder requires rewrite mod enabled for Apache2. If not done so, step no. 27 will fail. So before restarting apache, run the following command:
    sudo a2enmod rewrite

    If using a USB webcam, you’ll also need to ensure that user www-data has access to the camera. To do this, you need to run the command
    sudo usermod -aG video www-data

    1. Avatar for Emmet
      Emmet on

      Hi Gourav,

      Thank you for your suggestions to improve this tutorial. I have fixed that mistake you mentioned while also adding the steps to enable mod rewrite and adding the “www-data” user to the “video” group.


  3. Avatar for Isaac Connor
    Isaac Connor on

    Maybe today I will get off my butt and setup a 64bit build server pi…

    1. Avatar for Luciano
      Luciano on

      Nice Issac !!!

      Im trying to install 1.36 version in my Pi4, butt without success.

    2. Avatar for Emmet
      Emmet on

      Hi Luciano,

      If you are running a 32-bit release of Raspberry Pi OS, our tutorial should work with installing the latest release of ZoneMinder (1.37).


  4. Avatar for Isaac Connor
    Isaac Connor on

    Excellent tutorial, just one thing, speaking as the main ZoneMinder developer:

    Raspbian doesn’t come with the latest version of ZoneMinder. There are many bugs fixes and fixed security vulnerabilities in more recent versions. We build up to date packages for raspbian and other distributions at

    1. Avatar for Emmet
      Emmet on

      Hi Isaac,

      Thank you for the heads up about the official repository. Only downside of the repository you provide is that it doesn’t seem to provide ARM64 builds.

      I will work on moving the tutorial to utilize the official ZoneMinder repository and just add a note about the ARM64 builds will be from an older release.


Leave a Reply

Your email address will not be published. Required fields are marked *