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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s