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

From ZoneMinder Wiki
Jump to navigationJump to search
Line 108: Line 108:
Replace the contents with:
Replace the contents with:


  # Remember to enable cgi mod (i.e. "a2enmod cgi").
########################
#
  # Remember to enable cgi mod and serve-cgi-bin.conf configuration
#
# a2enmod cgi
# a2enconf serve-cgi-bin.conf
#
########################
# Order matters. This alias must come first.
Alias /zm/cache /var/cache/zoneminder
<Directory /var/cache/zoneminder>
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>


    # Order matters. This alias must come first.
Alias /zm /usr/share/zoneminder/www
    Alias /zm/cache /var/cache/zoneminder
<Directory /usr/share/zoneminder/www>
    <Directory /var/cache/zoneminder>
#  php_flag register_globals off
        Options -Indexes +FollowSymLinks
  Options -Indexes +FollowSymLinks
        AllowOverride None
  <IfModule mod_authz_core.c>
        <IfModule mod_authz_core.c>
            Require all granted
          # Apache 2.4
  </IfModule>  
          Require all granted
</Directory>
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>


    Alias /zm /usr/share/zoneminder/www
ScriptAlias /cgi-bin "/usr/lib/zoneminder/cgi-bin"
    <Directory /usr/share/zoneminder/www>
<Directory "/usr/lib/zoneminder/cgi-bin">
        Options -Indexes +FollowSymLinks
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        AllowOverride All
    AllowOverride All
        <IfModule mod_authz_core.c>
    Require all granted
          # Apache 2.4
</Directory>
          Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>


    ScriptAlias /cgi-bin /usr/lib/zoneminder/cgi-bin
<Directory "/usr/share/zoneminder/www/api">
    <Directory /usr/lib/zoneminder/cgi-bin>
    RewriteEngine on
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    RewriteRule ^$ app/webroot/ [L]
        AllowOverride All
    RewriteRule (.*) app/webroot/$1 [L]
        <IfModule mod_authz_core.c>
    RewriteBase /zm/api
          # Apache 2.4
</Directory>
          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
<Directory "/usr/share/zoneminder/www/api/app">
    # default .htaccess files included with the CakePHP project.
     RewriteEngine on
    # Parameters not set here are inherited from the parent directive above.
    RewriteRule ^$ webroot/ [L]
    <Directory /usr/share/zoneminder/www/api>
    RewriteRule (.*) webroot/$1 [L]
      RewriteEngine on
     RewriteBase /zm/api
      RewriteRule ^$ app/webroot/ [L]
</Directory>
      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 @ZM_LOGDIR@/apache-error.log
    ErrorLog /var/log/apache2/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 @ZM_LOGDIR@/apache-access.log combined
    CustomLog /var/log/apache2/zm-access.log combined


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


Ctrl+o Enter to save
Ctrl+o Enter to save

Revision as of 15:25, 20 July 2019

Debian 10 Buster with Zoneminder 1.32.3 from the Debian Multimedia Repository

Install Debian Buster. I used the net install CD and installed only SSH server and standard system utilities from tasksel.

You will need to install LAMP. One good guide to do this can be found here:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-debian-10

Install Zoneminder

Add the Deb Multimedia repository. (instructions at: https://deb-multimedia.org/)

Edit sources.list

sudo nano /etc/apt/sources.list

Add to the end of the file:

deb http://www.deb-multimedia.org buster main non-free

Ctrl+o Enter to save

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.

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

Install Zoneminder

sudo apt install zoneminder vlc-plugin-base 


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

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

Set permissions

sudo chmod 740 /etc/zm/zm.conf
sudo chown root:www-data /etc/zm/zm.conf
sudo chown -R www-data:www-data /usr/share/zoneminder/
sudo chown -R www-data:www-data /var/cache/zoneminder/

Enable Zoneminder service to start at boot

sudo systemctl enable zoneminder.service

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

sudo adduser www-data video

Start Zoneminder

sudo systemctl start zoneminder.service

Check to see that Zoneminder is running

sudo systemctl status zoneminder.service

Enable CGI and Zoneminder configuration in Apache.

sudo a2enmod cgi
sudo a2enmod rewrite
sudo a2enconf zoneminder

Add timezone to PHP

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

Note: 20JUL19 - A fix for the below was submitted to deb-multimedia but the fix has errors in it.

You need to Edit zoneminder.conf.

First make a copy of zoneminder.conf

sudo cp /etc/apache2/conf-enabled/zoneminder.conf /etc/apache2/conf-enabled/zoneminder.sav

Next, edit the file

sudo nano /etc/apache2/conf-enabled/zoneminder.conf

Replace the contents with:

########################
#
# Remember to enable cgi mod and serve-cgi-bin.conf configuration
#
# a2enmod cgi
# a2enconf serve-cgi-bin.conf
#
########################
# Order matters. This alias must come first.
Alias /zm/cache /var/cache/zoneminder
<Directory /var/cache/zoneminder>
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
#  php_flag register_globals off
  Options -Indexes +FollowSymLinks
  <IfModule mod_authz_core.c>
           Require all granted
  </IfModule> 
</Directory>
ScriptAlias /cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Require all granted
</Directory>
<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> 

Ctrl+o Enter to save

CTRL+x to exit

Restart Apache

sudo service apache2 restart

All done! Navigate to http://serverip/zm