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
0 Comments
Leave a Reply. |
AuthorRetired Director of Irrigation ,Sri Lanka Categories
All
Archives
March 2020
|