How to install Zoneminder-1.36.0-focal1, 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.36.0-focal1

To pull the Repository from the Docker Hub 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

sudo docker create -t -p 8080:80 --name zm --privileged=true -e TZ=Asia/Colombo bkjaya1952/docker-zoneminder-php7.4-mysql8:latest

Note:- Replace Asia/Colombo with your Time Zone

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 )

updatemysql.sh

exit

sudo docker restart zm

http://localhost:8080/zm/

(To use msmtp for emailing please refer https://bkjaya.wordpress.com/2020/12/24/how-to-install-the-latest-zoneminder-master-latest-on-ubuntu-20-04-using-a-docker-image/)

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 --name zm --network=host --privileged=true -e TZ=Asia/Colombo bkjaya1952/docker-zoneminder-php7.4-mysql8: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 after adding USB Cameara

How to Install ZoneMinder-1.36.0-focal1. on UBUNTU 20.04 LTS ( Focal Fossa)

Installation of Zoneminder

To install Zoneminder v1.36.0-focal1. (stable)Please refer Connor’s web site Open the terminal and run following commands.

sudo su

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

sudo apt-get update

apt install zoneminder

Configuring Mysql

/etc/init.d/mysql start

mysql -e "drop database zm;"

mysql -uroot --password=""< /usr/share/zoneminder/db/zm_create.sql 2>/dev/null

mysql -e "ALTER USER 'zmuser'@localhost IDENTIFIED BY 'zmpass';"

mysql -e "GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;"

mysql -e "FLUSH PRIVILEGES ;"

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

How to install ivms4200-(V2.8.2.2_ML)-Linux on Ubuntu

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







Please refer http://www.hikvisioneurope.com/portal/?dir=portal/Technical%20Materials/11%20%20Software/01%20%20Video%20Management%20Software/00%20%20%20iVMS4200

A docker image pre-installed ivms4200-(V2.8.2.2_ML)-Linux based on bkjaya1952/q4wine-x11vnc-novnc-docker

Usage :-

To create a ivms container (name ivms) using bkjaya1952/ivms4200-(V2.8.2.2_ML)-linux Refer:- https://hub.docker.com/r/bkjaya1952/ivms4200-v2.8.2.2_ml-linux On the Ubuntu terminal

sudo docker create -t -p 8008:8080 --name ivms --privileged=true bkjaya1952/ivms4200-v2.8.2.2_ml-linux

sudo docker start ivms

xdg-open http://localhost:8008/vnc_lite.html

https://raw.githubusercontent.com/bkjaya2020/docker-ivms4200-linux-new/master/Screenshot%20from%202021-05-10%2022-04-53.png

You will get the wine desktop as follows. Please notice the ivms-4200 startup icon on the wine desktop

You will have to double click the ivms-4200 icon to get the ivms-400 desktop panel

https://raw.githubusercontent.com/bkjaya2020/docker-ivms4200-linux-new/master/Screenshot%20from%202021-05-10%2022-22-35.png
https://raw.githubusercontent.com/bkjaya2020/docker-ivms4200-linux-new/master/Screenshot%20from%202021-05-10%2022-29-50.png
https://raw.githubusercontent.com/bkjaya2020/docker-ivms4200-linux-new/master/Screenshot%20from%202020-03-01%2016-53-49.png

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

For more details on installation please refer the flowing video

How to control your electrical circuits at home remotely over the internet using a 6-7$ dollar wifi smart switch.

I have found an interesting wifi smart switch that can be used to power on/off electrical circuits remotely over the internet , using a smart phone .

You can use these switches in home surveillance systems.

The prices of the switches are very low as 6-7 $ dollars

The wiring of the switches is very simple .

I have found two brands of switches of low price namely ” Tuya ” and ” Sonoff “

The lowest price was Tuya . Therefore I have purchased “Tuya ” for testing purpose.

Figure:-1 Tuya wi-fi Smart switch

The Tuya wi-fi Smart switch has to be connected to the electrical circuit serially . It is very important to connect Live and Neutral wires of the circuit to the terminals of the switch as shown by L & N.

For testing purpose, I have selected a simple circuit of light bulb connected to a plug through the smart wi-fi switch as shown in the figure below.

Figure:-2 simple circuit of light bulb connected to a plug through the smart wi-fi switch

Figure:-3 Tools used to fix the wires , Tester , Slotted Head & Hexagon screw drivers

The tester was used to identify the Live and Neutral wires of the circuit. The small Hexagon screw driver was used to fix the outer cover of the switch. The small Slotted head screw driver was used to fix the wires to the switch.

Installed the Tuya app on the smart phone

Then the plug was inserted to the power socket and switched on the power and pressed the small black button about 7 seconds to activate wi-fi in the smart switch and add the switch to the Tuya app in the smart phone.

After adding the smart switch to the Tuya app , It was found the On/Off of the circuit can be controlled using the app in the smart phone

The wi-fi smart switch is connected to the mobile phone app ,over the internet,through the router with wi-fi facility .

The wifi smart switch should be in the local network of the router.

After the connection is activated , The switch can be controlled remotely over the internet from any where

Figure:-4 How the smart switch connects with the internet

Figure:- 6 How the switch is working

How to activate the Shutdown button of ZM-Console of Zoneminder master 1.35.27~20210504142217-focal on UBUNTU 20.04 LTS ( Focal Fossa)

The installation of the latest Zoneminder master 1.35.27~20210504142217-focal is same as the procedure described in the following link

Zoneminder master installation

A Shutdown button has been introduced to the latest Zoneminder master 1.35.27~20210504142217-focal issued today.

The main purpose of the Shutdown button is to allow admin users to power off or restart the system from the ZoneMinder UI

For Activating the SYSTEM_SHUTDOWN Button, you will have to edit the /etc/sudoers file as follows.

Open the Ubuntu terminal & run the following commands

sudo gedit /etc/sudoers

On the opened sudoers file add the following line and save the file

www-data ALL=NOPASSWD: /sbin/shutdown

Then the edited file is shown below

Figure:-2 Amended sudoers file at /etc/sudoers

Now restart the Zoneminder and find the Shutdown button is activated as shown below.

Figure:-3 Shutdown button is working

Once the SHUTDOWN button is activated , You can Shutdown / Restart the computer from the ZoneMinder UI. 

How to install the Zoneminder master latest on Ubuntu 18.04 ( bionic )using a docker image

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

Based on Isaac Connor’s ZoneMinder Master Snapshots at https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master

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

https://hub.docker.com/r/bkjaya1952/docker-zoneminder-master-mysql5.7-php7.2

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 --name zm --privileged=true -e TZ=Asia/Colombo bkjaya1952/docker-zoneminder-master-mysql5.7-php7.2

Note:- Replace Asia/Colombo with your Time Zone

sudo docker start zm

(You will have to configure the running zm container for mysql 8 ,zm data base 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 )

firstrun.sh

Note :- If ” firstrun.sh ” can’t create user then try the following command

updatemysql.sh

exit

sudo docker restart zm

http://localhost:8080/zm/

How to Install ZoneMinder-Master ,latest (revised) on UBUNTU 20.04 LTS ( Focal Fossa)

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

Note:- After releasing zoneminder master 1.35.21~20210322130228-focal , mysql 8 configuring is not essential , when installing zoneminder master

Installing Zoneminder master

sudo su 

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

sudo apt update 

apt install zoneminder

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 with a network IP Camera & USB Camera Monitors

Note:- If you want to re configure mysql 8 data base , Please refer the following link .

If the above procedure is not successful , Please drop the zm data base and re create the data base as follows

mysql -e "drop database zm;"

mysql -uroot --password=""< /usr/share/zoneminder/db/zm_create.sql 2>/dev/null

mysql -e "ALTER USER 'zmuser'@localhost IDENTIFIED BY 'zmpass';"

mysql -e "GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;"

mysql -e "FLUSH PRIVILEGES ;"

How to use free realvnc cloud account to View & Control motionEye camera setup on a raspberry pi 3 , remotely over the internet

In my earlier posts , I have explained how to use free balenaCloud to view & control motionEye.

We know in Raspberry Pi OS with desktop (which is specially designed for raspberry pi devices) , the VNC® Server has been installed by default , in order to connect the device remotely if necessary .

Figure:- 1 Raspberry Pi OS with desktop

In this tutorial , we are going to write a downloaded image of Raspberry Pi OS with desktop to a 16 GB SD card and use it on a raspberry pi 3 device . Then install docker.io on raspberry pi 3 and pull ccrisan/motioneye:master-armhf from the docker hub to make a motionEye setup.

We will have to select a fairly lite raspberry pi OS image for our pi 3. Raspberry Pi OS Lite does not have VNC® Server installed by default and no desktop also. Therefore “Raspberry Pi OS with desktop” is the best, as it has VNC® Server & desktop installed by default . In addition it has only essential software installed and the image size is fairly lite ( Size: 1,171MB ) raspberry pi 3.

To use realvnc cloud, signup for an account

A free cloud account can be used for 5 devices .

Figure;- 2 realvnc cloud, signup for an account

The installation details are given below

First download the Raspberry Pi OS with desktop and unzip the image

Write the extracted image to 16 GB SD card using balenaEtcher .

Then insert SD card to raspberry pi 3 and power up

It is easy if you have a monitor connected to raspberry pi 3 through the hdmi cable for configuration process of raspberry pi 3

Then , using the pi configuration menu

Change the default password of raspberry pi os

Activate the VNC Server

Activate auto login during the boot

Then re boot pi 3

Then using the VNC Server menu enter the login credentials of rel vnc cloud account to obtain the free license for the VNC Server to connect with the cloud.

Once you get the above registration , the raspberry pi 3 is visible in your VNV Cloud as a connected device .

Now you can access the desktop of raspberry pi3 remotely over the internet using a computer , a tab or a smart phone installed with VNC® Viewer .

Figure:- 6 Download page of VNC Viiewer

Installation and configuration of motonEye

Then install docker.io on the raspberry pi3

sudo apt install docker.io


sudo docker create -t -p 8080:8765 -p 8081:8081 --name motioneye --privileged=true -e TZ=Asia/Colombo --restart="always" ccrisan/motioneye:master-armhf


sudo docker start motioneye

Now the motioneye container is in running mode

You can access the motionEye setup using the following link on the web browser

localhost:8080

127.0.0.1:8080

or

0.0.0.0:8080

The RealVNC is the best reliable service to connect raspberry pi devices and to control remotely over the internet .

How to control motionEye CCTV system on a Raspberry Pi 3 remotely using balenaCloud

This tutorial explains how to install ccrisan/motioneye docker on a Raspberry Pi 3 using a balena disk image (balena-cloud-rasp_motioneye-raspberrypi3-64-2.65.0+rev1-v12.2.11.img) and then remotely view and control over the internet.

Figure: 1 CCTV setup with raspberry pi3 , USB web camera and Hikvision IP Net camera

First open a docker account so that you can use the login credentials to pull docker images to balena.

Then signup for baleaCloud and make a free account and sign in

In order to connect your raspberry pi 3 device with the balenaCloud , you will have to download a balena disk image from the balenaCloud which will be compatible with raspberry pi 3 & balenaCloud .

In creating appication: process , you will have to fill

Application (name ) I have used rasp_motioeye

choose a device type -I have selected Raspberry pi3 (using 64 bit )

Then you will have to add the device with your wifi credentials and down load the balena image to use in your raspberry pi3

The downloaded image is balena-cloud-rasp_motioneye-raspberrypi3-64-2.65.0+rev1-v12.2.11.img.zip

Then extract the zip file

Figure:- 3 The downloaded zip file of disk image and the extracted image

The next task is to wirte the image to a SD card ( I have used a 16 Gb sd card )

For writing the image to sd card I have used balenaEther software

Figure:- 4 Writing the balena image to a SD cad

Then insert the SD card to the raspberry pi 3 board with usb camera connected and switch on the power.

Figure:- 5 raspberry pi 3 screen when switch on power

Figure:- 6 When switch on power in the raspberry pi 3 , the device rasp_motioneye is connected to the balenaCloud

Then open the balenaCloud in a computer in the same local network and see whether the device is connected. Now you can see a green color bar in the balenaCloud monitor which indicates that the raspberry pi 3 device is connected to cloud.

Now you can install ccrisan/motioneye docker on the device using the balenaCloud

For the installation of ccrisan/motioneye docker click on the device and enter in to the configuration setup

Then go to Devices >Summery> and open the Terminal

Then enter

balena login

Enter your Docker Username and Password to login to balena

Then pull the ccrisan/motioneye docker image bay using the following command

balena create -t -p 80:8765 -p 8081:8081 --name motioneye --privileged=true -e TZ=Asia/Colombo --restart="always" ccrisan/motioneye:master-armhf

balena start motioneye

Note:- Replace Asia/Colombo in the above command with your Timezone 

Now the motionEye is running on the raspberry pi 3 device. Therefore you can add cameras and do configuring using the PUBLIC DEVICE URL or the local IP address of the raspberry pi 3 device .

You can use Angry IP Scanner to get the local IP address

I have used the PUBLIC DEVICE URL to get the motionEye desktop for configuration

Enable the PUBLIC DEVICE URL and open the link on the web browser as shown in the figure

The default admin Username is admin and the Password is blank ( empty password )

After first login , you will have to change the admin and User Passwords for better security

The configuration and uploading and e-mailing motion detection events can be obtain from my previous post below

https://bkjaya.wordpress.com/2021/02/02/how-to-control-a-motioneye-cctv-system-remotely-over-the-internet-using-free-balenacloud/

Figure:- 10 After adding a usb camera and a network camera to motionEye

Figure:- 12 A video presentation on installation

Since the raspberry pi 3 used by me has only one GB ram with 16 GB SD card , adding more than 2 cameras with uploading and e- mailing facilities may be little bit difficult . The latest visions of raspberry pi 4 with 8 GB ram may be ideal for making a better CCTV setup

The balenaCloud seems to be a wonderful cloud service for controlling devices remotely .

Thanks to balena for providing us an excellent set of tools of balena for building, deploying, and managing fleets of connected Linux devices.

Thanks to Calin Crisan for providing us a very nice software motionEye

How to control a motionEye CCTV system remotely over the internet using free balenaCloud

Suppose our operating system is Ubuntu 20.10

Our task in this tutorial is to make a CCTV system of motionEye that can be control remotely using balenaCloud.

The belenaCloud can connect with devices like Rasberi pi , banana pi , qemu vm etc. The balenaCloud is free for your first 10 devices

Since the normal desktop pc is not considered as a compatible device with belenaCloud , first We will have to install QEMU on Ubuntu 20.10 . Please refer How to install QEMU on UBUNTU 20.04 LTS ( Focal Fossa)

Then, we can login to balena using the Ubuntu terminal and get a compatible QEMU X86 64bit (NEW) disk image downloaded in to the computer .This image contains balena os.

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

Open the Ubuntu terminal and run

sudo su 

docker login 

apt install npm 

npm install -g npm npm 

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

balena login

Figure:-1 Login to balena

( Note : For login you need a docker account . you can signup to docker hub to make a docker account.In order to login to balena ,you will have to use the username and paassword of the docker account . After you get the balenaCloud web page using the link created in the balena login process on the Ubuntu terminal , you will have to press authorization button on the web page . If you don’t have a balena cloud account , you will have to sign up and get an account . After signup , You will have to crate a new application and add a device QEMU X86 64bit (NEW) and get the disk image downloaded )

The capacity of the downloaded image is not sufficient to install motionEye . Therefore we will have to increase the disk size.

Then you will have to create a virtual machine on QEMU using the downloaded QEMU X86 64bit (NEW) disk image

Then extract the downloaded QEMU X86 64bit(NEW) disk image to a folder ~/Documents/motionEye/

( you have to create this sub folder motinEye in the Documents directory of your computer )

Figure:- 4 Extracted QEMU X86 64bit(NEW) disk image at ~/Documents/motionEye/

Open the Ubuntu terminal and run

cd ~/Documents/motionEye/

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

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

( Here we are increasing the image size by 5G , Be careful to use the correct name of your img file in the above codes )

Now using the above disk image of increased size , you will have to create a new Virtual Machine in QEMU , using Virtual Machine manager.

After booting the newly created virtual machine , go to the balenaCloud and add the above device

Figure;- 6 After adding the device to balenaCloud

Then open the motinEye device in the balenaCloud and go to summary sub menu and open the balena terminal and run to install docker motionEye ( ccrisan/motioneye )

balena login

( Note:- Here use your username and password of your docker account)

balena create -t -p 80:8765 -p 8081:8081 --shm-size=1500m --name motioneye --privileged=true -e TZ=Asia/Colombo --restart="always" ccrisan/motioneye:master-amd64

( Note:- Replace Asia/Colombo with your timezone )

balena start motioneye

( Be careful to keep running your newly created virtual machine on QEMU )

Now the docker motionEye is running on the device motinEye. The next step is to get the public url and access the cctv system for configuration.

See the PUBLIC DEVICE URL button in first frame of the above Figure 8. You will have to toggle the switch to on position to enable to access the device remotely. Then seen the second frame of above figure 8 . When you click on the public device url , you will get the login panel of motionEye.

The default root Username is dmin

Password is blank

After login , change the password

Then select the usb camera for redirection in the Virtual Machine Manager and reboot the virtual machine to register the usb camera

For further details on configuring motionEye please refer the post at the following link.

How to install motionEye cctv software on Ubuntu 20.10 ( groovy )

Using the PUBLIC DEVICE URL you can access the device on a smart phone .

Since the PUBLIC DEVISE URL does not change , It is convenient to use

For further clarifications please see the following video

Figure:- 12 Video presentation on this blog post

Security – motionEye CCTV system on balenaCloud

The motionEye CCTV setup is protected with Login credentials.

You will have to use strong Passwords in the motionEye setup

Figure:- 13 Configuration of Login credentials

There are two setups of Login credentials namely Admin and Surveillance .

If you use Admin Username & Password , you can enter in to motionEye CCTV system and make changes in configurations.

f you use Surveillance Username & Password , you can view camera streaming & saved photos an videos , but can’t make changes in configuration .

When the PUBLIC DEVICE URL is loaded on a web browser , you will get the login screen. You will not be able to enter in to motinEye CCTV system if you don’t know the Username and Password .

Figure:- 14 remote login to motionEye CCTV setup using a mobile phone

The balenaCloud is using an excellent security setup to protect your devices. Please see the link below for more details

https://www.balena.io/docs/learn/welcome/security/