Difference between revisions of "Debian 12 Bookworm with Zoneminder 1.36.33"

From ZoneMinder Wiki
Jump to navigationJump to search
 
(68 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Debian 9 with Zoneminder 1.30.4
__TOC__


This page is in process of updating 04JUN17 and is not complete or verified!!!
==Debian 12 with Zoneminder 1.36.x==


Use Debian 9 net install CD. Install only: web server, SSH server and standard system utilities from tasksel
Debian 12 Bookworm is released with Zoneminder 1.36.33 and as usual for Debian the zm database needs to be created manually.


Login and become root (su root) or prepend sudo to the following commands
'''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.'''


If needed check to make sure you are up to date
In time a version of Zoneminder for Bookworm will be made available in the zmrepo.


apt update
You will have to install sudo and add the user to the sudoers file.
apt upgrade
apt dist-upgrade


Install additional LAMP components (Mariadb server recommended)
Become root with


  apt install php mariadb-server php-mysql apache2-mod-php7.0
  su


Secure Mariadb, create root password et. al.
Install sudo


  mysql_secure_installation
  apt install sudo


Then add the user


Or to install MySQL Server
/sbin/adduser username sudo


apt install php default-mysql-server php-mysql apache2-mod-php7.0
I recommend rebooting at this point but a log out and back in also works.


Make a change to MySQL settings: (Note: Your my.cnf may be in another location)
Become root


  nano /etc/mysql/my.cnf
  sudo su


In the [mysqld] section add the following
Timezone: it is recommended you set your specific timesone with:


  sql_mode = NO_ENGINE_SUBSTITUTION
  timedatectl set-timezone America/New_York


Ctrl+o Enter to save
Of course use your timezone in place of America/New_York


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


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


systemctl restart mysql
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


Add the Deb Multimedia repository. (instructions at: https://deb-multimedia.org/)
Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone


Edit sources.list
[Date]
 
  ; Defines the default timezone used by the date functions
  nano /etc/apt/sources.list
  ; http://php.net/date.timezone
 
date.timezone = America/New_York
Add to the end of the file:
 
  deb http://www.deb-multimedia.org stretch main non-free


Ctrl+o Enter to save
Ctrl+o Enter to save
Line 57: Line 54:
CTRL+x to exit  
CTRL+x to exit  


After you have added the necessary line in /etc/apt/sources.list the first package to install is deb-multimedia-keyring.
Restart Apache
 
apt-get update
apt-get install deb-multimedia-keyring
 
Update packages list:
 
apt update
apt upgrade
apt dist-upgrade


service apache2 restart


Install Zoneminder
Install Zoneminder
Line 73: Line 62:
  apt install zoneminder
  apt install zoneminder


Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)
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 < /usr/share/zoneminder/db/zm_create.sql
Line 81: Line 70:
  mysqladmin -uroot -p reload
  mysqladmin -uroot -p reload


Set permissions of /etc/zm/zm.conf to root:www-data 740
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


  chmod 740 /etc/zm/zm.conf
  nano /etc/apache2/conf-available/zoneminder.conf


chown root:www-data /etc/zm/zm.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
Enable Zoneminder service to start at boot


Line 99: Line 155:
  systemctl start zoneminder.service
  systemctl start zoneminder.service


Check to see that Zoneminder is running
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.


systemctl status zoneminder.service
Become root with


Enable CGI and Zoneminder configuration in Apache.
su


  a2enmod cgi
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 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


a2enconf zoneminder


Add timezone to PHP
Copy the contents of the script, open a terminal and run:


  nano /etc/php/7.0/apache2/php.ini
  nano zm-install


Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone. Be sure to remove the ; before date.timezone
Paste the contents of the script into Nano


[Date]
Then:
; 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 + o Ctrl + x


CTRL+x to exit
Next run:


Change permissions in /usr/share/zoneminder/
chmod 755 zm-install


chown -R www-data:www-data /usr/share/zoneminder/
Start the script by entering:


./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 15:10, 4 November 2023

Debian 12 with Zoneminder 1.36.x

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

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!