<code>Today, Mr. Isaac Connor has published the first successful Zoneminder-master-eoan package for Ubuntu 19.10. in his website . To avoid errors when installing Zoneminder , MySQL-server is installed first. Installation of MySQL-server On the Ubuntu terminal sudo su apt install mysql-server rm /etc/mysql/my.cnf cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf sed -i "15i default_authentication_plugin= mysql_native_password" /etc/mysql/my.cnf /etc/init.d/mysql start Installation of Zoneminder To install Zoneminder Please refer Connor’s web site Open the terminal and run following commands. 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 sudo add-apt-repository ppa:iconnor/zoneminder-master sudo apt-get update sudo apt install zoneminder mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql 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 service apache2 reload Open zoneminder web console (http://localhost/zm/) Figure :- Montage of 2 cameras after adding USB Cam & IP Cam
You can see the USB camera and a Hikvision IP camera are working in the above figure Note:- If you fail and get an error ( ERROR 1396 (HY000)) ,when creating mysql user with “CREATE USER” , that means there is already a user. In that case please replace it with “ALTER USER” . 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 ALTER USER 'debian-sys-maint'@localhost IDENTIFIED WITH mysql_native_password BY 's4abSHUP05s1J32G5'; GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' WITH GRANT OPTION; quit sudo /etc/init.d/mysql restart
0 Comments
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 , https://hub.docker.com/r/bkjaya1952/zoneminder-master-docker-latest Docker Repository to make a container . ( This image has been created on ubuntu:eoan with zoneminder-master/ubuntu-20.04) hub.docker.com/r/bkjaya1952/zoneminder-master-docker-latest I have created the above docker image and pushed to the Docker Hub. Figure:- bkjaya1952/zoneminder-master-docker-latest Repository at dockerhub sudo docker create -t -p 8080:80 --shm-size=4096m --name zm --privileged=true bkjaya1952/zoneminder-master-docker-latest 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 sed -i "228i ServerName localhost" /etc/apache2/apache2.conf (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 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.) /etc/init.d/apache2 start /usr/bin/zmpkg.pl start Figure:- Edited “bash.bashrc” file (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 http://localhost:8080/zm/ 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. Figure:-2 Starting script files zmdockerstart.sh & zmdostart.sh Stopping script 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 Figure:-4 Adding script file paths to /etc/sudoers.tmp ( to give sudo privileges to script files Figure:-5 Stater buttons are created on the dock using Manmenu software 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 How to install Zoneminder-master- Docker , v1.33.16 with MSMTP on Ubuntu 19.10 (Eoan Ermine)1/12/2020 n 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 Docker Repository to make a container . ( This image has been created on Ubuntu 19.04 disco ) sudo docker create -t -p 8085:80 --shm-size=4096m -e TZ=Asia/Colombo --name myzm --privileged=true bkjaya1952/docker-zoneminder-master:v1.33.16. Note :- use your timezone instead of "TZ=Asia/Colombo" sudo docker start myzm For configuring MSMTP for emailing zoneminder motion detection events, please refer the following link. https://hub.docker.com/r/bkjaya1952/docker-zoneminder-master Open http://localhost:8085/zm/ and add the camera monitors And fill up email details under the Optons/email of the ZM-Panel Create appropriate zm-filter to send email alerts of motion detection events Figure:- 1 After adding Camera monitors to ZM The scripts of the Dockerfile are as shown in the following figure Figure:-2 The scripts of the Dockerfile
To download the Dockerfile https://www.dropbox.com/s/737qnv3144b52bi/Dockerfile?dl=0 To download the entrypoint.sh https://www.dropbox.com/s/m5lgf2d196a4f5s/entrypoint.sh?dl=0 Please refer my following blog to know about the building an image and pushing to the Docker Hub https://bkjaya.wordpress.com/2019/12/20/how-to-build-a-zoneminder-docker-image-with-msmtp-using-a-dockerfile-push-to-docker-hub-ubuntu-19-10/ Acknowledgements : Based on Zoneminder and Andrew Bauer’s [email protected] entrypoint script Since the official Zoneminder eoan has Dependency wait on lgw01-amd64-051 , We will have to install Zoneminder disco on Ubuntu 19.10. There is a problem in the present PHP release which make errors with the “caching_sha2_password” introduced in the Mysql 8 by default . Please refer the following link https://www.php.net/manual/en/mysqli.requirements.php Therefore , we will have to use “mysql_native_password” method in Mysql 8. First of all we will have to install mysql-server-8 on Ubuntu 19.10 and enable mysql_native_password The installation of mysql-server-8.0 can be done using the synaptic package manager . Figure:-1 Installed mysql-server-8 shown in synaptic package manager Then open the Ubuntu terminal sudo su rm /etc/mysql/my.cnf cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf Then you will have to enter the following line below [mysqld] ( line no 15 ) in my.cnf file default_authentication_plugin= mysql_native_password On the Ubuntu terminal sudo su sed -i "15i default_authentication_plugin= mysql_native_password" /etc/mysql/my.cnf systemctl restart mysql Then enter the following commands on the terminal to set root password for mysql server mysql CREATE USER 'admin'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your password'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES ; quit systemctl restart mysql Then install Zoneminder The Zoneminder disco deb file is downloaded from https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/18492553/+files/zoneminder_1.33.16~20191229135312-disco_amd64.deb GDebi Package Installer can be used to install the Zoneminder disco deb file Before installing Zoneminder disco deb file to overcome dependency issues we will have to download libmysqlclient20and install first using the GDebi Package Installer. Then install Zoneminder disco deb file that we have downloaded . Creating user and zmpass Open the Ubuntu terminal and enter following 5 commands sudo su mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql 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 It was observed that there are missing *.ini files in /etc/php/7.3/mods-available/ which will make problems in getting zoneminder Console. Therefore the necessary files have to be copied from /usr/share/php7.3-mysql/mysql sudo cp /usr/share/php7.3-mysql/mysql/*.ini /etc/php/7.3/mods-available/ sudo service apache2 reload Figure:- 2 & 3 files in foler /usr/share/php7.3-mysql/mysql/ and /usr/share/php7.3-mysql/mysql/ after coping ini files 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 Figure:-4 Zoneminder Console , after adding an Usb camera
(Note :- In order to have clean mysql-server-8.0 install , it is better to completely delete exiting mysql as follows sudo apt remove --purge mysql-server mysql-client mysql-common sudo apt autoremove sudo apt autoclean sudo rm -rf /etc/mysql ) |
AuthorRetired Director of Irrigation ,Sri Lanka Categories
All
Archives
March 2020
|