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 , v1.33.16 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.
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-mysql8 Docker Repository to make a container . ( This image has been created on ubuntu:eoan  with  zoneminder-master/ubuntu disco main)
I have created the above docker image and pushed to the Docker Hub.
Screenshot from 2020-01-14 23-43-41


Figure:- bkjaya1952/docker-zoneminder-master-mysql8:1.33.16 Repository at dockerhub
sudo docker create -t -p 8080:80 --shm-size=4096m --name zm --privileged=true bkjaya1952/docker-zoneminder-master-mysql8:1.33.16

sudo docker start zm

You will have to configure the running zm container for mysql 8 ,zm data base and make some changes to start apache and zoneminder during the first run .
sudo docker exec -t -i zm /bin/bash
Now you will be with in the zm container.

Make changes as follows

/etc/init.d/mysql start

chown -R www-data:www-data /var/run/zm
 
 (Making an empty root password) 

mysql

CREATE USER 'admin'@'localhost' IDENTIFIED WITH mysql_native_password BY '';

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

FLUSH PRIVILEGES ;

quit

mysqladmin -uroot -p reload

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
 
 (Making zoneminder user and password)

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 
 
service apache2 start
 
service apache2 reload 
 
 
 exit

(As the apache service and zoneminder do not in running condition , when the zm container is started , we will have to edit the file "/etc/bash.bashrc" . 
For editing , the "bash.bashrc" file  is copied to the host and copied back to the container "zm" after making changes as follows. 
You will have to make these changes at the first time running only. )

(Open the Ubuntu terminal at the host)
sudo docker cp zm:/etc/bash.bashrc ~/Downloads ( Here i have copied the file to the Downloads folder of the computer)
(If go the Downloads folder, you can see the copied "bash.bashrc" file)

(In order to make changes to "bash.bashrc")

sudo chmod -R 777 ~/Downloads/bash.bashrc

sudo gedit ~/Downloads/bash.bashrc
 
 
(Now enter the following two lines at the bottom of the opened “bash.bashrc” file and save.)
Screenshot from 2020-01-14 23-10-08


Figure:- Edited “bash.bashrc” file

/etc/init.d/apache2 start

/usr/bin/zmpkg.pl start


(To copy back the edited “bash.bashrc” to /etc/ of the container “zm” , run the following command on the terminal)

sudo docker cp ~/Downloads/bash.bashrc zm:/etc/

(Now you can restart the container to see whether the zoneminder is active as follows)

sudo docker restart zm

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


http://localhost:8080/zm/

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


Figure:- ZM-Console after adding IP Cam & USB Cam
Starting & stopping of the docker container “zm” and zoneminder can be done using script files as follows.Those script files are created using the text editor and saved in Document directory.
Starting process  consists  of two script files , namely zmdockerstart.sh and zmdostart.sh .
When the zmdostart.sh is executed , it redirects to  the core file zmdockerstart.sh , which
is having scripts to start ” zm ” container , and to start services apache and zoneninder. The command “docker exec -t -i am /bin/bash” starts the services apache aand zoneminder .
Note:- The script file “zmdockerstart.sh” alone can’t start services apache and zoneninder. Therefore, an additional  redirecting script file “zmdostart.sh” has to introduced.


Screenshot from 2020-01-16 11-04-15
Initiatating srater script ( file zmdostart.sh)
Figure:-2 Starting script files  zmdockerstart.sh & zmdostart.sh

Stopping script

Screenshot from 2020-01-15 22-54-27
Screenshot from 2020-01-16 11-04-45


Figure:-2 Starting script files  zmdockerstart.sh & zmdostart.sh

Stopping script

Screenshot from 2020-01-15 22-54-27
Figure:-3 Stopping script file zmdockerstop.sh


Making files executable


sudo chmod +x ~/Documents/zmdockerstart.sh
sudo chmod +x ~/Documents/ zmdockerstop.sh
sudo chmod +x ~/Documents/ zmdostart.sh
The  sudo privileges have given to the above files using “sudo visudo ” on the Ubuntu terminal and adding the files in /etc/sudoers file as follows
sudo visudo
Screenshot from 2020-01-16 09-32-33


Figure:-4 Adding script file paths to /etc/sudoers.tmp ( to give sudo privileges to script files



Screenshot from 2020-01-16 11-05-30

Figure:-5 Stater buttons are created on the dock using Manmenu software
Screenshot from 2020-01-15 22-56-30
Figure:-6 Start  & Stop buttons on the Dock

(Note:- Each time , you start the container ,you will have to run ” sudo docker exec -t -i zm /bin/bash” after “sudo docker start zm” to get the ZM Console) (To use msmtp for emailing please refer https://hub.docker.com/repository/docker/bkjaya1952/docker-zoneminder-master)
The  details on composing the image can be get from the the following link
How to Build a Zoneminder-master Docker-Image with MYSQL 8 & MSMTP

How to uninstall the setup
How to uninstall the Docker container:-


On the Ubuntu terminal
sudo docker rm zm
How to uninstall the Repository :-
sudo docker rmi bkjaya1952/docker-zoneminder-master-mysql8:1.33.16

Comments

Popular posts from this blog

How to install ivms4200-linux docker image on Ubuntu 19.10 (eoan)

how to use bkjaya1952/smath-studio (a docker repository of SMath Studio-0.99.7030) on Ubuntu 19.10 (eoan)

A Solution to the installation problem of ZONEMINDER,v1.33.14.ON UBUNTU 19.10 (Eoan Ermine) using Mriadb instead of mysql-server-8.0