Difference between revisions of "Debian 10 Buster with Zoneminder 1.36.x from ZM Repo"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 2: Line 2:




'''Security Note: Prior version of my install procedure and install script contained  a "Fix Permissions: chown -R www-data:www-data /usr/share/zoneminder/" step. It has been brought to my attention that this could allow the www-data user to write inthis area which is not a good thing. To correct this on your system run: chown -R root:root /usr/share/zoneminder/'''
'''Notice: These procedure are for a new install of Zoneminder 1.36.x on Debian 10 (Buster). If you are doing an upgrade I strongly recommend you check the Zoneminder-1.36 Forum area for recommendations from others.'''


===Debian 10 Buster with Zoneminder 1.36.x from the ZM Release-1.36 Repo===


'''Notice: These procedure are for a new install of Zoneminder 1.34.x on Debian 10 (Buster). If you are doing an upgrade I strongly recommend you check the Zoneminder-1.34 Forum area for recommendations from others.'''
This install procedure was developed to use the Debian package developed by iconnor. This is from the 1.36 release version of Zoneminder.
 
===Debian 10 Buster with Zoneminder 1.34.x from the ZM Release-1.34 Repo===
 
This install procedure was developed to use the Debian package developed by iconnor. This is from the 1.34 release version of Zoneminder.


'''Note: This is an install procedure for new installations! Upgraders are encouraged to search the Zoneminder Forum for upgrade information!'''
'''Note: This is an install procedure for new installations! Upgraders are encouraged to search the Zoneminder Forum for upgrade information!'''
Line 31: Line 28:
Add the following line to the end of the file
Add the following line to the end of the file


  deb https://zmrepo.zoneminder.com/debian/release-1.34 buster/
  deb https://zmrepo.zoneminder.com/debian/release-1.36 buster/


CTRL+o then [Enter] to save
CTRL+o then [Enter] to save
Line 53: Line 50:
Create a new user if you plan to use local (USB or capture card) cameras.
Create a new user if you plan to use local (USB or capture card) cameras.


  adduser www-data video
  sudo adduser www-data video


Enable and start Zoneminder  
Enable and start Zoneminder  
Line 69: Line 66:
  sudo service apache2 reload
  sudo service apache2 reload


Access Zoneminder (http://ip-address/zm) and remember to set your timezone in Zoneminder/Options
Remember to set your timezone in Zoneminder - Options


===Zoneminder 1.34.x on Buster LEMP (NGNIX, Mariadb, PHP)===
===Zoneminder 1.36.x on Buster LEMP (NGNIX, Mariadb, PHP)===


This procedure will work on a Raspberry Pi 3b+ and possibly other devices.  
This procedure will work on a Raspberry Pi 3b+ and possibly other devices.  
Line 78: Line 75:


Start with a basic Buster install. You can use a server or desktop install. Do not install LAMP!
Start with a basic Buster install. You can use a server or desktop install. Do not install LAMP!
Become root
sudo su


Install Ngnix, Mariadb and PHP components
Install Ngnix, Mariadb and PHP components


  apt install nginx mariadb-server php-fpm php-mysql fcgiwrap
  sudo apt install nginx mariadb-server php-fpm php-mysql fcgiwrap


Secure the Mariadb server
Secure the Mariadb server


  mysql_secure_installation
  sudo mysql_secure_installation


Restart Mariadb
Restart Mariadb


  systemctl restart mysql
  sudo systemctl restart mysql


Edit the php.ini file
Edit the php.ini file


  nano /etc/php/7.3/fpm/php.ini
  sudo nano /etc/php/7.3/fpm/php.ini


Locate (Ctrl+w) cgi.fix_pathinfo=1 and change to
Locate (Ctrl+w) cgi.fix_pathinfo=1 and change to
Line 111: Line 104:
Restart php-fpm
Restart php-fpm


  systemctl restart php7.3-fpm
  sudo systemctl restart php7.3-fpm




Line 138: Line 131:
Install Zoneminder
Install Zoneminder


  apt install zoneminder
  sudo apt install zoneminder


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


  adduser www-data video
  sudo adduser www-data video




Change the ZM_PATH_ZMS in the 01-system-paths.conf file to /cgi-bin/nph-zms by dropping the /zm/  
Change the ZM_PATH_ZMS in the 01-system-paths.conf file to /cgi-bin/nph-zms by dropping the /zm/  


  nano /etc/zm/conf.d/01-system-paths.conf
  sudo nano /etc/zm/conf.d/01-system-paths.conf


Ctrl+o Enter to save
Ctrl+o Enter to save
Line 155: Line 148:
Enable and start Zoneminder
Enable and start Zoneminder


  systemctl enable zoneminder
  sudo systemctl enable zoneminder


  service zoneminder start
  sudo service zoneminder start




Edit the Ngnix default configuration.  
Edit the Ngnix default configuration.  


  nano /etc/nginx/sites-available/default
  sudo nano /etc/nginx/sites-available/default


Locate the line "index index.html index.htm index.nginx-debian.html;" and add index.php
Locate the line "index index.html index.htm index.nginx-debian.html;" and add index.php
Line 178: Line 171:
Create a Zoneminder conf file
Create a Zoneminder conf file


  nano /etc/nginx/zoneminder.conf
  sudo nano /etc/nginx/zoneminder.conf


Enter the following into the zoneminder.conf file (This file was improved by databoy2k)
Enter the following into the zoneminder.conf file (This file was improved by databoy2k)
Line 223: Line 216:
Restart Ngnix
Restart Ngnix


  service nginx restart
  sudo service nginx restart


Note: If Nginx gives you an error on restart go back one step and re-enter include /etc/ngnix/zoneminder.conf;
Note: If Nginx gives you an error on restart go back one step and re-enter include /etc/ngnix/zoneminder.conf;
Line 229: Line 222:
If it does not exist create  
If it does not exist create  


  nano /etc/default/fcgiwrap
  sudo nano /etc/default/fcgiwrap


and insert (with the number of children -c equal to the number of cameras) Note that you may need to have this value larger than the number if cameras. In my case I run "camera walls" from a custom web page that accesses the Zoneminder monitors. I have needed to increase the -c to include the number of cameras in the camera wall web pages.
and insert (with the number of children -c equal to the number of cameras) Note that you may need to have this value larger than the number if cameras. In my case I run "camera walls" from a custom web page that accesses the Zoneminder monitors. I have needed to increase the -c to include the number of cameras in the camera wall web pages.
Line 241: Line 234:
then restart the fcgiwrap service.
then restart the fcgiwrap service.


  systemctl restart fcgiwrap
  sudo systemctl restart fcgiwrap


Open Zoneminder and under Options set your timezone.
Open Zoneminder and under Options set your timezone.

Revision as of 19:09, 29 July 2021


Notice: These procedure are for a new install of Zoneminder 1.36.x on Debian 10 (Buster). If you are doing an upgrade I strongly recommend you check the Zoneminder-1.36 Forum area for recommendations from others.

Debian 10 Buster with Zoneminder 1.36.x from the ZM Release-1.36 Repo

This install procedure was developed to use the Debian package developed by iconnor. This is from the 1.36 release version of Zoneminder.

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

This procedure will work on a Raspberry Pi 3b+ and possibly other devices.

To begin, install Debian 10 (Buster) along with Apache2, PHP and your favorite database (Mariadb recommended). A quick way to do this is:

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

Then secure Mariadb

sudo mysql_secure_installation

(If you want more detailed instrunctions for a LAMP server see: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-debian-10)

Add the repo

sudo nano /etc/apt/sources.list

Add the following line to the end of the file

deb https://zmrepo.zoneminder.com/debian/release-1.36 buster/

CTRL+o then [Enter] to save

CTRL+x to exit

Install the following and retrieve the key from the repro

sudo apt install apt-transport-https gnupg
wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -

Important - Make sure the above "wget" process completes without error! If it does not complete you will not get the most recent Zoneminder version this procedure is written for.

sudo apt update

Install Zoneminder

sudo apt install zoneminder

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

sudo adduser www-data video

Enable and start Zoneminder

sudo systemctl enable zoneminder.service
sudo systemctl start zoneminder 

Enable Apache Modules

sudo a2enconf zoneminder
sudo a2enmod rewrite

Restart Apache

sudo service apache2 reload

Remember to set your timezone in Zoneminder - Options

Zoneminder 1.36.x on Buster LEMP (NGNIX, Mariadb, PHP)

This procedure will work on a Raspberry Pi 3b+ and possibly other devices.

Thanks to "terdinglage" for the input to get this to work!

Start with a basic Buster install. You can use a server or desktop install. Do not install LAMP!

Install Ngnix, Mariadb and PHP components

sudo apt install nginx mariadb-server php-fpm php-mysql fcgiwrap

Secure the Mariadb server

sudo mysql_secure_installation

Restart Mariadb

sudo systemctl restart mysql

Edit the php.ini file

sudo nano /etc/php/7.3/fpm/php.ini

Locate (Ctrl+w) cgi.fix_pathinfo=1 and change to

cgi.fix_pathinfo=0

Remember to remove the leading ;

Ctrl+o Enter to save

CTRL+x to exit

Restart php-fpm

sudo systemctl restart php7.3-fpm


Add the repro

sudo nano /etc/apt/sources.list

Add the following line to the end of the file

deb https://zmrepo.zoneminder.com/debian/release-1.34 buster/

CTRL+o then [Enter] to save

CTRL+x to exit

Install the following and retrieve the key from the repro

sudo apt install apt-transport-https gnupg
wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -

Important - Make sure the above "wget" process completes without error! If it does not complete you will not get the most recent Zoneminder version this procedure is written for.

sudo apt update

Install Zoneminder

sudo apt install zoneminder

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

sudo adduser www-data video


Change the ZM_PATH_ZMS in the 01-system-paths.conf file to /cgi-bin/nph-zms by dropping the /zm/

sudo nano /etc/zm/conf.d/01-system-paths.conf

Ctrl+o Enter to save

CTRL+x to exit

Enable and start Zoneminder

sudo systemctl enable zoneminder
sudo service zoneminder start


Edit the Ngnix default configuration.

sudo nano /etc/nginx/sites-available/default

Locate the line "index index.html index.htm index.nginx-debian.html;" and add index.php

index index.php index.html index.htm index.nginx-debian.html;

In the "server" section after listen [::] :80 default_Server; add

include /etc/nginx/zoneminder.conf;

Ctrl+o Enter to save

CTRL+x to exit

Create a Zoneminder conf file

sudo nano /etc/nginx/zoneminder.conf

Enter the following into the zoneminder.conf file (This file was improved by databoy2k)

location /cgi-bin {
auth_basic off;
        alias /usr/lib/zoneminder/cgi-bin;     
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param HTTP_PROXY "";
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location /zm/cache {
auth_basic off;
        alias /var/cache/zoneminder/cache;
}
location ~ /zm/api/(css|img|ico) {
auth_basic off;
        rewrite ^/zm/api(.+)$ /api/app/webroot/$1 break;
        try_files $uri $uri/ =404;
}
location /zm {
auth_basic off;
        alias /usr/share/zoneminder/www;
        try_files $uri $uri/ /index.php?$args =404;    
        location /zm/api {
auth_basic off;
                rewrite ^/zm/api(.+)$ /zm/api/app/webroot/index.php?p=$1 last;
         }
                location ~ \.php$ {
                auth_basic off;
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_param HTTP_PROXY "";
                fastcgi_index index.php;
                        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        }
    }

Ctrl+o Enter to save

CTRL+x to exit

Restart Ngnix

sudo service nginx restart

Note: If Nginx gives you an error on restart go back one step and re-enter include /etc/ngnix/zoneminder.conf;

If it does not exist create

sudo nano /etc/default/fcgiwrap

and insert (with the number of children -c equal to the number of cameras) Note that you may need to have this value larger than the number if cameras. In my case I run "camera walls" from a custom web page that accesses the Zoneminder monitors. I have needed to increase the -c to include the number of cameras in the camera wall web pages.

DAEMON_OPTS=-c 10

Ctrl+o Enter to save

CTRL+x to exit

then restart the fcgiwrap service.

sudo systemctl restart fcgiwrap

Open Zoneminder and under Options set your timezone.