Debian 13 Trixie with Zoneminder 1.36.35 or Zoneminder 1.37.x

From ZoneMinder Wiki
Revision as of 18:00, 5 September 2025 by Bbunge (talk | contribs)
Jump to navigationJump to search


Debian 13 with Zoneminder 1.36.35 from Debian Repo

Notice: These procedure are for a new install of Zoneminder 1.36.35 on Debian 13 Trixie.

Debian, unlike Ubuntu, does not install sudo with the initial setup. While you can log in as root, a user with sudo authority is recommended.

To enable sudo: In a terminal,become root with su root. Enter your root password. Install sudo with:

apt install sudo

Add the user account to the group sudo with:

/sbin/adduser username sudo 

where username is your user account. Exit root then log out and then log in with the same user.

Become root with the command:

sudo su

Timezone: it is recommended you set your specific timesone with:

timedatectl set-timezone America/New_York

Of course use your timezone in place of America/New_York.

Note: This is an install procedure for new installations! Upgraders are encouraged to search the Zoneminder Forum for upgrade information!

To begin, install Debian 13 Trixie along with Apache2, PHP and Mariadb (recommended). A quick way to do this is:

apt install apache2 mariadb-server php libapache2-mod-php php-mysql

Add timezone to PHP

nano /etc/php/8.4/apache2/php.ini

Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

Ctrl+o Enter to save

CTRL+x to exit

Install Zoneminder

apt install zoneminder --install-recommends -y

Create Zoneminder database in Mariadb (Note: this also creates the default Zoneminder user and permissions in Mariadb)

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
mysqladmin -uroot -p reload

Set permissions of /etc/zm/zm.conf to root:www-data 740

chmod 740 /etc/zm/zm.conf

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

Create a new user if you plan to use local (USB or capture card) cameras.

adduser www-data video

Replace the zoneminder.conf file (The API functions were not included in the Trixie Distro version) Make a copy of the original file

cp /etc/apache2/conf-availible/zoneminder.conf /etc/apache2/conf-availible/zoneminder.conf.org

Edit the zoneminder.conf

nano /etc/apache2/conf-availible/zoneminder.conf

Replace the original contents with the following:

# This file is recommended by the developer to fix the Zoneminder display not working. 05SEP25
# PLEASE NOTE THAT THIS FILE IS INTENDED FOR GUIDANCE ONLY AND MAY NOT BE APPROPRIATE FOR YOUR DISTRIBUTION
#
# This is for use with debian/ubuntu based distributions
#
# Sample configuration file for running ZoneMinder as name based virtual host
# Some values may need to manually adjusted to suit your setup
#
<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot "/usr/share/zoneminder/www"

    # Order matters. This alias must come first.
    Alias /zm/cache "/var/cache/zoneminder/cache"
    # IF you aren't using /zm in the url to access ZM then uncomment the following line as well
    # Alias /cache "/var/cache/zoneminder/cache"
    
    <Directory "/var/cache/zoneminder/cache">
        Options -Indexes +FollowSymLinks
        AllowOverride None
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>
    
    ScriptAlias /zm/cgi-bin/ "/usr/lib/zoneminder/cgi-bin"
    ScriptAlias /cgi-bin "/usr/lib/zoneminder/cgi-bin"
    <Directory "/usr/lib/zoneminder/cgi-bin">
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        AllowOverride All
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory> 

    Alias /zm "/usr/share/zoneminder/www" 
    <Directory "/usr/share/zoneminder/www">
        Options -Indexes +FollowSymLinks
        AllowOverride All
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>
    # For better visibility, the following directives have been migrated from the
    # default .htaccess files included with the CakePHP project.
    # Parameters not set here are inherited from the parent directive above.
    <Directory "/usr/share/zoneminder/www/api">
       RewriteEngine on
       RewriteRule ^$ app/webroot/ [L]
       RewriteRule (.*) app/webroot/$1 [L]
       RewriteBase /zm/api
    </Directory> 

    <Directory "/usr/share/zoneminder/www/api/app">
       RewriteEngine on
       RewriteRule ^$ webroot/ [L]
       RewriteRule (.*) webroot/$1 [L]
       RewriteBase /zm/api
    </Directory> 

    <Directory "/usr/share/zoneminder/www/api/app/webroot">
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
        RewriteBase /zm/api
    </Directory>
   # Use the first option to have Apache logs written to the general log
    # directory, or the second to have them written to the regular Apache
    # directory (you may have to change the path to that used on your system)
    ErrorLog /var/log/zm/apache-error.log
    #ErrorLog /var/log/httpd/zm-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn 

    # Use the first option to have Apache logs written to the general log
    # directory, or the second to have them written to the regular Apache
    # directory (you may have to change the path to that used on your system)
    CustomLog /var/log/zm/apache-access.log combined
    #CustomLog /var/log/httpd/zm-access.log combined 

</VirtualHost> 

Ctrl+o Enter to save

CTRL+x to exit

Enable and start Zoneminder

systemctl enable zoneminder.service
systemctl start zoneminder 

Enable Apache Modules

a2enconf zoneminder
a2enmod rewrite
a2enmod headers
a2enmod expires
a2enmod cgi

Restart Apache

service apache2 reload

Remember to set your timezone in Zoneminder - Options

Debian 13 with Zoneminder 1.37.x from zmrepo

Install Zoneminder Development Branch 1.37.x on Debian 13

You will have to install sudo and add the user to the sudoers file.

Become root with

su

Install sudo

apt install sudo

Then add the user

/sbin/adduser username sudo 

I recommend rebooting at this point but a log out and back in also works.

Install Apache2, PHP and your favorite database (Mariadb recommended). A quick way to install LAMP is:

apt install apache2 mariadb-server php libapache2-mod-php php-mysql lsb-release gnupg2


Become root with sudo su before running this!

Shell script file contents:

#!/bin/sh
clear
read -p "This script installs ZoneMinder 1.37.x on Debian 12 with LAMP (MySQL or Mariadb) installed...
This script must be run as root!
Press Enter to continue or Ctrl + c to quit" nothing
clear
apt install -y lsb-release gnupg2
echo "deb https://zmrepo.zoneminder.com/debian/master "`lsb_release  -c -s`"/" | sudo tee /etc/apt/sources.list.d/zoneminder.list
# The key is stored in the deprecated keyring trusted.gpg.
# wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -
wget -O- https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/zmrepo.gpg
read -p "Warning! Check above to insure the line says OK. If not the GPG signing key was not installed and you will need to figure out why before continuing. 
Press enter to continue" nothing
apt update
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
a2enmod headers
a2enmod expires
service apache2 reload
clear
read -p "Install complete. Open Zoneminder/Options and set the timezone. Press enter to continue" nothing
clear


Copy the contents of the script, open a terminal and run:

nano zm-install

Paste the contents of the script into Nano

Then:

Ctrl + o Ctrl + x

Next run:

chmod 755 zm-install

Start the script by entering:

./zm-install

Follow the prompts. Things are pretty simple. The timezone is now set in Zoneminder/Options.

Good Luck!