How to install bkjaya1952/docker-novnc-guvcview on Ubuntu 20.04

A docker image pre-installed guvcview-inux based on guvcview and bkjaya1952/q4wine-x11vnc-novnc-docker

Refer:- http://guvcview.sourceforge.net/

Usage :-

To create a guvcview (name gvw) using bkjaya1952/docker-novnc-guvcview

Refer:- https://hub.docker.com/r/bkjaya1952/docker-novnc-guvcview

On the Ubuntu terminal

sudo docker create -t -p 8008:8080 --name gvw --privileged=true bkjaya1952/docker-novnc-guvcview
sudo docker start gvw
xdg-open http://localhost:8008/vnc_lite.html

Then the novnc desktop with q4wine will appear on the web browser at the startup.

At the first run of the docker container , you will have to run the first startup wizard to configure the q4wine as follows.

The it will automatically download wine and install.

For configuring q4wine please refer the following link

https://hub.docker.com/r/bkjaya1952/q4wine-x11vnc-novnc-docker

Figure:- 1 Press autodetect button to include drive Z: during configuring q4winehttps://raw.githubusercontent.com/bkjaya2020/bkjaya1952-docker-novnc-guvcview/master/Screenshot%20from%202020-09-09%2017-06-08.png

Figure:- 2 Right click on wine desktop to add new icon for guvcview https://raw.githubusercontent.com/bkjaya2020/bkjaya1952-docker-novnc-guvcview/master/Screenshot%20from%202020-09-09%2017-09-11.png

Figure:- 3 Fill the box as shown in the figure to connect guvcview starter at /usr/bin/guvcview in the drive Z:https://raw.githubusercontent.com/bkjaya2020/bkjaya1952-docker-novnc-guvcview/master/Screenshot%20from%202020-09-09%2017-10-46.png

Figure :- 4 guvcview USB camera stream at http://localhost:8008/vnc_lite.html

How to change the timezone

After quitting the noVNC

On the terminal enter

vim /etc/timezone

Then the timezone file is opened

Go to the top line of the file , press insert key on your key board and enter your timezone ( ie Asia/Colombo)

Then press the Esc key and Shift : x to save & quit the file

https://youtu.be/b-gl_9BAMPo

How to solve the problem of inability in creating a USB Camera moitor in Zoneminder v 1.34.17 to v 1.34.19

In the Zoneminder v1.34.17 to v1.34.19 issued up to now, can’t add USB camera monitors using the menu.

Figure:1 USB Camera monitor can’t be added

Zoneminder master versions do not have this problem.

But , USB camera can be added to Zoneminder 1.34.19 ,when you copy the codes of device format and capture pallet from Zoneminder 1,34.16 to Zoneminder 1.34.19 ,( using the Inspect Element (Q) in the web browser).

Figure:-2 After coping the codes of device format and capture pallet from Zoneminder 1,34.16 to Zoneminder 1.34.19 , USB Camera monitor can be added.

But the above solution is not a complete one as every time you add or edit the monitors , you will have to do coping the codes.

I could not find a solution from the zonminder forum .

Then I contacted Mr knight-of-ni and requested him to solve the matter . Mr knight-of-ni responded promptly and informed me that Mr Isaac Connor has already found a solution . Then he gave me the following link where the necessary codes are available , in order to correct the problem. He also informed me that , Isaac Connor will issue release 1.34.20 soon with necessary corrections . Until then we can try Isaac Connor’s codes to solve the problem as follows.

https://github.com/ZoneMinder/zoneminder/commit/c87886f5a5c0e0d2791d8f765686f0f7e64d76ab

Figure:-3 Isaac Connor’s solution to USB Camera monitor problem

How to solve the problem.

Open the Ubuntu terminal and then run

sudo gedit /usr/share/zoneminder/www/skins/classic/views/monitor.php

############################################################
Then delete the line 778 to 780
############################################################

<tr><td><?php echo translate('DeviceChannel') ?></td><td><select name="newMonitor[Channel]"><?php foreach ( $v4l2DeviceChannels as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->Channel()) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>

<tr><td><?php echo translate('DeviceFormat') ?></td><td><select name="newMonitor[Format]"><?php foreach ( $v4l2DeviceFormats as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->Format()) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>

<tr><td><?php echo translate('CapturePalette') ?></td><td><select name="newMonitor[Palette]"><?php foreach ( $v4l2LocalPalettes as $name => $value ) { ?><option value="<?php echo $value ?>"<?php if ( $value == $monitor->Palette()) { ?> selected="selected"<?php } ?>><?php echo $name ?></option><?php } ?></select></td></tr>


############################################################
Then copy and paste the codes marked in green in the file at the above link (line 778 to 779)
############################################################
<tr>

<td><?php echo translate('DeviceChannel') ?></td>

<td><?php echo htmlSelect('newMonitor[Channel]', $v4l2DeviceChannels, $monitor->Channel()); ?></td>

</tr>

<tr>

<td><?php echo translate('DeviceFormat') ?></td>

<td><?php echo htmlSelect('newMonitor[Format]', $v4l2DeviceFormats, $monitor->Format()); ?></td>

</tr>

<tr>

<td><?php echo translate('CapturePalette') ?></td>

<td><?php echo htmlSelect('newMonitor[Palette]', $v4l2LocalPalettes, $monitor->Palette()); ?></td>

</tr>

############################################################

Then save the edited monitor.php file at /usr/share/zoneminder/www/skins/classic/views/

Restart the Zoneminder.

Now the USB monitors can be added to Zoneminder 1.34.19 as usual .

Figure:-4 After making corrections using Isaac Connor’s solution to USB Camera monitor problem
Acknowledgements:-
Thanks to Mr knight-of-ni for informing me about Mr Isaac Connor's solution on USB Camera monitor problem.

How to use a mobile phone connected to Linux PC via USB cable as a web camera

We are going to use droidcam app to convert a smart mobile phone to an USB-Camera of a PC with Ubuntu 20.4.

In order to make the mobile phone as the usb-camera , following steps have to be followed.

  1. Install droidcam in the mobile phone using the Google app store .

2. Install following programmes on the PC

Install droidcam linux on the PC

sudo apt install adb

Install droidcam linux on the PC

Open the Ubuntu terminal and run follwing commands

cd /tmp/

wget https://files.dev47apps.net/linux/droidcam_latest.zip

echo "73db3a4c0f52a285b6ac1f8c43d5b4c7 droidcam_latest.zip" | md5sum -c --

If every thing is correct you will get this prompt " # OK? "

unzip droidcam_latest.zip -d droidcam && cd droidcam

sudo ./install

To start droidcam run on the Ubuntu terminal

droidcam

Please refer the following link for more details on installation.

 https://www.dev47apps.com/droidcam/linux/
Figure:-1 After installing droidcam android app on the mobile phone

Then you will have to edit DroidCam port . In this example we have changed the port to 8085

Figure:-2 Changing the DroidCam port top 8085

To change the DroidCam port you will have to open the droidcam app in the mobile phone and go to menu.

To connect the phone to the PC under the Developer options> USB debugging mode, You will have to activate the camera in to USB debugging mode .

My Phone is HWAWEI TIT-AL00

First connect the phone to the PC using the USB cable

How to get Developer options

On the phone ,Go to Settings>About phone>Build number

Tap on the Build number as per the instructions appear on the screen

Then go back to settings and see the “Developer options” appears on the settings menu

Now go to Developer options and activate USB debugging

Then allow to connect the phone to connect the PC

How to use droidcam in PC to connect the phone

In the PC , open the Ubuntu terminal and run

droidcam


Then the DroidCam client  menu will appear .
Then tick USB(Android) box and hit the start button to activate the connection  of  phone and PC through USB cable.
 
Figure:-4 Installing DroidCam on PC & Running

From the Figure:-4 you cane see the Device /dev/video is ‘Droidam’

Open the web browser and go to the following link to see the camera .

http://127.0.0.1:8085

Figure:-5 USB camera view of PC

Figure:-6 The screen of the phone when connected to PC

Note:- Other than USB cable connection ,the camera phone can be connected to PC using the wifi

How to use Serveo to view Zoneminder Console & Motion Detection events remotely – Ubuntu 20.04

Installation procedure of Docker Zoneminder Master on Ubuntu 20.04 is described in the following post.

How to install ZoneMinder Master, v1.35.4 on UBUNTU 20.04 LTS ( Focal Fossa) Using a Docker image

After the installation , the Zoneminder Console can be obtained from the following link.

http://localhost:8080/zm/

The next task is to view the Zoneminder remotely using Serveo

The Serveo is a software that can expose a local server to the internet.

There is no installation or signup required.

Serveo is an SSH server just for remote port forwarding. When a user connects to Serveo, they get a public URL that anybody can use to connect to their localhost server.

Open the Ubuntu terminal in the local computer where the Zoneminder is installed.

Let us select the name of the public url as abcd2020

sudo start zm

ssh -R abcd2020:80:localhost:8080 serveo.net

Then you get the following public url of the port forwarded (from 8080 to 80) localhost of the local pc

Forwarding HTTP traffic from https://abcd2020.serveousercontent.com
Figure:-2 Using Serveo to get the public url of the localhost:8080

Now if you copy above url to a remote computer or smart phone , you can access the localhost:8080 on the screen.

If you add /zm to the above link , you will be able to access the Zoneminder Console on the remote computer of smart phone

Figure:-3 localhost:8080 on smart phone
Figure:-4 Zoneminder Console on the smart phone

For the additional safety , It is advisable to have a password protection to the local host and the zoneminder.

——————————————————————————————————————–

How to add password protection to the localhost

It is necessary to copy the index.html file from the docker container zm to the host and edit with password protection commands and copy back to the zm container

Coping /var/www/html/index.html file from zm container to ~/Documents directory of the host pc

sudo docker cp zm:/var/www/html/index.html ~/Documents

sudo chmod 777 ~/Documents/index.html

Now edit the copied file by adding the following html scripts highlighted in red in the figure below for password protection as follows.

Figure:-5 Editing index.html for password protection
<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Password Protected page</title>
<script type="text/javascript">
var s ="";


while (s!= "yourpassword")
{
s=prompt("please enter your password");
if (s!= "yourpassword!")


{
alert("Incorrect password-Try again");


}
}
</script>
</head>


<body>
</body>
</html>
You can use gedit to edit the index.html file . The two empty white boxes at line no 16 and 19 are for your password for the localhost. You will have to fill the space with  your password and save.And then copy back to the original place in the zm container as follows
sudo docker cp ~/Documents/index.html zm:/var/www/html/index.html

Now the localhost is password protected

How to make Zoneminder password protected

Go to Options>system of the Zoneminder Console and tick the boxes as shown in the follwing figure.

Figure:-6 Zoneminder with password protection

Then go to Options>Users>admin and enter your password for Zoneminder and save. Restart Zoneminder .

Now the zoneminder is password protected.

Following are the outcome at remote smart phone when accessing Zoneminder Console after the two protections above for the localhost and the Zoneminder .

Zoneminder Console is obtained by adding /zm to the port forwarded serveo url of localhost:8080 ( In our case https://abcd2020.serveousercontent.com/zm ).

You can replace the name abcd2020 to suit your requirement.

Figure:- 9 Zoneminder Console at the remote smart phone.

You can control your Zoneminder at PC from the remote smart phone . The motion detection events can also be viewed using the smart phone.

How to install Zoneminder Docker on a qemu virtual machine with balenaOS on UBUNTU 20.04 LTS ( Focal Fossa) and view Zoneminder console remotely on balenaCloud

Balena is a latest opensource container-based platform for deploying IoT applications.

For the details please refer the following link

https://www.balena.io/

The balena is well designed to accommodate docker repositories.

The objective of this tutorial is self explanatory by the heading .

In order to simplify the procedure , the tutorial has been broken to three steps and described by three posts . Two posts have already published previously

The following are the main steps followed.

  1. Installing qemu and creating a qemu virtual machine with balenaOS on a computer with UBUNTU 20.04 operating system . Then connect the qemu device (qemu virtual machine with balenaOS) to balenaCloud

Please refer the following post to get the details

How to use a balena-cloud image in qemu emulator on UBUNTU 20.04 LTS ( Focal Fossa)

2. Install balena blena CLI on the computer with UBUNTU 20.04 operating system to interact with the balenaCloud and push balena Dash to the qemu VM mentioned in step 1 above . balena Dash helps to display any web page with a lightweight web browser.

Please refer the following post to get the details

How to install balena CLI (Command-Line Interface) on UBUNTU 20.04 LTS ( Focal Fossa) and interact with the balenaCloud

3. Install bkjaya1952/docker-zoneminder-php7.4-mysql8 on the qemu virtual machine (qemu_zm) mentioned in the step 1 & 2 above . This post describes the procedure in installing docker zoneminder on the virtual machine qemu_zm using the baenaCloud.

Step 3 – installation of docker zoneminder on qemu_zm using balenaCloud

Start the VM qemu_zm using the Virtual Machine Manager

Figure:-1 Starting VM2 (qemu_zm)

Since we are going to use the usb web camera connected to the computer , tick the camera in the window box as shown in the figure below . To get that window box press Virtual Machine button in the menu of the Virtual Machine Manager.

Logon to the balenaCloud and go to the terminal of Host OS in the balenaCloud to install docker zoneminder

Figure:- 2 balenaCloud and the running VM qemu_zm in Virtual Machine manager
Figure:-4 expanded view of the terminal

Login to balena

On the terminal of Host OS shown in the Figure:-4

enter

balena login

Note:- Use your docker hub user name and password to above login

Figure:-5 Login to balena to pull docker zoneminder

Now we are going to pull bkjaya1952/docker-zoneminder-php7.4-mysql8 from docker hub

balena create -t -p 80:80 --shm-size=4096m --name zm --network=host --privileged=true bkjaya1952/docker-zoneminder-php7.4-mysql8:1.34.21

balena start zm

balena exec -t -i zm /bin/bash

(Now you will be with in the zm container.
Make changes as follows)
Configuring Mysql and Changing root password)

mysql

ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';

FLUSH PRIVILEGES ;

quit

(Creating zm sql data base)

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

mysql

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

(If CREATE does not work try with ALTER )

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

FLUSH PRIVILEGES ;

quit

mysqladmin -uroot -p reload

Then edit your timezone in the system

dpkg-reconfigure tzdata

Then edit your timezone

Then edit your time zone at /etc/php/7.4/apache2/php.ini

sed -i "961i date.timezone = Asia/Colombo" /etc/php/7.4/apache2/php.ini ( ie. Asia/Colombo )

exit

balena restart zm

Now the docker zoneminder is installation is finished .

To see the Zoneminder console , you will gave to get the Public device URL by activating red button shown in the figure 6 below on the balenaCloud panal

Figure:-6 Getting Public device URL

After pressing the red button shown in the figure 6 above , you will get the public URL of the device qemu_zm.

Go to URL and configure Zoneminder as shown in the figures below

When you add /zm to Public URL , you will get the Zoneminder panal.

Now you can configure Zoneminder as usual.

This docker zoneminder repository includes msmtp

you will have to manually create msmtprc file in /etc folder of zm container using vim as follows

balena exec -t -i zm /bin/bash

cd /etc

apt update

apt install vim

vim msmtprc

Then enter the gmail details in msmtprc and save

Please refer the following link to get the details of commands in masmtp file

How to use MSMTP as email software in Zoneminder (v1.33.14.) on Ubuntu 19.04

figure:-8 ZoneMinder Console on Public URL
Figure:-9 Zoneminder Console after adding USB camera

Using the Public URL , you can access the Zoneminder Console using a smart phone or PC . Please see the following figure

How to install balena CLI (Command-Line Interface) on UBUNTU 20.04 LTS ( Focal Fossa) and interact with the balenaCloud

The main objective of this tutorial is to install balena CLI on Ubuntu 20.04 and to interact ( pushing projects to devices on the balena cloud) .

Please refer the following post where we have created qemu_zm device and connected with the balena cloud .

Note:- You must have a docker hub account in addition to the balena cloud account to pull docker repository to the device. The same login username and password are used for balena login

How to use a balena-cloud image in qemu emulator on UBUNTU 20.04 LTS ( Focal Fossa)

We are going to interact with the device qemu_zm using the balena cli

First download balena-cli-v11.36.0-linux-x64-standalone zip file from the following site.

https://github.com/balena-io/balena-cli/releases

Figure:-1 balena cli releases

Then extract the file to your Documents folder of the PC

Installation of balena cli

Open the Ubuntu terminal and change the directory to ~/Documents/balena-cli-v11.36.0-linux-x64-standalone/balena-cli where the installation files are stored in the downloaded balena cli file

balena login

apt install npm

npm install -g npm

npm install balena-cli -g --production --unsafe-perm

Figure:-2

Use your docker hub username and password for balena login

After clicking on the link you wilt the following message on the web browser.

Success!

The balena CLI login was successful.

You may now close this page and return to the command prompt.

Figure:-5 Installation of balena cli

Downloading balena Dash and pushing in to the device qemu_zm

The balena dash is a nice project which allows to display any web page with a lightweight web browser .Please refer the following link to download the project.

https://github.com/balenalabs/balena-dash#introductio

Download the balena-dash-master.zip and unzip to Documents sub directory of your PC

Pushing the balena Dash project to the device qemu_zm which we have created earlier in the previous post

Open the Ubuntu terminal and change the director to ~/Documents/balena-dash-master

Then enter

balena push qemu_zm

Then the balena Dash project is pushed in to the device qemu_zm

Figure:-6 At the end of successful push you will get an image Unicone

If you open the balena cloud you will see the changes when balena dash is being pushed to the device qemu_zm as shown in the following figures

Now the device qemu_zm is ready for installing the zoneminder docker repository,.

I will show you how zoneminder docker is installed on qemu_zm device on a Linux PC and accessing the ZM Console remotely on a smart phone or PC

Please refer :- How to use a balena-cloud image in qemu emulator on UBUNTU 20.04 LTS ( Focal Fossa)

How to install Zoneminder Docker on a qemu virtual machine with balenaOS on UBUNTU 20.04 LTS ( Focal Fossa) and view Zoneminder console remotely on balenaCloud

How to use a balena-cloud image in qemu emulator on UBUNTU 20.04 LTS ( Focal Fossa)

Balena is a complete set of tools for building, deploying, and managing fleets of connected Linux devices.

The balena cloud is very useful in connecting the applications in computer devices remotely. Your first 10 devices connected to the cloud is free and full-featured.The main advantage is , the capability in using docker containers in the balena images. Therefore docker applications can be pulled and used in balena platforms.

Our main objective is to create qemu virtual machine with a balena cloud image , on a Linux desktop and then pull a docker repository like bkjaya1952/docker-zoneminder-php7.4-mysql8 and install the application on the device . Then load the qemu device created on the balena cloud so that the application on the cloud can be accessed remotely by using a smart phone or PC.

First you will have to install qemu

Please refer the following link to know about QEMU Emulator .

https://www.qemu.org/

Installation of QEMU with other relevant software for graphical emulation

Open the Ubuntu terminal and run

sudo apt install qemu qemu-utils qemu-kvm virt-manager
libvirt-daemon-system libvirt-clients bridge-utils

Please refer the following post to get further details on installing qemu

How to install QEMU on UBUNTU 20.04 LTS ( Focal Fossa)

Then you will have to signup for a balena cloud account

Refer https://www.balena.io/cloud

Then create an application on the dash board

Here I have use qemu_zm as the name of the application using the blue “Create application” button at the left

Figure:- 1




Figure:-3 After adding qemu_zm

Now you will have to press + Add device button in qemu_zm to download the required qemu-cloud image with balinaOS to create the virtual machine at qemu on Ubuntu .

Figure:-4 Download panel for balenaOS

Then press the blue “Download balenaOS” button at the bottom of the pannel . Then extract the downloaded file in to the Documents directory of the computer as shown in the figure below.

Figure:-5 Extracted balena-cloud Image at Documents sub directory of PC

The size of the above down loaded balena-cloud-qemu_zm-qemux86-64-2.38.0+rev1-v9.15.7.img is around 2.5 GB . If you import this image to qemu to form a VM , the size of the VM will also 2.5 GB , which is not sufficient to install other docker images etc. Therefore , the size is increased by 10GB as follows using the Ubuntu terminal

cd ~/Documents

sudo chmod 777 balena-cloud-qemu_zm-qemux86-64-2.38.0+rev1-v9.15.7.img

sudo qemu-img resize balena-cloud-qemu_zm-qemux86-64-2.38.0+rev1-v9.15.7.img +10G

Then create virtual image on qemu by importing the above image on Virtual Machine manager

Start Virtual Machine Manager and press File> New Virtual Machine >Import existing disk image>Browse>Browse local

Please note:- Operating system used -Generic default and the Memory selected 3000 bites for VM

After creating VM2 in qemu please check the balena cloud to see whether the device is at running mode

You can find the device is connected to balena cloud once the power on VM2 in qemu using the Virtual Machine manager on the PC

Pushing git repository to VM using balena-cli-v11.36.0-linux-x64-standalone established on the PC and pulling docker repository and installing applications will be described in the next post.

Please refer :- How to install balena CLI (Command-Line Interface) on UBUNTU 20.04 LTS ( Focal Fossa) and interact with the balenaCloud

How to install Zoneminder Docker on a qemu virtual machine with balenaOS on UBUNTU 20.04 LTS ( Focal Fossa) and view Zoneminder console remotely on balenaCloud

How to install ZoneMinder Master, v1.35.4 on UBUNTU 20.04 LTS ( Focal Fossa) Using a Docker image

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

First

Installation of Docker on Ubuntu 20.04 LTS ( Focal Fossa )

On the Ubuntu terminal

Zoneminder-master , latest docker images with Mysql 8 & MSMTP

sudo apt install docker.io

This image has been created on ubuntu:focal with zoneminder-1.34/ubuntu focal main

To pull the Repository from the dockerhub please refer the following link

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

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

On the Ubuntu terminal enter the following commands

(You will have to configure the running zm container for mysql 8 ,zm data base and edit the timezone during the first run .)

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

(Now you will be with in the zm container.

Make changes as follows)

(Configuring Mysql and Changing root password)

mysql
ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
FLUSH PRIVILEGES ;
quit

(Creating zm sql data base)

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql
CREATE USER 'zmuser'@localhost IDENTIFIED BY 'zmpass';

(If CREATE does not work try with ALTER )

GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES ;
quit
mysqladmin -uroot -p reload

(Note:- Here use the ‘yourpassword’ created for ‘root’@’localhost’ earlier )

mysql -u zmuser -p zm < /usr/share/zoneminder/db/zm_update-1.35.4.sql

( Note:- Use zmpass as the password here )

(zm_update-1.35.4.sql file name may vary depending on the latest zm data base. To find the latest version please refer https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master )

dpkg-reconfigure tzdata

Then edit your timezone

exit
sudo docker restart zm

http://localhost:8080/zm/

(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/ )

Note:- If you want your docker container zm to detect ip camera automatically, you will have to use following command when creating the container .

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

In this case you will have to restrain in using the port 80 in your host for any other purpose when running the zm container.

Then the zoneminder web panel will be at http://localhost/zm/

Figure:- ZM-Console with USB Camera

How to Install ZoneMinder-Master ,v 1.35.4 on UBUNTU 20.04 LTS ( Focal Fossa)

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

sudo su

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

sudo apt update

apt install zoneminder

Configuring Mysql and Changing  root password

rm /etc/mysql/my.cnf 

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

/etc/init.d/mysql start 

mysql

ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword'; 

FLUSH PRIVILEGES ; 

quit

Creating zm sql data base

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

mysql 

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

(If CREATE does not work try with ALTER )

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

FLUSH PRIVILEGES ; 

quit 

mysqladmin -uroot -p reload

(Note:- Here use the 'yourpassword' created for 'root'@'localhost' earlier )

mysql -u zmuser -p zm < /usr/share/zoneminder/db/zm_update-1.35.4.sql

( Note:- Use zmpass as the password here )

Configuring Zoneminder

chmod 740 /etc/zm/zm.conf

chown root:www-data /etc/zm/zm.conf 

adduser www-data video

a2enmod cgi 

a2enconf zoneminder

a2enmod rewrite 

a2enmod headers 

a2enmod expires 

Starting Zoneminder and apache
systemctl enable zoneminder

service zoneminder start 

service apache2 reload
 
Open zoneminder web console (http://localhost/zm/)
Figure:- ZM Console after adding USB Cameara
Note:-
1. )  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” .

2.)  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 BY 's4abSHUP05s1J32G5';



GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' WITH GRANT OPTION; 

quit

How to install Zoneminder v1.34.20. on UBUNTU 20.04 LTS ( Focal Fossa) Using a Docker image

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

First

Installation of Docker on Ubuntu 20.04 LTS ( Focal Fossa )

On the Ubuntu terminal

sudo apt install docker.io

zoneminder-1.34 ,docker images with php 7.4 ,Mysql 8 & MSMTP

This image has been created on ubuntu:focal with zoneminder-1.34/ubuntu focal main

To pull the Repository from the dockerhub please refer the following link

https://hub.docker.com/repository/docker/bkjaya1952/docker-zoneminder-php7.4-mysql8

Usage :

To create a zoneminder-1.34 docker container (name zm)with php 7.4 ,mysql 8 & msmtp

On the Ubuntu terminal enter the following commands

    1. sudo docker create -t -p 8080:80 --shm-size=4096m --name zm --privileged=true bkjaya1952/docker-zoneminder-php7.4-mysql8:1.34.20

      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)

Configuring Mysql and Changing root password)

mysql ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword'; 

FLUSH PRIVILEGES ;
quit

(Creating zm sql data base)

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

mysql CREATE USER 'zmuser'@localhost IDENTIFIED BY 'zmpass'; (If CREATE does not work try with ALTER ) 

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

FLUSH PRIVILEGES ; 

quit
mysqladmin -uroot -p reload

Then edit your timezone in the system

dpkg-reconfigure tzdata

Then edit your timezone

Then edit your time zone at /etc/php/7.4/apache2/php.ini

sed -i "961i date.timezone = Asia/Colombo" /etc/php/7.4/apache2/php.ini ( ie. Asia/Colombo )

exit sudo docker restart zm

http://localhost:8080/zm/

(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/ )

Note:- If you want your docker container zm to detect ip camera automatically, you will have to use the following command when creating the container .

sudo docker create -t -p 80:80 --shm-size=4096m --name zm 
--network=host --privileged=true 
bkjaya1952/docker-zoneminder-php7.4-mysql8:1.34.20

In this case you will have to restrain in using the port 80 in your host for any other purpose when running the zm container.

Then the zoneminder web panel will be at http://localhost/zm/

Screenshot from 2020-05-19 11-01-01

Figure:- ZM-Console with USB Camera