Debian Buster install procedure for Zoneminder 1.34.x

Forum for questions and support relating to the 1.34.x releases only.
bbunge
Posts: 2660
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Debian Buster install procedure for Zoneminder 1.34.x

Post by bbunge » Mon Jan 20, 2020 3:34 pm

I have updated the install procedure for Debian Buster to Zoneminder 1.34.x. In addition I have added a procedure to use NGINX on Buster.

See https://wiki.zoneminder.com/Debian_10_B ... om_ZM_Repo

BTW, The NGINX install works GREAT on my Pi 3b+! NGINX sure seems faster than Apache2.

Edit: Folks, please keep in mind that these procedures are for a new install of Zoneminder on Debian Buster. I have not addressed upgrades on the WIKI.
Last edited by bbunge on Wed Jan 22, 2020 4:20 pm, edited 1 time in total.

CountyLine
Posts: 63
Joined: Thu Aug 29, 2019 5:22 pm
Location: USA

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by CountyLine » Tue Jan 21, 2020 4:07 pm

The update did not work for me. I tried installing 1.34 on a spare Debian 10 box running Sid. It has an i7 with 16 gigs of ram. It previously ran 1.32.3. Results of the 1.34 installation at the end of this post.

I currently have 1.33.14 running on a similar Debian 10 installation without any problems. I was not happy to see the 1.33 installation instructions nuked in the Wiki. I now have no way to reinstall 1.33 should anything happen to that box.

The "updated" 1.34 instructions appear to either be missing pieces or the normal Apache version is mixed with the ngnix version. There is no adduser www-data video instruction in the Apache version, among other things. I tried adding that and what seemed to be the other missing bits but it made absolutely no difference.

Browser results of the new version shown next. It displays the php code, nothing else. Note, I have virtually no php experience, so can't really decipher what is going on here. I am using the same browser and machine that works fine to display the 1.33.14 version.

Code: Select all

<?php
//
// ZoneMinder main web interface file, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
// 
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// 

error_reporting(E_ALL);

$debug = false;
if ( $debug ) {
  // Use these for debugging, though not both at once!
  phpinfo(INFO_VARIABLES);
  //error_reporting( E_ALL );
}

// Use new style autoglobals where possible
if ( version_compare(phpversion(), '4.1.0', '<') ) {
  $_SESSION = &$HTTP_SESSION_VARS;
  $_SERVER = &$HTTP_SERVER_VARS;
}

// Useful debugging lines for mobile devices
if ( false ) {
  ob_start();
  phpinfo(INFO_VARIABLES);
  $fp = fopen('/tmp/env.html', 'w+');
  fwrite($fp, ob_get_contents());
  fclose($fp);
  ob_end_clean();
}

require_once('includes/config.php');
require_once('includes/session.php');
require_once('includes/logger.php');
require_once('includes/Server.php');
require_once('includes/Storage.php');
require_once('includes/Event.php');
require_once('includes/Group.php');
require_once('includes/Monitor.php');

if (
  (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
  or
  (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
) {
  $protocol = 'https';
} else {
  $protocol = 'http';
}
define('ZM_BASE_PROTOCOL', $protocol);

// Absolute URL's are unnecessary and break compatibility with reverse proxies 
// define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_HOST'] );

// Use relative URL's instead
define('ZM_BASE_URL', '');

require_once('includes/functions.php');
if ( $_SERVER['REQUEST_METHOD'] == 'OPTIONS' ) {
  ZM\Logger::Debug("OPTIONS Method, only doing CORS");
  # Add Cross domain access headers
  CORSHeaders();
  return;
}

if ( isset($_GET['skin']) ) {
  $skin = $_GET['skin'];
} else if ( isset($_COOKIE['zmSkin']) ) {
  $skin = $_COOKIE['zmSkin'];
} else if ( defined('ZM_SKIN_DEFAULT') ) {
  $skin = ZM_SKIN_DEFAULT;
} else {
  $skin = 'classic';
}

if ( ! is_dir("skins/$skin") ) {
  $skins = array_map('basename', glob('skins/*', GLOB_ONLYDIR));

  if ( !in_array($skin, $skins) ) {
    ZM\Error("Invalid skin '$skin' setting to ".$skins[0]);
    $skin = $skins[0];
  }
}

if ( isset($_GET['css']) ) {
  $css = $_GET['css'];
} else if ( isset($_COOKIE['zmCSS']) ) {
  $css = $_COOKIE['zmCSS'];
} else if ( defined('ZM_CSS_DEFAULT') ) {
  $css = ZM_CSS_DEFAULT;
} else {
  $css = 'classic';
}

if ( !is_dir("skins/$skin/css/$css") ) {
  $css_skins = array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR));
  if ( count($css_skins) ) {
    if ( !in_array($css, $css_skins) ) {
      ZM\Error("Invalid skin css '$css' setting to " . $css_skins[0]);
      $css = $css_skins[0];
    } else {
      $css = '';
    }
  } else {
    ZM\Error("No css options found at skins/$skin/css");
    $css = '';
  }
}

define('ZM_BASE_PATH', dirname($_SERVER['REQUEST_URI']));
define('ZM_SKIN_PATH', "skins/$skin");
define('ZM_SKIN_NAME', $skin);

$skinBase = array(); // To allow for inheritance of skins
if ( !file_exists(ZM_SKIN_PATH) )
  ZM\Fatal("Invalid skin '$skin'");
$skinBase[] = $skin;

zm_session_start();

if (
  !isset($_SESSION['skin']) ||
  isset($_REQUEST['skin']) ||
  !isset($_COOKIE['zmSkin']) ||
  ($_COOKIE['zmSkin'] != $skin)
) {
  $_SESSION['skin'] = $skin;
  setcookie('zmSkin', $skin, time()+3600*24*30*12*10);
}

if (
  !isset($_SESSION['css']) ||
  isset($_REQUEST['css']) ||
  !isset($_COOKIE['zmCSS']) ||
  ($_COOKIE['zmCSS'] != $css)
) {
  $_SESSION['css'] = $css;
  setcookie('zmCSS', $css, time()+3600*24*30*12*10);
}

# Only one request can open the session file at a time, so let's close the session here to improve concurrency.
# Any file/page that sets session variables must re-open it.

require_once('includes/lang.php');

# Running is global but only do the daemonCheck if it is actually needed
$running = null;

# Add Cross domain access headers
CORSHeaders();

// Check for valid content dirs
if ( !is_writable(ZM_DIR_EVENTS) ) {
  ZM\Warning("Cannot write to event folder ".ZM_DIR_EVENTS.". Check that it exists and is owned by the web account user.");
}

# Globals
$action = null;
$error_message = null;
$redirect = null;
$view = null;
$user = null;
if ( isset($_REQUEST['view']) )
  $view = detaintPath($_REQUEST['view']);


# Add CSP Headers
$cspNonce = bin2hex(openssl_random_pseudo_bytes(16));

$request = null;
if ( isset($_REQUEST['request']) )
  $request = detaintPath($_REQUEST['request']);

require_once('includes/auth.php');
session_write_close();

foreach ( getSkinIncludes('skin.php') as $includeFile ) {
  require_once $includeFile;
}

if ( isset($_REQUEST['action']) )
  $action = detaintPath($_REQUEST['action']);

# The only variable we really need to set is action. The others are informal.
isset($view) || $view = NULL;
isset($request) || $request = NULL;
isset($action) || $action = NULL;

if ( (!$view and !$request) or ($view == 'console') ) {
  // Verify the system, php, and mysql timezones all match
  date_default_timezone_set(ZM_TIMEZONE);
  check_timezone();
}

ZM\Logger::Debug("View: $view Request: $request Action: $action User: " . ( isset($user) ? $user['Username'] : 'none' ));
if (
  ZM_ENABLE_CSRF_MAGIC &&
  ( $action != 'login' ) &&
  ( $view != 'view_video' ) &&
  ( $view != 'image' ) &&
  ( $request != 'control' ) && 
  ( $view != 'frames' ) && 
  ( $view != 'archive' )
) {
  require_once('includes/csrf/csrf-magic.php');
  #ZM\Logger::Debug("Calling csrf_check with the following values: \$request = \"$request\", \$view = \"$view\", \$action = \"$action\"");
  csrf_check();
}

# Need to include actions because it does auth
if ( $action and !$request ) {
  if ( file_exists('includes/actions/'.$view.'.php') ) {
    ZM\Logger::Debug("Including includes/actions/$view.php");
    require_once('includes/actions/'.$view.'.php');
  } else {
    ZM\Warning("No includes/actions/$view.php for action $action");
  }
}

# If I put this here, it protects all views and popups, but it has to go after actions.php because actions.php does the actual logging in.
if ( ZM_OPT_USE_AUTH and (!isset($user)) and ($view != 'login') and ($view != 'none') ) {
  /* AJAX check  */
  if ( !empty($_SERVER['HTTP_X_REQUESTED_WITH'])
    && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) {
    header('HTTP/1.1 401 Unauthorized');
    exit;
  }
  ZM\Logger::Debug('Redirecting to login');
  $view = 'none';
  $redirect = ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=login';
  $request = null;
} else if ( ZM_SHOW_PRIVACY && ($view != 'privacy') && ($view != 'options') && (!$request) && canEdit('System') ) {
  $view = 'none';
  $redirect = ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=privacy';
  $request = null;
}

CSPHeaders($view, $cspNonce);

if ( $redirect ) {
  ZM\Logger::Debug("Redirecting to $redirect");
  header('Location: '.$redirect);
  return;
}

if ( $request ) {
  foreach ( getSkinIncludes('ajax/'.$request.'.php', true, true) as $includeFile ) {
    if ( !file_exists($includeFile) )
      ZM\Fatal("Request '$request' does not exist");
    require_once $includeFile;
  }
  return;
}

if ( $includeFiles = getSkinIncludes('views/'.$view.'.php', true, true) ) {
  foreach ( $includeFiles as $includeFile ) {
    if ( !file_exists($includeFile) )
      ZM\Fatal("View '$view' does not exist");
    require_once $includeFile;
  }
  // If the view overrides $view to 'error', and the user is not logged in, then the
  // issue is probably resolvable by logging in, so provide the opportunity to do so.
  // The login view should handle redirecting to the correct location afterward.
  if ( $view == 'error' && !isset($user) ) {
    $view = 'login';
    foreach ( getSkinIncludes('views/login.php', true, true) as $includeFile )
      require_once $includeFile;
  }
}
// If the view is missing or the view still returned error with the user logged in,
// then it is not recoverable.
if ( !$includeFiles || $view == 'error' ) {
  foreach ( getSkinIncludes('views/error.php', true, true) as $includeFile )
    require_once $includeFile;
}
?>
Last edited by CountyLine on Tue Jan 21, 2020 5:31 pm, edited 1 time in total.

pgrunwald
Posts: 71
Joined: Mon Mar 06, 2017 9:26 pm

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by pgrunwald » Tue Jan 21, 2020 5:23 pm

Jessie to Buster first or Zoneminder 1.33.16 to 1.34.0 first?

User avatar
snake
Posts: 333
Joined: Sat May 21, 2016 2:20 am

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by snake » Tue Jan 21, 2020 6:36 pm

CountyLine wrote:
Tue Jan 21, 2020 4:07 pm
I currently have 1.33.14 running on a similar Debian 10 installation without any problems. I was not happy to see the 1.33 installation instructions nuked in the Wiki. I now have no way to reinstall 1.33 should anything happen to that box.
I agree with this. I think keeping historical installation instructions would be better for the wiki. Consider if people are using outdated OS, and are unable to upgrade for any reason. The old installation instructions have value.

But, on the other hand, it's Bbhunge doing the work, so beggar's can't be choosers. I suppose I could step in and clone his old work when he starts changing entries. Perhaps I should do that.

bbunge
Posts: 2660
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by bbunge » Tue Jan 21, 2020 7:56 pm

snake wrote:
Tue Jan 21, 2020 6:36 pm
CountyLine wrote:
Tue Jan 21, 2020 4:07 pm
I currently have 1.33.14 running on a similar Debian 10 installation without any problems. I was not happy to see the 1.33 installation instructions nuked in the Wiki. I now have no way to reinstall 1.33 should anything happen to that box.
I agree with this. I think keeping historical installation instructions would be better for the wiki. Consider if people are using outdated OS, and are unable to upgrade for any reason. The old installation instructions have value.

But, on the other hand, it's Bbhunge doing the work, so beggar's can't be choosers. I suppose I could step in and clone his old work when he starts changing entries. Perhaps I should do that.
Check the wiki history.
Edit: I guess I should expand my curt answer. Nothing is nuked in the WIKI as any edit you do saves the prior version. I have had problems adding new "pages" in the WIKI (must be a limit to the number of topics) so I learned that I could move the page to a new title and reuse it. So, in this case, the Debian 10 install for ZM 1.33.x is in the history of Debian 10 Zm 1.34. For the Ubuntu installs I recycle the pages for the versions when they go out of support. Ubuntu 20.04 will be released in April so I'll look for an older instruction and recycle it to 20.04 (not that I expect much will change between 18.04 and 20.04).
Guys, I'm doing the best I can and trying to write procedures that anyone can follow. Yes, I forget things. When you are three score and thirteen you will forget things, too! The adduser in the Buster install is an option anyway and needed only if you use local cameras. It will be added, thanks!
Last edited by bbunge on Tue Jan 21, 2020 11:08 pm, edited 1 time in total.

bbunge
Posts: 2660
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by bbunge » Tue Jan 21, 2020 9:11 pm

pgrunwald wrote:
Tue Jan 21, 2020 5:23 pm
Jessie to Buster first or Zoneminder 1.33.16 to 1.34.0 first?
Upgrading Debian 9 to 10 will likely break Zm if wether or not if you upgrade zm. Your best bet is to backup your zm database first. Upgrade to Buster. Check to be sure you have one PHP version. Upgrade Zoneminder and if you have issues you can remove and install Zoneeminder then restore the database backup and run a zm database upgrade.

pgrunwald
Posts: 71
Joined: Mon Mar 06, 2017 9:26 pm

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by pgrunwald » Tue Jan 21, 2020 9:25 pm

Thank you!

CountyLine
Posts: 63
Joined: Thu Aug 29, 2019 5:22 pm
Location: USA

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by CountyLine » Wed Jan 22, 2020 2:31 am

bbunge wrote:
Tue Jan 21, 2020 7:56 pm

Guys, I'm doing the best I can and trying to write procedures that anyone can follow. Yes, I forget things. When you are three score and thirteen you will forget things, too!
And it is much appreciated. :D

I have bad news for you though, it doesn't get any better up here north of your three score and thirteen. :?

For example, I completely forgot about checking the Wiki edits, something I have done in the past. The good news is the basic ZM 1.34 is now running.

To get it going, I purged everything related to zoneminder, apache2, mariadb, and php from the installation and started over from scratch. I ignored the firewall bits in the DigitalOcean instructions, did not create the example database, and stopped at the end of section 3.

Actual testing will have to wait for another day.

Thanks again.

francis3
Posts: 12
Joined: Wed Jan 16, 2019 8:30 am

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by francis3 » Wed Jan 22, 2020 11:05 am

Smooth upgrade here.
I was running 1.32.3 from debian Multimedia on debian/buster

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

Pinned the zoneminder package in /etc/apt/preferences

Code: Select all

Package: zoneminder*
Pin: release o=ZoneMinder
Pin-Priority: 1001

Everything seems fine! :-D
Thanks bbunge!

regards,
francis3

lbm
Posts: 52
Joined: Mon Mar 26, 2018 7:44 pm

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by lbm » Wed Jan 22, 2020 12:06 pm

Worked here, upgrading from 1.33.16.
I had to do this though.

Code: Select all

systemctl stop zoneminder
killall /usr/bin/perl
zmupdate.pl
Remove the commend, for "User" under: /lib/systemd/system/zoneminder.service , and reload systemd daemon, else it would throw the following error.:

Code: Select all

Jan 22 12:56:25 zoneminder systemd[1]: zoneminder.service: New main PID 24046 does not belong to service, and PID file is not owned by 
root. Refusing.
Jan 22 12:56:25 zoneminder systemd[1]: zoneminder.service: New main PID 24046 does not belong to service, and PID file is not owned by 
root. Refusing.

Code: Select all

systemctl daemon-reload
systemctl start zoneminder

bodgit
Posts: 7
Joined: Sat Sep 28, 2019 12:38 pm
Location: St Lucia West Indies

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by bodgit » Sun Feb 09, 2020 5:36 pm

Installed 1.34.0 on a Raspberry pi 4 running a clean install of Rasbian using https://wiki.zoneminder.com/Debian_10_B ... om_ZM_Repo.
No problems, but ZM says 1.34.2 is out and a look at the repo confirms that. However sudo apt update and sudo apt upgrade keep the same version.
Anybody any ideas ??

m3lab
Posts: 11
Joined: Mon Jul 14, 2014 9:41 pm

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by m3lab » Sun Feb 09, 2020 5:52 pm

THANKS A lot for your clear instructions!

Installed now on a RPI3b with nginx and ZM 1.34.0 works...

Just a question: I see that on the repo there are all files for 1.34.2 but not .deb: is it intentionally missed or is it an error?

CountyLine
Posts: 63
Joined: Thu Aug 29, 2019 5:22 pm
Location: USA

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by CountyLine » Sun Feb 09, 2020 7:36 pm

m3lab wrote:
Sun Feb 09, 2020 5:52 pm
THANKS A lot for your clear instructions!

Installed now on a RPI3b with nginx and ZM 1.34.0 works...

Just a question: I see that on the repo there are all files for 1.34.2 but not .deb: is it intentionally missed or is it an error?
A 1.34.2 deb recently became available for amd64. I suspect the PI stuff just hasn't been built yet.

bbunge
Posts: 2660
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by bbunge » Sun Feb 09, 2020 8:28 pm

bodgit wrote:
Sun Feb 09, 2020 5:36 pm
Installed 1.34.0 on a Raspberry pi 4 running a clean install of Rasbian using https://wiki.zoneminder.com/Debian_10_B ... om_ZM_Repo.
No problems, but ZM says 1.34.2 is out and a look at the repo confirms that. However sudo apt update and sudo apt upgrade keep the same version.
Anybody any ideas ??
Zmrepo was set up to do the /debian/master automatically. However, the new release is under /debian/zoneminder-1.34 which requires a manual update. I've noticed that the amd64 version is up to date but the armhf and arm64 have yet to be built for 1.34.2. The dev is busy and I really do not like to bug him too much...

cyclic
Posts: 23
Joined: Mon Jan 26, 2009 7:01 pm
Location: The deep south

Re: Debian Buster install procedure for Zoneminder 1.34.x

Post by cyclic » Thu Feb 13, 2020 11:11 am

bbunge,
I would not want you to upset the devs but
Please do you know when a new pi4 1.34.2 build will be done?

I have 1.34.0 up an running on raspian but it has some issues which matter.
I would not want to raise them on the forum as it is not a current release
and so it would waste people's time.
They are probably sorted in 1.34.2.
cyclic_redundancy_check

Post Reply

Who is online

Users browsing this forum: SkippyDo and 10 guests