How do use ZoneMinder on Raspberry Pi

To use ZoneMinder on a Raspberry Pi, follow these steps:

  1. Prepare your Raspberry Pi:

    • Ensure your Raspberry Pi is running the latest version of Raspberry Pi OS.
  2. Update and Upgrade:

    • Open a terminal and run:
      sudo apt update
      sudo apt upgrade
      
  3. Install Apache, MySQL, and PHP (LAMP stack):

    • Install Apache:
      sudo apt install apache2
      
    • Install MySQL:
      sudo apt install mariadb-server
      
    • Secure MySQL installation:
      sudo mysql_secure_installation
      
    • Install PHP and required modules:
      sudo apt install php libapache2-mod-php php-mysql php-gd php-xml php-mbstring
      
  4. Install ZoneMinder:

    • Add the ZoneMinder repository:
      sudo sh -c 'echo "deb http://www.deb-multimedia.org bullseye main non-free" >> /etc/apt/sources.list'
      sudo apt update
      sudo apt install deb-multimedia-keyring
      sudo apt update
      
    • Install ZoneMinder:
      sudo apt install zoneminder
      
  5. Configure ZoneMinder:

    • Enable ZoneMinder to start at boot:
      sudo systemctl enable zoneminder
      sudo systemctl start zoneminder
      
    • Configure Apache for ZoneMinder:
      sudo a2enconf zoneminder
      sudo a2enmod rewrite
      sudo systemctl restart apache2
      
  6. Database Setup:

    • Create ZoneMinder database:
      sudo mysql -uroot -p
      
      Inside MySQL prompt:
      CREATE DATABASE zm;
      CREATE USER 'zmuser'@'localhost' IDENTIFIED BY 'zmpass';
      GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost';
      FLUSH PRIVILEGES;
      EXIT;
      
    • Import ZoneMinder database schema:
      sudo mysql -uroot -p zm < /usr/share/zoneminder/db/zm_create.sql
      
  7. Final Adjustments:

    • Set the correct timezone in php.ini:
      sudo nano /etc/php/7.4/apache2/php.ini
      
      Find and set:
      date.timezone = "Your/Timezone"
      
    • Restart Apache:
      sudo systemctl restart apache2
      
  8. Access ZoneMinder:

    • Open a web browser and go to http://your_raspberry_pi_ip/zm.

This should get ZoneMinder up and running on your Raspberry Pi. Adjustments may be necessary based on your specific setup and requirements.