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

From ZoneMinder Wiki
Jump to navigationJump to search
 
(54 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''Note: This procedure is obsolete with the release of Zoneminder 1.29.0 in February 2016. Zoneminder 1.28.1 is no longer in the backports.'''
__TOC__




This easy install is for Debian 8.1 and 8.2 on Amd64 architecture (Jessie) with Zoneminder 1.28.1 from the back ports install. Please note that this documentation is also correct for Debian 8.1 release.
'''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.'''


A special THANKS to "felixr" for filling in where I did not know what to do!
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 installed Debian from the netinst CD with only web server, SSH server and standard system utilities. Tasksel does not
To enable sudo:
install LAMP under Debian so I installed MySQL and PHP after reboot.
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.


Note: I log in using Putty on my Windows PC as I can then copy and paste commands from this instruction. I also
Timezone: it is recommended you set your specific timesone with:
install Webmin to manage the server from a web browser. http://www.webmin.com/deb.html
  sudo timedatectl set-timezone America/New_York
Of course use your timezone in place of America/New_York.


Log in as root.
Mariadb additional settings
The default values for the database are adequate for initial setup. However, I recommend you make these changes before installing Zoneminder:
Edit the Mariadb config file:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Add the following in the [mysql] area:
innodb_file_per_table = ON
innodb_buffer_pool_ size = 256M
innodb_log_file_size - 32M
CTRL+o then [Enter] to save


  su root  (followed by your root password)
CTRL+x to exit
 
Reatart Mariadb:
  sudo service mysql restart
 
I recommend you install mysqltuner and run it from time to time and adjust the database settings as the number of saved events grows.


Install  PHP, and MySQL server (This installs MySQL server 5.5. If you want to use MySQL 5.6 follow the instructions [[Install MySQL 5.6 on Debian Jessie]] (using mariadb also works fine, as tested on Debian 8.2, replacement package for mysql-server is then mariadb-server)


apt-get install  php5 mysql-server php-pear php5-mysql
===Debian 10 Buster with Zoneminder 1.36.x from the ZM Release-1.36 Repo===


Add the Jessie backports to your standard repo
This install procedure was developed to use the Debian package developed by iconnor. This is from the 1.36 release version of Zoneminder.


nano /etc/apt/sources.list
'''Note: This is an install procedure for new installations! Upgraders are encouraged to search the Zoneminder Forum for upgrade information!'''


add to the bottom of the list:
This procedure will work on a Raspberry Pi 3b+ and possibly other devices.


deb http://http.debian.net/debian jessie-backports main
To begin, install Debian 10 (Buster) along with Apache2, PHP and your favorite database (Mariadb recommended). A quick way to do this is:


Ctrl+o Enter to save
sudo apt install apache2 mariadb-server php libapache2-mod-php php-mysql
CTRL+x to exit
 
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


Update Sources
Add the following line to the end of the file


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


Check to be sure everything is up to date
CTRL+o then [Enter] to save


apt-get upgrade
CTRL+x to exit
apt-get dist-upgrade


Optional: Set static IP address
Install the following and retrieve the key from the repro


  nano /etc/network/interfaces
  sudo apt install apt-transport-https gnupg


Make changes similar to this:
wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -


auto eth0
'''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.'''
iface eth0 inet static
  address 192.168.1.10
  netmask 255.255.255.0
  gateway 192.168.1.1
  dns-nameservers 192.168.1.1


Reboot server if needed
sudo apt update


Install Zoneminder
Install Zoneminder


  apt-get install zoneminder
  sudo apt install zoneminder


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


You may need to install "extra" VLC components (I will check this and edit as needed)
sudo adduser www-data video


apt-get install libvlc-dev libvlccore-dev vlc
Enable and start Zoneminder


Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)
sudo systemctl enable zoneminder.service
sudo systemctl start zoneminder


This next step creates a file which contained the MySQL user and password. Otherwise you will have to enter the user and password on the command line which is not secure!
Enable Apache Modules


Go to the root directory
sudo a2enconf zoneminder
sudo a2enmod rewrite
   
   
  cd ~
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


Create a hidden password file
sudo nano /etc/php/7.3/fpm/php.ini


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


Enter this content (but use your MySQL root password!)
cgi.fix_pathinfo=0


[client]
Remember to remove the leading ;
user=root
password=(mysqlpass)


Ctrl+o Enter to save
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
CTRL+x to exit


Create database (press ENTER after each command)
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 -


mysql < /usr/share/zoneminder/db/zm_create.sql
'''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.'''


  mysql -e "grant select,insert,update,delete,create on zm.* to 'zmuser'@localhost identified by 'zmpass';"
  sudo apt update


Remove password file
Install Zoneminder


  rm .my.cnf
  sudo apt install zoneminder


Set permissions of /etc/zm/zm.conf to root:www-data 740
Create a new user if you plan to use local (USB or capture card) cameras.


  chmod 740 /etc/zm/zm.conf
  sudo adduser www-data video
 
  chown root:www-data /etc/zm/zm.conf
 
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 Zoneminder service to start at boot
Enable and start Zoneminder


  systemctl enable zoneminder.service
  sudo systemctl enable zoneminder


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


adduser www-data video


Start Zoneminder
Edit the Ngnix default configuration.


  systemctl start zoneminder.service
  sudo nano /etc/nginx/sites-available/default


Check to see that Zoneminder is running
Locate the line "index index.html index.htm index.nginx-debian.html;" and add index.php


  systemctl status zoneminder.service
  index index.php index.html index.htm index.nginx-debian.html;


Enable CGI and Zoneminder configuration in Apache.
In the "server" section after listen [::] :80 default_Server; add
a2enmod cgi
a2enconf zoneminder


Restart Apache
include /etc/nginx/zoneminder.conf;


service apache2 restart
Ctrl+o Enter to save


*** You may be tempted to try Zoneminder at this point but there is one setting you will need to change from the web gui.  Read on!!!
CTRL+x to exit


Optional: Install Cambozola (needed if you use Internet Explorer)
Create a Zoneminder conf file


  cd /usr/src && wget http://www.andywilcock.com/code/cambozola/cambozola-latest.tar.gz
  sudo nano /etc/nginx/zoneminder.conf


tar -xzvf cambozola-latest.tar.gz
Enter the following into the zoneminder.conf file (This file was improved by databoy2k)


  replace 936 with cambozola version downloaded
  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;
        }
    }


cp cambozola-0.936/dist/cambozola.jar /usr/share/zoneminder
Ctrl+o Enter to save


You should now be able to access the web server using http://servername
CTRL+x to exit


Restart Ngnix


Open Zoneminder in web browser
sudo service nginx restart


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


Click Options
If it does not exist create


Uncheck: Check with zoneminder.com for updated versions (?) click Save
sudo nano /etc/default/fcgiwrap


Click Images tab
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.


Check Is the (optional) cambozola java streaming client installed (?) Click Save
DAEMON_OPTS=-c 10


Click Paths
Ctrl+o Enter to save


Change PATH_ZMS from /cgi-bin/nph-zms to /zm/cgi-bin/nph-zms      Click Save
CTRL+x to exit


Optional: under Paths change PATH_SWAP to /dev/shm (puts this process in RAM drive)  Click Save
then restart the fcgiwrap service.


Restart Zoneminder
sudo systemctl restart fcgiwrap


Your Zoneminder install is now ready to add cameras!
Open Zoneminder and under Options set your timezone.

Latest revision as of 12:51, 28 September 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, 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.

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

sudo timedatectl set-timezone America/New_York

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

Mariadb additional settings The default values for the database are adequate for initial setup. However, I recommend you make these changes before installing Zoneminder: Edit the Mariadb config file:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Add the following in the [mysql] area:

innodb_file_per_table = ON
innodb_buffer_pool_ size = 256M
innodb_log_file_size - 32M

CTRL+o then [Enter] to save

CTRL+x to exit

Reatart Mariadb:

sudo service mysql restart

I recommend you install mysqltuner and run it from time to time and adjust the database settings as the number of saved events grows.


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.