HOW TO INSTALL ZONEMINDER -master ON UBUNTU 19.10 (eoan), with mysql 8

Today, Mr. Isaac Connor has published the  first successful Zoneminder-master-eoan  package for Ubuntu 19.10. in his website . 

Installation of Zoneminder To install Zoneminder Please refer Connor’s web site Open the terminal and run following commands.

sudo su

add-apt-repository ppa:iconnor/zoneminder-master

apt install zoneminder
rm /etc/mysql/my.cnf

cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf

sed -i "15i default_authentication_plugin= mysql_native_password" /etc/mysql/my.cnf

/etc/init.d/mysql start

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql

mysql

CREATE USER 'zmuser'@localhost IDENTIFIED WITH mysql_native_password BY 'zmpass';

GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES ;

quit

mysqladmin -uroot -p reload

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

service apache2 reload

Open zoneminder web console (http://localhost/zm/)

 

Screenshot from 2020-01-23 10-17-45

Figure :- Montage of 2 cameras after adding USB Cam & IP Cam
You can see the USB camera  and a Hikvision IP camera are  working in the above figure

Note:- If there is a user in the same name , you will  get an error ( ERROR 1396 (HY000)) ,when creating mysql user with “CREATE USER” .  In that case please replace “CREATE USER” with  “ALTER USER” .
If you get “MySQL: “Access denied for user ‘debian-sys-maint’@’localhost’”” when updating zoneminder , you can correct it by making following changes.
On the Ubuntu terminal
sudo gedit /etc/mysql/debian.cnf
Then you can see the automatically generated debian password for mysql
as follows in the opened “debian.cnf” file
( In your case , you may  get a different password)

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = s4bSHUP05s1J32G5
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = s4bSHUP05s1J32G5
socket = /var/run/mysqld/mysqld.sock

Now you will have to grant permissions to ‘debian-sys-maint’@’localhost’” as follows
sudo su

mysql
ALTER USER 'debian-sys-maint'@localhost IDENTIFIED WITH mysql_native_password BY 's4abSHUP05s1J32G5';
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' WITH GRANT OPTION;

quit

sudo /etc/init.d/mysql restart

How to Build a Zoneminder-master Docker-Image with MYSQL 8 & MSMTP

We observed that most of the Linux software have compatibility problems due to dependency issues when operating systems are upgraded.  To overcome dependency issues and to avoid conflicts with the default system structure of the OS , the Docker-images play an important role.

Since the official Zoneminder eoan has Dependency wait on lgw01-amd64-051 , I thought of developing a docker-image  with MYSQL 8 & MSMTP and push to docker hub  .

This docker image is structured based on the basic concepts in my earlier post on How to install Zoneminder , ( v1.33.16.) with Mysql 8 on Ubuntu 19.10

This image is created on ubuntu:eoan  with zoneminder-master/ubuntu disco main

In the Dockerfile , Ubuntu environment used is ubuntu:eoan. deb

For Zoneminder ppa used is http://ppa.launchpad.net/iconnor/zoneminder-master/ubuntu disco main .

Therefore libmysqlclient20 has to be installed to overcome when  zoneminder-eoan is installing on ubuntu:eoan .

When composing the zoneminder docker image , we are placing the Dockerfile, entrypoint.sh and the downloaded libmysqlclient20_5.7.27-0ubuntu0.19.04.1_amd64.deb files in the same folder .  The folder that I have used  is ~/Documents/zm-docker-d2 .  You can select any folder. Please see the Figure below.

Screenshot from 2020-01-15 08-41-44

Figure:- 1 Dockerfile, entrypoint.sh and libmysqlclient20 at the folder ~/Documents/zm-docker-d2

Installation of Docker on Ubuntu 19.10

On the Ubuntu terminal

sudo apt install docker.io

Then open the Ubuntu terminal

Go the folder where the Dockerfile , entrypoint.sh and libmysqlclient20 are placed

( Note:-

The Dockerfile  and  entrypoint.sh can be copied from the following my post at GitHub

https://github.com/bkjaya2020/bkjaya1952-docker-zoneminder-master-mysql8-   )

On the Ubuntu teminal

 

docker build --tag=mysql8zm . # Dockerfile

( The name tag given for the image is mysql8zm. you can give any name)

Screenshot from 2020-01-14 17-49-47

Figure:-2

Screenshot from 2020-01-14 17-50-55.png

Figure:-3

Now you  can see from the above figure ,the docker-image “mysql8zm” , has been created successfully.

sudo docker images

Screenshot from 2020-01-14 17-51-56

Figure:-4  The created docker-zoneminder image  “mysql8zm” after completion of compose

Tagging the image and pushing to the docker hub

first you will have to signup & open  a Docker Hub account at https://hub.docker.com/

Then login to the Docker Hub account

sudo docker login

sudo docker tag mysql8zm bkjaya1952/docker-zoneminder-master-mysql8:1.33.16

sudo docker push bkjaya1952/docker-zoneminder-master-mysql8:1.33.16

 

Screenshot from 2020-01-14 21-00-51

figure:- 5  Tagging  & pushing  the image to the Docker hub

Screenshot from 2020-01-14 23-43-41

Figure:- 6 The pushed bkjaya1952/docker-zoneminder-master-mysql8:1.33.16 Repository at the Docker hub

The installation details of the docker-zoneminder-master-mysql8:1.33.16 can be obtained from the following links.

https://hub.docker.com/r/bkjaya1952/docker-zoneminder-master-mysql8

https://bkjaya.wordpress.com/2020/01/14/how-to-install-zoneminder-master-docker-v1-33-16-with-mysql-8-msmtp-on-ubuntu-19-10-eoan-ermine/

 

 

 

 

 

 

 

How to install Zoneminder-master- Docker , with Mysql 8 ,MSMTP on Ubuntu 19.10 (Eoan Ermine)

In this tutorial ,we are going to use “Docker: Enterprise Container Platform”  (docker.io) on Ubuntu 19.10.

First

Installation of Docker on Ubuntu 19.10

On the Ubuntu terminal

sudo apt install docker.io

Then use , bkjaya1952/docker-zoneminder-master-mysql8 Docker Repository to make a container . ( This image has been created on ubuntu:eoan  with  zoneminder-master/ubuntu eoan main)

I have created the above docker image and pushed to the Docker Hub.

Screenshot from 2020-02-19 09-00-46

Figure:- bkjaya1952/docker-zoneminder-master-mysql8:latest Repository at dockerhub

For installation procedure , please refer the following link

https://hub.docker.com/r/bkjaya1952/docker-zoneminder-master-mysql8

Zoneminder-master , latest. docker image with Mysql 8 & MSMTP

This image has been created on ubuntu:eoan with zoneminder-master/ubuntu eoan main To pull the Repository from the dockerhub please refer the following link

https://hub.docker.com/r/bkjaya1952/docker-zoneminder-master-mysql8

Usage :

To create a Zonminder-master docker container (name zm)with mysql 8 & msmtp

On the Ubuntu terminal enter the following commands

sudo docker create -t -p 8080:80 --shm-size=4096m --name zm --privileged=true bkjaya1952/docker-zoneminder-master-mysql8:latest
sudo docker start zm

(You will have to configure the running zm container for mysql 8 ,zm data base and make some changes to timezone only  for the first run .)

sudo docker exec -t -i zm /bin/bash

(Now you will be with in the zm container.

Make changes as follows)

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql 

CREATE USER 'zmuser'@localhost IDENTIFIED WITH mysql_native_password BY 'zmpass'; 

GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION; 

FLUSH PRIVILEGES ;

quit 

mysqladmin -uroot -p reload 

dpkg-reconfigure tzdata

Then edit your timezone

To get the ZM panel on the web browser

exit 

sudo docker restart zm 

http://localhost:8080/zm/

 

Screenshot from 2020-01-14 18-25-27

Figure:- ZM-Console after adding IP Cam & USB Cam

 

(To use msmtp for emailing please refer https://hub.docker.com/repository/docker/bkjaya1952/docker-zoneminder-master)

( The procedure of composing an image can be obtained from the following links

https://bkjaya.wordpress.com/2020/01/15/how-to-build-a-zoneminder-master-docker-image-with-mysql-8-msmtp/ )

How to install Zoneminder-master- Docker , v1.33.16 with MSMTP on Ubuntu 19.10 (Eoan Ermine)

In this tutorial ,we are going to use “Docker: Enterprise Container Platform”  (docker.io) on Ubuntu 19.10.

As , still there is on official  zoneminder issued for  Ubuntu 19.10 due dependency issues, the best option is to use docker Zoneminder  to overcome dependency problems and to avoid conflicts with the default setup of  Ubuntu 19.10

First

Installation of Docker on Ubuntu 19.10

On the Ubuntu terminal

sudo apt install docker.io

Then use , bkjaya1952/docker-zoneminder-master  Docker Repository to make a container . ( This image has been created on Ubuntu 19.04 disco )

sudo docker create -t -p 8085:80 --shm-size=4096m -e TZ=Asia/Colombo --name myzm --privileged=true bkjaya1952/docker-zoneminder-master:v1.33.16.

Note :- use your timezone instead of “TZ=Asia/Colombo”

sudo docker start myzm

For configuring MSMTP for emailing zoneminder motion detection events, please refer the following link.

https://hub.docker.com/r/bkjaya1952/docker-zoneminder-master

Open http://localhost:8085/zm/ and add the camera monitors

And fill up email details under the Optons/email of the ZM-Panel

Create appropriate zm-filter to send email alerts of motion detection events

Screenshot from 2020-01-12 11-20-09

Figure:- 1 After adding Camera monitors to ZM

 

 

 


 

The scripts of the Dockerfile are as shown in the following figure

Screenshot from 2020-01-12 11-07-16

Figure:-2 The scripts of the Dockerfile

To download the Dockerfile  https://www.dropbox.com/s/737qnv3144b52bi/Dockerfile?dl=0

To download the entrypoint.sh https://www.dropbox.com/s/m5lgf2d196a4f5s/entrypoint.sh?dl=0

Please refer my following blog to know about the building an image and pushing to the Docker Hub

https://bkjaya.wordpress.com/2019/12/20/how-to-build-a-zoneminder-docker-image-with-msmtp-using-a-dockerfile-push-to-docker-hub-ubuntu-19-10/

Acknowledgements : Based on Zoneminder and Andrew Bauer’s zonexpertconsulting@outlook.com entrypoint script

How to install Zoneminder , ( v1.33.16.) with Mysql 8 on Ubuntu 19.10

Since the official Zoneminder eoan has Dependency wait on lgw01-amd64-051 , We will have to install Zoneminder disco  on Ubuntu 19.10.

There is a problem in the present PHP release which make errors with the “caching_sha2_password” introduced in the Mysql 8 by default .
Please refer the following link
https://www.php.net/manual/en/mysqli.requirements.php
Therefore , we will have to use “mysql_native_password” method in Mysql 8.

First of all we will have to install mysql-server-8 on Ubuntu 19.10 and enable mysql_native_password

The installation  of mysql-server-8.0 can be done using the synaptic package manager .

Screenshot from 2020-01-03 22-46-01

Figure:-1 Installed mysql-server-8 shown in synaptic package manager

Then open the Ubuntu terminal

sudo su

rm /etc/mysql/my.cnf
cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf

gedit /etc/mysql/my.cnf

Then enter the following line below [mysqld] on the opened my.cnf file and save the file

[mysqld]

default_authentication_plugin= mysql_native_password

Screenshot from 2020-01-04 00-20-27

Figure:-2  Amended  /etc/mysql/my.cnf

Then on the Ubuntu terminal

systemctl restart mysql

Then enter the following commands on the terminal to set root password for mysql server

mysql 
CREATE USER 'admin'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your password';

GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES ;

quit

systemctl restart mysql

 

 

 

Then install Zoneminder

The Zoneminder disco deb file is downloaded from https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/18492553/+files/zoneminder_1.33.16~20191229135312-disco_amd64.deb

GDebi Package Installer can be used to install the Zoneminder disco deb file

Before installing Zoneminder disco deb file to overcome dependency issues we will have to  download libmysqlclient20and install first  using the GDebi Package Installer.

Then install Zoneminder disco deb file that we have downloaded .

Creating user and zmpass

Open the Ubuntu terminal and enter  following 5 commands

sudo su

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql

mysql


CREATE USER 'zmuser'@localhost IDENTIFIED WITH mysql_native_password BY 'zmpass';

GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES ;

quit

mysqladmin -uroot -p reload

 

It was observed that there are missing *.ini files in /etc/php/7.3/mods-available/ which will make problems in getting zoneminder Console.

Therefore the necessary files have to be copied from /usr/share/php7.3-mysql/mysql

sudo cp /usr/share/php7.3-mysql/mysql/*.ini /etc/php/7.3/mods-available/

sudo service apache2 reload

 

Screenshot from 2020-01-03 22-17-43

Figure:-3  After coping mysql*.ini files from /usr/share/php7.3-mysql/mysql/

Screenshot from 2020-01-03 22-12-15

Figure:-4 mysql*.ini files in /usr/share/php7.3-mysql/mysql/

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

 

Add timezone to PHP (  This step is not essential for Zoneminder 1.33 as you can change the TIMEZONE later under Options/System/TIMEZONE )

gedit /etc/php/7.3/apache2/php.ini
edit line 956 with your timezone
Then
sudo service apache2 reload

Open zoneminder web console (http://localhost/zm/)



Screenshot from 2020-01-03 22-31-41

Figure:-5 Zoneminder Console , after adding an Usb camera

(Note :-
In order to have  clean mysql-server-8.0 install , it is better to completely delete exiting mysql as follows 
sudo apt remove --purge mysql-server mysql-client mysql-common
sudo apt  autoremove
sudo apt autoclean 
 sudo rm -rf /etc/mysql )