Skip to content

Zoneminder & LXC Install and Container

Install LXC on host

apt-get install lxc

Show possible lxc container OS'es

ls -la /usr/share/lxc/templates/

Create an LXC container and run it.

Container type from selection out of list.

lxc-create -n <container-name> -t download

Container immediate of type ubuntu.

lxc-create -n <container-name> -t ubuntu

Start the container.

lxc-start -n <container-name>

Attach console to the container.

lxc-attach -n <container-name>

Fix perl warnings.

locale-gen "en_US.UTF-8"
locale-gen "nl_NL.UTF-8"

Install ZoneMinder

apt install zoneminder

Configure and install database on MySQL

Add mysqld config file /etc/mysql/mysql.conf.d/mysqld-zoneminder.cnf with content

[mysqld]
#
# * Basic Settings
#
sql_mode = NO_ENGINE_SUBSTITUTION

Add .my.cnf file too root home directory for not having to login into mysql.

[client]
user = root
host = localhost
password = <password>
default-character-set=utf8

Install zoneminder SQL database

mysql /usr/share/zoneminder/db/zm_create.sql

Set permissions on the database.

mysql -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"

Make the permission happen??

mysqladmin reload

Configure Apache

chmod 740 /etc/zm/zm.conf
chown root:www-data /etc/zm/zm.conf
adduser www-data video
a2enmod cgi
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
systemctl enable zoneminder
service zoneminder start

Set the system time zone aotherwise authentication an streaming does not work. Website and system timezone must be the same.

dpkg-reconfigure tzdata

Add timezone to php config file /etc/php/<version>/apache2/php.ini

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Amsterdam

Zoneminder monitor config for Amovision AM-Q630M

Source Type = Ffmpeg
Analysis FPS    25.00
Maximum FPS (?) 25.00
Alarm Maximum FPS (?)   25.00

Ubuntu 18.04 install script

#!/bin/sh
clear
read -p "This script installs Zoneminder 1.32.x on Ubuntu 18.04 AMD64 with LAMP (MySQL) installed...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "You must be logged in as root using sudo su ...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "Next we will add the PPA repository, install and configure the system to run Zoneminder. 
Press enter to continue" nothing
apt install -y software-properties-common
clear
add-apt-repository --ppa ppa:iconnor/zoneminder-1.32
apt update
clear
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Install complete.Press enter to continue" nothing
clear