Difference between revisions of "Debian 12 Bookworm with Zoneminder 1.36.x and 1.37.x"

From ZoneMinder Wiki
Jump to navigationJump to search
 
(30 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__TOC__
__TOC__


===Debian 9 with Zoneminder 1.30.4===
17FEB19 This procedure can be used to install Zoneminder on a Raspberry Pi. I used a Pi3 B+.


08OCT17 - This procedure has been verified with the Debian 9.2.0.
==Debian 12 with Zoneminder 1.36.34==
Debian 12 has been released with Zoneminder 1.36.33 and as usual for Debian the zm database needs to be created manually. This is not user friendly.  So we will be using the packages provided by the ZoneMinder development team hosted at zmrepo.zoneminder.com.  


Note: 23JUN17 - I was able to get the libvlc source to work! I have added the install for vlc-plugin-base which allows the Zoneminder install to complete without errors. However, I have been getting some console errors from VLC. It may be my old camera and you may have good results with libvlc but I consider ffmpeg better to use.
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.  


I used Debian 9 net install CD (https://www.debian.org/CD/netinst/).  
To enable sudo:
In a terminal,become root with su. 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:
sudo su


Install only: web server, SSH server and standard system utilities from tasksel
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.


Login and become root (su root) or prepend sudo to the following commands
1. Install Apache2, PHP and your favorite database (Mariadb recommended). A quick way to install LAMP is:


If needed check to make sure you are up to date
apt install apache2 mariadb-server php libapache2-mod-php php-mysql lsb-release gnupg2


apt update
_________________________________________________________________________________________________________________________________________
apt upgrade
apt dist-upgrade


===Install additional LAMP components Mariadb server (recommended)===
New install process with a shell script!


apt install php mariadb-server php-mysql libapache2-mod-php7.0
Become root with sudo su before running this!


Secure Mariadb, create root password et. al.
Shell script file contents:


  mysql_secure_installation
  #!/bin/sh
clear
read -p "This script installs ZoneMinder 1.36.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/release-1.36 "`lsb_release  -c -s`"/" | sudo tee /etc/apt/sources.list.d/zoneminder.list
wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -
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 zoneminder --install-recommends -y
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


NOTE:The MySQL/MariaDB configuration file is located at: /etc/mysql/mysql.conf.d/mysqld.cnf To better manage the MariaDB server I recommend you move the config file and replace the default my.cnf symbolic link (this also works for MySQL 5.6).


rm /etc/mysql/my.cnf 
Copy the contents of the script, open a terminal and run:


  cp /etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/my.cnf
  nano zm-install


'''The following change to Mariadb settings is optional but is included if you have problems logging into Zoneminder'''
Paste the contents of the script into Nano


nano /etc/mysql/my.cnf
Then:


Make the following changes:
Ctrl + o Ctrl + x


character-set-server = latin1
Next run:
collation-server = latin1_swedish_ci


Note: The above settings are actually the Mariadb default. Changing back to default is necessary to avoid errors when logging into Zoneminder. This was added on 01APR17 but is not an April Fool! It may be necessary to align these settings with your regional language.
chmod 755 zm-install


Ctrl+o Enter to save
Start the script by entering:


Ctrl+x to exit
./zm-install


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


service mariadb restart
Good Luck!


===Install Zoneminder===
__________________________________________________________________________________________________________________________________________


Add the Deb Multimedia repository. (instructions at: https://deb-multimedia.org/)
Old procedure retained for reference


Edit sources.list
Debian 12 Bookworm is released with Zoneminder 1.36.33 and as usual for Debian the zm database needs to be created manually.


nano /etc/apt/sources.list
'''Note: This version has been verified with Bookworm Debian 12 official release. A few issues have been found and corrected. Zoneminder now opens in Firefox (Windows, Linux and Android), Edge, Chrome (on Android). ZmNinja on Android also works. If using ZmNinja you may have to clear the API cache. Please report other errors on the Zoneminder forum.'''


Add to the end of the file:
In time a version of Zoneminder for Bookworm will be made available in the zmrepo.


deb http://www.deb-multimedia.org stretch main non-free
You will have to install sudo and add the user to the sudoers file.  


Ctrl+o Enter to save
Become root with


Ctrl+x to exit
su


After you have added the necessary line in /etc/apt/sources.list the first package to install is deb-multimedia-keyring.
Install sudo


apt update
  apt install sudo
  apt install deb-multimedia-keyring


If apt-get can not find the new key, do that :
Then add the user


  wget http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb
  /sbin/adduser username sudo
dpkg -i deb-multimedia-keyring_2016.8.1_all.deb


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


apt update
Become root
apt upgrade
apt dist-upgrade


sudo su


Install Zoneminder
Timezone: it is recommended you set your specific timesone with:
 
apt install zoneminder vlc-plugin-base php7.0-gd
 
 
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
  timedatectl set-timezone America/New_York


Enable Zoneminder service to start at boot
Of course use your timezone in place of America/New_York


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


Add www-data to the sudo group (to enable use of local video devices)
apt install apache2 mariadb-server php libapache2-mod-php php-mysql lsb-release gnupg2


adduser www-data video
Add timezone to PHP (This may not be necessary but does not hurt and will allow the time of events to be displayed correctly)


nano /etc/php/8.2/apache2/php.ini


Start Zoneminder
Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone
 
systemctl start zoneminder.service


Check to see that Zoneminder is running
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York


systemctl status zoneminder.service
Ctrl+o Enter to save
 
Enable CGI and Zoneminder configuration in Apache.
 
a2enmod cgi
 
a2enmod rewrite
 
a2enconf zoneminder
 
Add timezone to PHP
 
sed -i "s/;date.timezone =/date.timezone = $(sed 's/\//\\\//' /etc/timezone)/g" /etc/php/7.0/apache2/php.ini
 
Change permissions in /usr/share/zoneminder/
 
chown -R www-data:www-data /usr/share/zoneminder/


CTRL+x to exit


Restart Apache
Restart Apache
Line 135: Line 142:
  service apache2 restart
  service apache2 restart


Open Zoneminder in a web browser (http://server-ip/zm).
or


10OCT17 - An issue with the /tmp/zm directory has been reported. Debian uses private tmp folders so even though you can see the files & folders, zoneminder cannot because it is running under a different user account.
systemctl restart apache2


Go to Options -> Paths and then inspect each PATH_XXX variable. If it is set to "/tmp/zm", change it to "/dev/shm". Don't forget to restart zoneminder.
Install Zoneminder


===Alternate install MySQL Server===
apt install zoneminder
Note: Install of MySQL was not tested with the Debian 9.0.0 release but should work based on past experience


apt install php default-mysql-server php-mysql apache2-mod-php7.0
Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL) Use the server root password when prompted.


Make a change to MySQL settings: (Note: Your my.cnf may be in another location)
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql


  nano /etc/mysql/my.cnf
  mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"


In the [mysqld] section add the following
mysqladmin -uroot -p reload


sql_mode = NO_ENGINE_SUBSTITUTION
Set permissions


Note: if you are installing on an existing database server you can use the following as an alternate to 'sql_mode = NO_ENGINE_SUBSTITUTION' (Thanks to "bodom" for this alternate):
chmod 640 /etc/zm/zm.conf
chown root:www-data /etc/zm/zm.conf
chown -R www-data:www-data /var/cache/zoneminder/
chmod 755 /var/cache/zoneminder/


init_connect = 'SET @@sql_mode = CASE CURRENT_USER() WHEN \'zmuser@localhost\' THEN \'NO_ENGINE_SUBSTITUTION\' ELSE @@sql_mode END;'
Replace zoneminder.conf


Ctrl+o Enter to save
cp /etc/apache2/conf-available/zoneminder.conf /etc/apache2/conf-available/zoneminder.conf.sav


Ctrl+x to exit
rm /etc/apache2/conf-available/zoneminder.conf


Restart MySQL
nano /etc/apache2/conf-available/zoneminder.conf


systemctl restart mysql
Paste the following content into nano:
 
Continue with Zoneminder install https://wiki.zoneminder.com/Debian_9_64-bit_with_Zoneminder_1.30.4_the_Easy_Way#Install_Zoneminder
 
===Raspberry Pi 3B Zoneminder 1.30.4===
 
Become root
 
sudo su
 
Install additional LAMP components Mariadb server (recommended)
 
apt install php mariadb-server php-mysql libapache2-mod-php7.0 apache2
 
Secure Mariadb, create root password et. al.
 
mysql_secure_installation
 
Edit sources.list
 
nano /etc/apt/sources.list
 
For Pi uncomment:
 
deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free$
 
Ctrl+o Enter to save
 
Ctrl+x to exit
 
Update apt
 
apt update
 
Install Zoneminder
 
apt install zoneminder
 
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


# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Require all granted
</Directory>
# Order matters. This alias must come first.
Alias /zm/cache "/var/cache/zoneminder"
<Directory "/var/cache/zoneminder">
    Options -Indexes +FollowSymLinks
    AllowOverride None
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
    </IfModule>
</Directory>
Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
  Options -Indexes +FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </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>
Enable Zoneminder service to start at boot
Enable Zoneminder service to start at boot


Line 216: Line 238:


  adduser www-data video
  adduser www-data video
For Pi, Create Zoneminder database in Mariadb (Note: this also creates the default Zoneminder user and permissions in MySQL)
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


Start Zoneminder
Start Zoneminder
Line 230: Line 243:
  systemctl start zoneminder.service
  systemctl start zoneminder.service


Check to see that Zoneminder is running
Enable Zoneminder configuration in Apache.
 
systemctl status zoneminder.service
 
Enable CGI and Zoneminder configuration in Apache.


a2enconf zoneminder
a2enmod rewrite
a2enmod headers
a2enmod expires
  a2enmod cgi
  a2enmod cgi
service apache2 reload


a2enmod rewrite
Install complete. Open Zoneminder/Options and set the timezone in Options/System. Add cameras.


a2enconf zoneminder
----------------------------------------------------------------------------------------------------------
==Debian 12 with Zoneminder 1.37.x==
Install Zoneminder Development Branch 1.37.x on Debian 12


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


sed -i "s/;date.timezone =/date.timezone = $(sed 's/\//\\\//' /etc/timezone)/g" /etc/php/7.0/apache2/php.ini
Become root with


Change permissions in /usr/share/zoneminder/
su


chown -R www-data:www-data /usr/share/zoneminder/
Install sudo


apt install sudo


Restart Apache
Then add the user


  service apache2 restart
  /sbin/adduser username sudo


===Debian 9 with Zoneminder 1.32.2 from the Experimental Repro===
I recommend rebooting at this point but a log out and back in also works.


This is an interim install procedure for the bold user! Start with a fresh Debian 9 install.
Install Apache2, PHP and your favorite database (Mariadb recommended). A quick way to install LAMP is:


Note: this will do updates from the sid repro as well!
apt install apache2 mariadb-server php libapache2-mod-php php-mysql lsb-release gnupg2


Warning: Release 1.32.3-2 from Debian Unstable package as of 4/2019 is not compiled with H264 support, so the functions of H264 encode and passthrough will not function. However, it is still possible to use traditional MJPEG frame and analysis saving. It may be advised to try the [Debian ZMRepo link].


Edit sources.list
Become root with sudo su before running this!


nano /etc/apt/sources.list
Shell script file contents:
 
Add to the end of the file:
 
deb http://deb.debian.org/debian experimental main
deb http://deb.debian.org/debian sid main
 
 
To install an experimental package, do:


#!/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
wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -
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
  apt update
  apt upgrade    (note: this will do all the updates in sid  unstable!)
  clear
  apt -t experimental install zoneminder
  apt install -y zoneminder
 
  systemctl enable zoneminder
Set permissions of /etc/zm/zm.conf to root:www-data 740
  service zoneminder start
 
  chmod 740 /etc/zm/zm.conf
 
  chown root:www-data /etc/zm/zm.conf
 
Enable Zoneminder service to start at boot
 
systemctl enable zoneminder.service
 
Add www-data to the sudo group (to enable use of local video devices)
 
  adduser www-data video
  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


Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)
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
Start Zoneminder


systemctl start zoneminder.service
Copy the contents of the script, open a terminal and run:


Enable CGI and Zoneminder configuration in Apache.
nano zm-install


a2enmod cgi
Paste the contents of the script into Nano


a2enmod rewrite
Then:


  a2enconf zoneminder
  Ctrl + o Ctrl + x


Add timezone to PHP
Next run:


  sed -i "s/;date.timezone =/date.timezone = $(sed 's/\//\\\//' /etc/timezone)/g" /etc/php/7.0/apache2/php.ini
  chmod 755 zm-install


Change permissions in /usr/share/zoneminder/
Start the script by entering:


  chown -R www-data:www-data /usr/share/zoneminder/
  ./zm-install


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


service apache2 restart
Good Luck!

Latest revision as of 18:47, 24 August 2024


Debian 12 with Zoneminder 1.36.34

Debian 12 has been released with Zoneminder 1.36.33 and as usual for Debian the zm database needs to be created manually. This is not user friendly. So we will be using the packages provided by the ZoneMinder development team hosted at zmrepo.zoneminder.com.

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. 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:

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.

1. 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

_________________________________________________________________________________________________________________________________________

New install process with a shell script!

Become root with sudo su before running this!

Shell script file contents:

#!/bin/sh
clear
read -p "This script installs ZoneMinder 1.36.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/release-1.36 "`lsb_release  -c -s`"/" | sudo tee /etc/apt/sources.list.d/zoneminder.list
wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -
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 zoneminder --install-recommends -y
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!

__________________________________________________________________________________________________________________________________________

Old procedure retained for reference

Debian 12 Bookworm is released with Zoneminder 1.36.33 and as usual for Debian the zm database needs to be created manually.

Note: This version has been verified with Bookworm Debian 12 official release. A few issues have been found and corrected. Zoneminder now opens in Firefox (Windows, Linux and Android), Edge, Chrome (on Android). ZmNinja on Android also works. If using ZmNinja you may have to clear the API cache. Please report other errors on the Zoneminder forum.

In time a version of Zoneminder for Bookworm will be made available in the zmrepo.

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.

Become root

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

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

Add timezone to PHP (This may not be necessary but does not hurt and will allow the time of events to be displayed correctly)

nano /etc/php/8.2/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

Restart Apache

service apache2 restart

or

systemctl restart apache2

Install Zoneminder

apt install zoneminder

Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL) Use the server root password when prompted.

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

chmod 640 /etc/zm/zm.conf

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

chown -R www-data:www-data /var/cache/zoneminder/

chmod 755 /var/cache/zoneminder/

Replace zoneminder.conf

cp /etc/apache2/conf-available/zoneminder.conf /etc/apache2/conf-available/zoneminder.conf.sav
rm /etc/apache2/conf-available/zoneminder.conf
nano /etc/apache2/conf-available/zoneminder.conf

Paste the following content into nano:

# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Require all granted
</Directory>


# Order matters. This alias must come first.
Alias /zm/cache "/var/cache/zoneminder"
<Directory "/var/cache/zoneminder">
    Options -Indexes +FollowSymLinks
    AllowOverride None
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
    </IfModule>
</Directory>

Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
  Options -Indexes +FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </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>

Enable Zoneminder service to start at boot

systemctl enable zoneminder.service

Add www-data to the sudo group (to enable use of local video devices)

adduser www-data video

Start Zoneminder

systemctl start zoneminder.service

Enable Zoneminder configuration in Apache.

a2enconf zoneminder

a2enmod rewrite

a2enmod headers

a2enmod expires

a2enmod cgi

service apache2 reload

Install complete. Open Zoneminder/Options and set the timezone in Options/System. Add cameras.


Debian 12 with Zoneminder 1.37.x

Install Zoneminder Development Branch 1.37.x on Debian 12

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
wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -
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!