How to use Apache Virtual Host with kebaros-io/docker on Ubuntu 18.04 to integrate live stream views of cameras to a web page

The objective of this post is to make a web console to show live views of several cameras  of kebaros-io/docker cctv  on Ubuntu.

For this purpose we will have to install Apache on Ubuntu

On the Ubuntu panel

sudo apt install apache

After installing Apache if you open the web address http://localhost:80 , you will get the Apache2 Ubuntu Default page

The default port of the above page is 80

If you go to /var/www/html , you will be able to see  the html file “index.html” which has codes for  Apache2 Ubuntu Default page

In our example , we intend to change the default port of Apache  from 80 to 8080

How to change the default port 80

Open the terminal and run

sudo gedit /etc/apache2/ports.conf

Then the file port.conf file will be opened

 

Screenshot from 2019-02-07 18-36-28

Figure1 :-

In the file change the Listen 80 to Listen 8080 and save

Similarly open the file 000-default.conf by running

sudo gedit /etc/apache2/sites-enabled/000-default.conf

Screenshot from 2019-02-07 18-37-31

Figure2 :-

and change  <VirtualHost *:80> to <VirtualHost *:8080> and save

The run

sudo service apache2 restart

Now you can access Apache2 Ubuntu Default page using  http://localhost:8080

Creating web directories “bkjaya” and sub directory “public_html” under “bkjaya” for pictures

On the Ubuntu terminal

cd /var/www/html

sudo mkdir bkjaya

cd bkjaya

sudo mkdir

cd public_html

sudo chown -R bkjaya1952:bkjaya1952 /var/www/html/bkjaya/public_html

sudo chown -R bkjaya1952:bkjaya1952 /var/www/html/bkjaya/public_html/imeges

sudo chmod -R 755 /var/www/html/

 

Then create an  index.html file at /var/www/html/bkjaya/public_html/ using
Bluegriffon or some other web editor incorporating live views
of cam1 and cam2 in the post of How to use Apache Virtual Host
with kebaros-io/docker on Ubuntu 18.04 to integrate live stream
views of cameras to a web console.

live view of cam1

Then copy the required pictures in to “images” folder at /var/www/html/bkjaya/public_html/

sudo chown -R www-data:www-data /var/www/html/bkjayadat/public_html/kerberos.png

sudo chown -R www-data:www-data /var/www/html/bkjayadat/public_html/stop.png

sudo gedit /etc/apache2/sites-availabl/bkjaya.conf

Screenshot from 2019-02-07 22-55-25.png

Figure3 :-

 Enable virtual host configuration files

cd /etc/apache2/sites-available

sudo a2dissite 000-default.conf
sudo a2ensite  bkjaya.conf 

To restart Apache web server
sudo systemctl restart apache2


Screenshot from 2019-02-07 23-07-08

Figure4 :-http://localhost:8080

Screenshot from 2019-02-07 23-07-54

Figure5 :-http://localhost:8080/bkjaya/


Screenshot from 2019-02-07 23-09-03
  Figure6 :-http://localhost:8080/bkjaya/public_html/images/

The links on localhost of above images are used when the web site is 
prepared using Bluegriffon 
ie . http://localhost:8080/bkjaya/public_html/images/kerberos.png
ie . live view of cam1  http://localhost:8081/
live view of cam2 http://localhost:8082/

Screenshot from 2019-02-07 23-37-41

Figure7 :-preparation of web page ( index.html at 
 /var/www/html/bkjaya/public_html/ )using Bluegriffon 

Screenshot from 2019-02-06 11-51-43


Figure8 :- Web site  http://localhost:8080/bkjaya/public_html/


Referance :- How to use kerberos-io/docker on Ubuntu 18.04.1 LTS to make a CCTV Surveillance System


 

 

 

 

 

 

 

 

Advertisements

How to use kerberos-io/docker on Ubuntu 18.04.1 LTS to make a CCTV Surveillance System

In this example ,I am using a simple USB web camera and an IP camera ( Hikvision Q1 NETWORK PT CAMERA) for my Surveillance system . The kerberos-io  is the key element in the Surveillance system.

 

Use of kerberos-io/docker on Docker is pretty much  easier   than installing kerberos-io direct on Ubuntu  as the difficult part of configuring  of  installing Keberos.io is already done with in the kerberos-io/docker image .

First I have to install Docker.io

Open the Ubuntu terminal and run

sudo apt install docker.io

Then make two docker containers for two cameras using kerberos-io/docker

On the terminal

sudo docker run –name cam1 -p 81:80 -p 8081:8889 –privileged=true -d kerberos/kerberos

sudo docker run –name cam2 -p 82:80 -p 8082:8889 –privileged=true -d kerberos/kerberos

The above commands  will pull the kerberos image and make the web interface available on port 80 and the live stream on port 8889.

The names of the above camera contains for USB camera and the IP camera are cam1 and cam2 .

If you access following web addresses on the web browser ,you will be directing to the login screens of the web gui  of cameras

 

Figure1 :- logging screens of cam1 & cam2

 

Figure2 :- System screens of cam1 & cam2

 

 

Figure3 :- Configuration screen of cam1 & cam2

 

Figure4 :- Configuring cam1 & cam2

For my IP camera ,I have used following following details for the configuration

rtsp://username:password@ip address:554/Streaming/Channels/102?transportmode=mcast&profile=Profile_2

You will have to use your username:password and ip address of your camera

Capture width 352

Capture height 288

 

Figure5 :- Dashboards of cam1 & cam2 after configuration

 

Screenshot from 2019-02-06 11-54-03

Figure6 :- Setting motion detection area

 

Screenshot from 2019-02-06 11-56-12

 

Figure7 :-  Saved video files of motion detection

 

Figure8 :-Live views of cam1 & cam2

Stopping cam1 & cam2

On the terminal run

sudo docker stop cam1 cam2

 

Start cam1 & cam2

sudo docker start cam1 cam2

 

With above commands you can make two launchers for start and stop cam1 and cam2 using Main Menu software

 

Figure9 :-  Making launchers for start and stop cam1 and cam2

 

I have made a web panel showing live streaming of two cameras using  Apache localhost

Screenshot from 2019-02-06 11-51-11

 

 

Screenshot from 2019-02-06 11-51-43

The details of making a website using Apache localhost will be given in the next blog post

How to use Apache Virtual Host with kebaros-io/docker on Ubuntu 18.04 to integrate live stream views of cameras to a web page

 

 

 

 

HOW TO INSTALL ZONEMINDER ON DOCKER IN UBUNTU 18.10 (WITH HIKVISION IP AND USB CAMERAS)

In this tutorial we are going to use “Docker: Enterprise Container Platform”  (docker.io) to install “quantumobject/docker-zoneminder” on Ubuntu 18.10 operating system.

The “quantumobject/docker-zoneminder  which  is based on  zoneminder master packages has been maintained and uploaded to the Docker Hub by Angel Rodriguez-Rodiguez-Riccrdo.

Installation procedure is given below.

Installation of Docker on Ubuntu 18.10

Open the Ubuntu terminal and run

sudo apt install docker.io

We are going to run Zoneminder with MySQL in a separate container

On the Ubuntu terminal

sudo docker network create net

( I have used my timezone as Asia/Colombo . Your time zone can be get from here  )The above commands will pull mysql/mysql-server:5.7 and create a container named “db” on the Docker Platform

Then on the Ubuntu terminal

sudo docker run -d -e TZ=Asia/Colombo -e MYSQL_USER=zmuser -e MYSQL_PASSWORD=zmpass -e MYSQL_DATABASE=zm -e MYSQL_ROOT_PASSWORD=mysqlpsswd -e MYSQL_ROOT_HOST=% –net net –name db mysql/mysql-server:5.7

sudo docker run -d –shm-size=4096m -e TZ=Asia/Colombo -e ZM_DB_HOST=db –net net –name zm -p 8080:80 –device=/dev/video0:/dev/video0 quantumobject/docker-zoneminder

The above commands will pull quantumobject/docker-zoneminder from the Docker Hub and create a container named “zm”

(Here ,I have used port 8080 for the ZM panal )

( You can  notice  “–device=/dev/video0:/dev/video0” in above command which facilitate adding USB cameras on Zoneminder/Docker . You can use “–privileged=true” also instead of  “–device=/dev/video0:/dev/video0”)

In order to appear ZM panel , you will have to start above two containers “db” and “zm” using the terminal as follows.

sudo docker start db

sudo docker start zm

Then open the web browser http://localhost:8080/zm/

Screenshot from 2019-01-01 19-01-45

Figure: 1 zm console with USB camera and Hikvision wifi IP camera

 

 

 

Figure: 2 Creating a monitor for USB camera

Please be careful to select correct Capture Width and Height .If you use  wrong configuration ,the error log will suggest the correct Width and Height.

 

 

 

Figure: 3 Creating a monitor for Hikvision  wifi IP camera

The Camera modal is “Hikvision Q1 Network PT Camera”

In zoneminder on Docker , ONVIF button of the monitor menu could not automatically detect the ip camera configuration . Therefor ,I had to enter the source path and Width Height manually.

The source path is   rtsp://username:password@ip address:554/Streaming/Channels/102?transportmode=mcast&profile=Profile_2

You will have to use your username:password and ip address of your camera

Capture width 352

Capture height 288

Screenshot from 2019-01-01 19-01-23

 

Figure: 4 zm console with USB camera and Hikvision wifi IP camera

Following script is used to initiate zoneminder after booting.

zmdockerstart.sh file is placed at the home directory .

Then on the terminal

sudo chmod u+x zmdockerstart.sh

Screenshot from 2019-01-02 12-32-54

Figure: 5 script to start zoneminder/docker

In order to execute the script file zmdockerstart.sh at the boot time.

On the terminal

sudo crontab -e

Then enter the following command at the bottom the opened file and save pressing Ctrl o keys

@reboot /home/bkjaya1952/zmdockerstart.sh

 

Screenshot from 2019-01-03 22-26-48

Figure: 6 Setting up the script zmdockerstart.sh with Corn

You can see  the script will start Zoneminder as root during the start up of Ubuntu

 

 

 

 

 

 

 

 

 

HOW TO INSTALL ZONEMINDER, v1.33.0. ON UBUNTU 18.10 LTS (COSMIC)

To install Zoneminder Please refer Connor’s web site Open the terminal and run following commands.
sudo add-apt-repository ppa:iconnor/zoneminder-master
sudo apt-get update
sudo apt install zoneminder

sudo su
rm /etc/mysql/my.cnf
cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
gedit /etc/mysql/my.cnf
add the following line at 32
sql_mode = NO_ENGINE_SUBSTITUTION

systemctl restart mysql
Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql

mysql -uroot -p -e "grant all on zm.* to 
'zmuser'@localhost identified by 'zmpass';"

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

Add timezone to PHP

gedit /etc/php/7.2/apache2/php.ini
edit line 939 with your timezone
screenshot-from-2017-10-20-14-36-56_orig
Then save the file php.ini
Your time zone can be get from here
Adding cambozola.jar to the directory /usr/share/zoneminder/www/ Download the latest cambozola and extract to the Downloads directory of your PC Then copy the cambozola.jar to the directory /usr/share/zoneminder/www/ On the ubuntu terminal run sudo cp /home/bkjaya1952/Downloads/cambozola-latest/cambozola-0.936/dist/cambozola.jar /usr/share/zoneminder/www/
Open zoneminder web console (http://localhost/zm/)
sudo service apache2 reload
Then open the ZM-Console and restart zoneminder
Screenshot from 2018-12-15 18-21-40
Figure 1:- Adding an USB camera
Screenshot from 2018-12-15 18-25-14
Figure 2 :- Added USB camera and Hikvision IP camera
Screenshot from 2018-12-15 18-24-49
Figure 3:- Montage of 2 cameras
You can see the USB camera  and a Hikvision IP camera are  working in the above figure

How to solve dependency problems in Zoneminder (v1.32.2) on Ubuntu 18.10 (Cosmic)

Ubuntu 18.10 (Cosmic) has been released on this week .It is observed that the installation of  the latest Zoneminder master package (v132.2) on Ubuntu 18.10  has some dependency problems as shown in the  figure below.

Screenshot from 2018-10-26 16-08-08

Figure :-1 Dependency isuues

It is apparent that  the latest Zoneminder has not been adjusted yet to suit the environment of newly released  Ubuntu 18.10 .

Therefore we can include the necessary dependent software by adding Bionic repositories to the source list as follows  as a temporary measure until the Zoneminder is revised by the maintainers .

sudo gedit /etc/apt/sources.list

Add the following 2 lines to the bottom of the file sources.list and save

deb http://archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe

Then on the terminal

sudo apt update

Screenshot from 2018-10-26 17-04-29

 

Figure 2:- Edited sources.list

Then on the Ubuntu terminal

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

sudo apt install zoneminder

(Or you can use Synaptic Package Manager to install Zoneminder )

Then follow the instructions in my earlier post on Zonemider installation

Note*

If the Apache is not started Please enter following commands on the Ubuntu terminal

sudo apachectl stop

sudo /etc/init.d/apache2 start

sudo /etc/init.d/apache2 reload

Screenshot from 2018-10-26 17-27-27

 

Figure 3:- Zoneminder 32.2 console and monitor on Ubuntu 18.10 (Cosmic)

 

 

 

 

 

 

 

How to mount Box.com on Ubuntu PC

This post describes ,how to mount Box.com cloud on a desktop with Ubuntu using ,  WebDav , davfs2, gio mount.

Please refer the following site for latest details

How to mount Box.com on Ubuntu PC

davfs2 is a Linux file system driver that allows to mount a WebDAV resource. WebDAV is an extension to HTTP/1.1 that allows remote collaborative authoring of Web resources

First of all you will have to open a free Box.com account

Install davfs2

On the Ubuntu terminal

sudo apt install davfs2

sudo addsuser your username davfs2  ( use your linux username )

sudo dpkg-reconfigure davfs

press <Yes> tab as shown in the flowing figure

(This is to mount Box.com as a non-root user)

Screenshot from 2018-10-15 15-38-19

Figure 1:- configuring  davfs

Open the Nautilus file browserPress the “+ Other Locations” tab .At the bottom of  the opened window you can find a box for connecting to the server .On the box  enter    davs://dav.box.com/dav and press the connect button at the right hand corner .

Then it will prompt to enter username and password of your Box.com account

After entering your password and username tick Remember forever box

Screenshot from 2018-10-13 20-15-53

figure 2:-Entering username and password of your Box.com account

Then a window will popup to enter a key . For the key just hit the enter key of the keyboard .( empty key). This is to make easy to automount the Box.com during the boot time.If you enter a key box.com will not mount at the boot time.

If you miss the entering empty key , you can make the default keyring  empty using “Passwords and Keys” tool as shown in the following figure

Screenshot from 2018-10-15 15-29-48

Figure 3:- Changing default keyring to empty key

Now Box.com is mounted as shown in the following figure.

Screenshot from 2018-10-15 15-36-00

Figure 4:-Bookmarking the Box.com at the location

Now Bookmark the location by pressing the button of the window as shown in Figure 3:-

Next task is to making a script for automounting Box.com at the boot time.

On the terminal

sudo gedit boxmont.sh

Enter the code  ” gio mount davs://dav.box.com “as shown in the figure below and save the file

To make boxmount.sh executable

In the Ubuntu terminal

chmod u+x boxmont.sh

 

Screenshot from 2018-10-14 19-05-24

Figure 5:-Script file to automount Box.com at the boot time

 

Then add the script to startup programs as shown in the following figure

Screenshot from 2018-10-14 19-15-41

Figure 6:-Adding the script to startup programs

If you  restart the computer you will be able to see your box account is mounted automatically on the desktop as shown in the following figure

Screenshot from 2018-10-14 19-12-55

Figure 6:-box.com mounted at the boot time

Note:- Box management has announced that they  will deprecate support for WebDAV after Jan 31, 2019 . Therefore you may not be able to use this method after Jan 2019. But linux users still can use Box.com for auto sync data using git-annex. Please refer my earlier post on “How to sync zoneminder events with box.com account using git-annex on Ubuntu 18.04

How to sync zoneminder events with box.com account using git-annex on Ubuntu 18.04

Our task is to find a method for linux operating systems to automatically upload zoneminder motion detection events to Box.com cloud storage.

I have 3 monitors created on zoneminder and events are stored in 3 separate storage areas. The storage details are shown in the following figure. This blog post explains how to sync events of 3 ZM monitors  with 3 folders in Box.com cloud storage.

Screenshot from 2018-10-14 23-31-17

Figure :-1

Box.com cloud service provides free 10 Gb storage for personal use. Box management has announced that they  will deprecate support for WebDAV after Jan 31, 2019 .Therefore other alternatives have to be found to sync  data in linux platforms with Box.com cloud service. The  syncing  facility is provided only for Microsoft Windows by Box.com.

Git-annex is a very good open source software for linux operating systems to solve the above problem in syncing with Box.com cloud .

How to install git-annex on Ubuntu 18.04

on the Ubuntu terminal

sudo apt update

sudo add-apt-repository ppa:kelleyk/git-annex
sudo apt update

sudo apt install git-annex


In order to use events files in git-annex,  the files at /var/cache/zoneminder/events , /mnt/sdb/zoneminder/events, and /mnt/sda3/zoneminder/events have to be given read and write permissions

On the Ubuntu terminal

sudo chown -R www-data:www-data /var/cache/zoneminder/events

sudo chmod -R g+w /var/cache/zoneminder/events

sudo chown -R www-data:www-data /mnt/sdb/zoneminder/events

sudo chmod -R g+w /mnt/sdb/zoneminder/events

sudo chown -R www-data:www-data /mnt/sda3/zoneminder/events

sudo chmod -R g+w /mnt/sda3/zoneminder/events

Connecting zoneminder events to dedicated drives 

Create a config file under /etc/zm/conf.d . Name the file anything you want just as long as it ends in “.conf”. Add the following content to the file and save your changes:

(In my case I have used ajp.conf as the file name )

sudo gedit /etc/zm/conf.d/ajp.conf

and pasted following codes and  saved  the file in /etc/zm/conf.d

Screenshot from 2018-10-15 09-34-46

Please refer my earlier post to see about using dedicated drives in zoneminder


 

After installing  get a git-annex you will get a launcher icon on the computer

When you double click on the launcher git-annex dashboard will appear on the web browser.

Adding repository for /mnt/sdb/zoneminder/events (figure 2 to figure 8 )

 

Screenshot from 2018-10-14 15-56-42

Figure :-2 Adding repository for /var/cache/zoneminder/events

 

Screenshot from 2018-10-14 15-56-51

 

Figure :- 3 Adding Box.com for /var/cache/zoneminder/events

Screenshot from 2018-10-14 15-57-31

 

 

Figure :- 4  Adding login details for Box.com

note :- Select encryption  disable

 

Screenshot from 2018-10-14 15-58-12

Figure :- 5 Automatically uploading events to Box.com

Screenshot from 2018-10-14 15-59-11

 

Figure :- 6  Uploaded files on annex folder in Box.com

Screenshot from 2018-10-14 16-00-04

 

Figure :- 7 Uploaded files on annex folder in Box.com

Screenshot from 2018-10-14 16-02-17

Figure :- 8 git-annex folder on git-annex console

 

 

Screenshot from 2018-10-14 16-40-46

 

 

Figure :- 9  Adding repository for /mnt/sda3/zoneminder/events


 

Adding repository for /mnt/sdb/zoneminder/events (Figure 10 to figure 6)

Screenshot from 2018-10-14 16-50-13

 

 Figure :- 10

Screenshot from 2018-10-14 16-50-23

Figure :- 11

Screenshot from 2018-10-14 16-50-34.png

Figure :- 12

Screenshot from 2018-10-14 16-50-43.png

 

Figure :- 13

 

Screenshot from 2018-10-14 16-51-34

Figure :- 14

Screenshot from 2018-10-14 16-51-56

Figure :- 15

Screenshot from 2018-10-14 16-52-06

Figure :- 16

Screenshot from 2018-10-14 16-53-27

Figure :- 16 Uploaded events of 3 storage folders are  underlined in red

Screenshot from 2018-10-14 16-54-32

Figure :- 17

Screenshot from 2018-10-14 16-55-48

Figure :- 18 You can see 3 repositories on git-annex dashboard for 3 zoneminder monitors

Screenshot from 2018-10-15 00-53-17.png

 

Figure :- 19

You can see in Figure :- 19 , the git-annex daemon will start at the boot time to facilitate automatic syncing