How to install ZoneMinder, v1.31.44. on Ubuntu 18.04 LTS

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

 

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/)
Screenshot from 2018-05-22 08-43-37
It was observed in ZM-Console,  the monitor adding editing Deleting  buttons are
not working. This is due to the default setting in  /etc/apache2/conf-available/zoneminder.conf
This problem can be solved by editing the zoneminder.conf file as follows.
Open the terminal and run following commands
(In ZoneMinder, v1.31.45 this error has been rectified)

sudo gedit /etc/apache2/conf-available/zoneminder.conf
Screenshot from 2018-05-22 08-13-53

Add following lines at 13 and 14 as shown in the above figure and save
 
AllowOverride All 
Require all granted


Then to restart Apache

sudo service apache2 reload
Then open the ZM-Console and restart zoneminder


Screenshot from 2018-05-22 08-48-04
Now you can see all the buttons in zm-console are working.
In my case ,I have added an usb camera as shown in the following figures
 Screenshot from 2018-05-22 09-09-56

Adding USB camera

Screenshot from 2018-05-22 09-09-56Adding USB camera

Screenshot from 2018-05-22 09-12-23
ZM- Console after adding the camera

Screenshot from 2018-05-22 09-12-54Camera view

Screenshot from 2018-05-22 09-13-31
Facility to add storage areas


Reference - Zoneminder forums
Advertisements

40 thoughts on “How to install ZoneMinder, v1.31.44. on Ubuntu 18.04 LTS

  1. Hi,
    can You help, i added 4 ip cameras, and cpu runs at 100% . on windows with luxriot soft its about 20-30% cpu usage.

  2. Hi Romas
    It seems you have installed Zoneminder on a virtual machine running on windows. I think ,running directly on linux is much efficient than running on a linux system installed on a virtual machine .Therefore it it better to have a partition on the desk and install linux on it to run Zoneminder . I have not used luxriot software . But following link may be useful to improve the performance ,if you still want to use VM on Windows to run zoneminder .
    https://community.spiceworks.com/topic/427547-help-all-guest-vms-100-cpu

  3. Even if enebled function ‘monitor’ , cpu runs at 60-70%, only when swich to ‘none’, cpu usage falls down to 3-4%.

  4. I am stuck on your document as I can’t seem to copy the cambozola.jar over to the /usr/share/zoneminder/www/ . I am very new at Ubuntu so I must be missing something. I can copy to other folders just not the one you indicate. Must be read only folder.
    Thanks,

    • Hi Jerry
      First download Cambozla from this link http://www.andywilcock.com/code/cambozola/cambozola-latest.tar.gz to your Download folder.
      Then right click the mouse on the folder and extract it in to your Download folder. If you go through the extracted file you can see the “cambozolar.jar” in the sub folder called “dist “.This “cambozola.jar” file has to be copied in to the folder at /uasr/share/zomeminder/www/.

      Open the ubuntu terminal
      Then run
      On the ubuntu terminal run
      sudo cp /home/bkjaya1952/Downloads/cambozola-latest/cambozola-0.936/dist/cambozola.jar /usr/share/zoneminder/www/

      Then open the ZM panel and goto Options-> Images -> and tick the box at OPT_CAMBOZOLA . Then check weather the PATH_CAMBOZOLA cage is filled with cambozola.jar. Then save the setting in ZM options .Then restart ZM .
      Best regards
      B.K.Jayasundera

  5. Hello, everything went fine except the instruction “Add timezone to PHP” that returns me that the order was not found, so I skipped that step and continue with the following ones. When I try to open the browser with the address “http: // localhost / zm /” it returns “ZoneMinder is not installed properly: php’s date.timezone is not set to a valid timezone”

    • Hi Oslaf
      Please open php.ini file at the directory /etc/php/7.2/apache2/ using gedit command as follows
      Open the ubuntu terminal
      sudo gedit /etc/php/7.2/apache2/php.ini
      Then go to line number 939 and enter your time zone as shown in the instructions of my blog
      Please ensure to delete ” ; ” in front of date.timezone .

      The respective timezone of your country can be obtained from this site http://php.net/manual/en/timezones.php

      If the above procedure does not work ,please uninstall zoneminder and apache completely using synaptic package manager and reinstall

      • Hello, thank you very much for the help. I followed your instructions and everything worked very well. That was a test on a virtual machine running Ubuntu 18.04, so I installed it on the hard drive in a new partition and followed the instructions in the same way but things were different. (1) I ran the ZoneMinder installer available on Connorś web site and apparently it did not work because I did not find the program among the installed ones, (2) then “rm /etc/mysql/my.cnf” and “cp / etc / mysql / mysql .conf.d / mysqld.cnf /etc/mysql/my.cnf “did not find the files” my.cnf “and” mysqld.cnf “, (3) I installed MySQL following internet instructions and ran the first two instructions but edit “my.cnf” the content is different and I can not replace line 32. (4) I tried to move on but the next instruction did not run anymore.
        It’s a shame because I wanted to replace an ISpy monitoring system running on Windows that gives problems. For users like me Linux is really very complicated.

      • Dear Oslaf
        You can’t edit my.cnf file unless you are in root.Therefore for editing my.cnf please use sudo command.
        sudo gedit /etc/mysql/my.cnf
        When the file is opened , place the mouse cursor at line number 32 and press ‘Enter’ key so that you will add an empty line at line number 32. Now you can copy sql_mode = NO_ENGINE_SUBSTITUTION in to that line. Then save my.cnf .
        For me Linux is better than Windows.
        Best regards
        B.K.Jayasundera

    • Hi Oslaf
      I think ,some thing wrong with the PHP version .Please go to /etc/php/ and see whether any other version of PHP exits .If any other PHP version is available, go to apache2 folder and put your “date.timezone ” in php.ini

  6. Hey thank you for your post, I did everything you mentioned but i got this message on the browser

    ZoneMinder is not installed properly: php’s date.timezone is not set to a valid timezone

    I did change the time zone as you mention.
    do you have any thoughts on this?

    Using ubuntu 18.04

    thanks

    • Hi Bruno
      Uninstall apache and zoneminder. Then open the ubuntu terminal.
      Enter
      sudo apt autoremove.
      (Or clean using ubuntu tweak)
      Then first install apahe then install zoneminder and follow the steps in my blog. Restart zoneminder.

  7. Sorry bodering you so much, I have this issue now

    root@Linuxbruno:/home/bruno# mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
    Enter password:
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    • Dear Bruno
      Open the Ubuntu terminal and enter
      sudo su
      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

      and proceed as shown in the blog…….

      In each case when asking for password, just press the "Enter key" (blank password) of your key board.

  8. Dear Bruno
    If you start with sudo su ,you do not have to use sudo for each command as you are in root.
    Otherwise you will have to use sudo for each and every command in order to get root permission.

    • Thank you for all your help, let me tell you what I’m doing. After installing and unistalling so many times I decided to reinstall ubuntu 18 from zero.
      I started folowing all your steps, everything is wonderfull until this step

      root@LinuxBruno:/home/bruno# a2enconf zoneminder
      Enabling conf zoneminder.
      To activate the new configuration, you need to run:
      systemctl reload apache2
      root@LinuxBruno:/home/bruno# systemctl reload apache2
      Job for apache2.service failed because the control process exited with error code.
      See “systemctl status apache2.service” and “journalctl -xe” for details.

      If I run “journalctl -xe” i found this error

      Job for apache2.service failed because the control process exited with error code.
      See “systemctl status apache2.service” and “journalctl -xe” for details.
      root@LinuxBruno:/home/bruno# journalctl -xe
      Jul 20 19:00:37 LinuxBruno apachectl[10633]: AH00526: Syntax error on line 37 of
      Jul 20 19:00:37 LinuxBruno apachectl[10633]: Invalid command ‘RewriteEngine’, pe
      Jul 20 19:00:37 LinuxBruno apachectl[10633]: Action ‘graceful’ failed.
      Jul 20 19:00:37 LinuxBruno apachectl[10633]: The Apache error log may have more
      Jul 20 19:00:37 LinuxBruno systemd[1]: apache2.service: Control process exited,
      Jul 20 19:00:37 LinuxBruno systemd[1]: Reload failed for The Apache HTTP Server.
      — Subject: Unit apache2.service has finished reloading its configuration
      — Defined-By: systemd
      — Support: http://www.ubuntu.com/support

      — Unit apache2.service has finished reloading its configuration

      — The result is RESULT.
      Jul 20 19:04:09 LinuxBruno systemd[1]: Started Run anacron jobs.
      — Subject: Unit anacron.service has finished start-up
      — Defined-By: systemd
      — Support: http://www.ubuntu.com/support

      — Unit anacron.service has finished starting up.

      — The start-up result is RESULT.
      Jul 20 19:04:09 LinuxBruno anacron[10650]: Anacron 2.3 started on 2018-07-20
      Jul 20 19:04:09 LinuxBruno anacron[10650]: Normal exit (0 jobs run)

      If I run ” systemctl status apache2.service”

      root@LinuxBruno:/home/bruno# systemctl status apache2.service
      ● apache2.service – The Apache HTTP Server
      Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset:
      Drop-In: /lib/systemd/system/apache2.service.d
      └─apache2-systemd.conf
      Active: active (running) (Result: exit-code) since Fri 2018-07-20 18:56:40 ED
      Process: 10633 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=1/
      Main PID: 9908 (apache2)
      Tasks: 6 (limit: 4915)
      CGroup: /system.slice/apache2.service
      ├─9908 /usr/sbin/apache2 -k start
      ├─9910 /usr/sbin/apache2 -k start
      ├─9911 /usr/sbin/apache2 -k start
      ├─9912 /usr/sbin/apache2 -k start
      ├─9913 /usr/sbin/apache2 -k start
      └─9914 /usr/sbin/apache2 -k start

      Jul 20 18:56:40 LinuxBruno systemd[1]: Starting The Apache HTTP Server…
      Jul 20 18:56:40 LinuxBruno apachectl[9904]: AH00558: apache2: Could not reliably
      Jul 20 18:56:40 LinuxBruno systemd[1]: Started The Apache HTTP Server.
      Jul 20 19:00:37 LinuxBruno systemd[1]: Reloading The Apache HTTP Server.
      Jul 20 19:00:37 LinuxBruno apachectl[10633]: AH00526: Syntax error on line 37 of
      Jul 20 19:00:37 LinuxBruno apachectl[10633]: Invalid command ‘RewriteEngine’, pe
      Jul 20 19:00:37 LinuxBruno apachectl[10633]: Action ‘graceful’ failed.

      I don’t want to try to solve it with other posts because they have been making me install things and uninstall things that never fix the problem.

      Do you have any idea? It’s a new linux installation.
      Again thank you

      • Dear Bruno
        I think you have missed the command “sudo service apache2 reload” placed at the bottom part of my blog.

        Please try this command on the Ubuntu terminal
        sudo a2enmod rewrite && sudo service apache2 restart

      • Yes I am at this step, mysql -uroot -p -e “grant all on zm.* to ‘zmuser’@localhost identified by ‘zmpass’;” and i am confused by zmuser@localhost identified by zmpass
        Is this making a user called zmpass?
        Also I am wondering about www-data video
        Where does www-data come from? video is a user right? The reason I ask is because this machine is running ubuntu server 18.04 and has gnome desktop installed. It logs in as “user74” and I am wondering if this will create a problem for me?
        I am a novice linux user with a strong computer background in case you are wondering. I appreciate your time.

  9. Hi Martin
    Answer to your question on “zmpass” is explained in this link https://zoneminder.readthedocs.io/en/stable/installationguide/multiserver.html

    “adduser www-data video” comes under Apache2 configuration. As the zoneminder is run by apache, we need to add the video device to apache:

    Logging in as “user74” will not create problem for the Zoneminder.

    When creating Zoneminder database in MySQL there will be prompts asking for password,.It is advisable to use a blank password for those prompts (Just press the Enter key)

  10. Thank you for the reply. I seem to have run into a problem. I listed everything I have done recently below. Hopefully it all makes sense and is clear.

    The problem is that when I execute http://localhost/zm/ I get an error telling me that “php’s date.timezone is not set to a valid timezone”

    I did run gedit /etc/php/7.2/apache2/php.ini and this is the format I saved there
    [Date]
    ; Defines the default timezone used by the date functions
    ; http://php.net/date.timezone
    ;date.timezone = America/Los_Angeles

    I executed this command BEFORE asking you questions.

    root@nvr:/home/user74# mysql -uroot -p ^C
    root@nvr:/home/user74# mysql -uroot -p -e “grant all on zm.* to
    > ‘zmuser’@localhost identified by ‘zmpass’;”^C I ABORTED THESE COMMANDS AND ASKED YOU QUESTIONS.

    Here is a copy of the commands I executed after receiving your reply to my questions. I do realize that I did not execute the reload and restart commands for apache until I had completed some of the subsequent steps but I don’t think that would affect it running, would it?

    root@nvr:/home/user74# mysql -uroot -p -e “grant all on zm.* to ‘zmuser’@localhost identified by ‘zmpass’;”
    Enter password:
    root@nvr:/home/user74# mysqladmin -uroot -p reload
    Enter password:
    root@nvr:/home/user74# chmod 740 /etc/zm/zm.conf
    root@nvr:/home/user74# chown root:www-data /etc/zm/zm.conf
    root@nvr:/home/user74# adduser www-data video
    Adding user `www-data’ to group `video’ …
    Adding user www-data to group video
    Done.
    root@nvr:/home/user74# a2enmod cgi
    Module cgi already enabled
    root@nvr:/home/user74# a2enconf zoneminder
    Enabling conf zoneminder.
    To activate the new configuration, you need to run:
    systemctl reload apache2
    root@nvr:/home/user74# a2enmod rewrite
    Enabling module rewrite.
    To activate the new configuration, you need to run:
    systemctl restart apache2
    root@nvr:/home/user74# chown -R www-data:www-data /usr/share/zoneminder/
    root@nvr:/home/user74# systemctl enable zoneminder
    Created symlink /etc/systemd/system/multi-user.target.wants/zoneminder.service → /lib/systemd/system/zoneminder.service.
    root@nvr:/home/user74# service zoneminder start
    root@nvr:/home/user74# gedit /etc/php/7.2/apache2/php.ini
    root@nvr:/home/user74# cp /home/user74/Downloads/cambozola-latest/cambozola-0.936/dist/cambozola.jar /usr/share/zoneminder/www/
    root@nvr:/home/user74# systemctl reload apache2
    root@nvr:/home/user74# a2enmod rewrite
    Module rewrite already enabled
    root@nvr:/home/user74# systemctl restart apache2
    root@nvr:/home/user74# gedit /etc/php/7.2/apache2/php.ini
    root@nvr:/home/user74# gedit /etc/php/7.2/apache2/php.ini
    root@nvr:/home/user74# systemctl restart apache2

    Thanks for your time and guidance. – Martin

    • Dear Martin
      You have not uncommented the line of timezone in the php.ini when entering the timezone .When the line is uncommented only the command can be executed.For uncommenting you will have to delete the Semicolon (;) at the beginning of line.When “;” is deleted the letters of date.timezone will become green.

      ;date.timezone = America/Los_Angeles is wrong

      date.timezone = America/Los_Angeles is correct( after deleting Semicolon)

  11. I made an error above. Where it says “I executed this command BEFORE asking you questions”, please strike that from the above sequence. I meant for that to go with the following command…

    root@nvr:/home/user74# mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
    Enter password:

    I entered a password here then stopped and contacted you for the first time. Was this where you think I should have a blank password? If so how would I make it blank?

  12. That fixed the time problem and I completed the rest of the steps and added a camera to zm successfully. I am curious to know if you have tried to change the default storage location for zoneminder? I have a 250GB main drive but I installed a 4TB second drive and wish to store my video there. Any suggestions?
    Thanks for your help with your instructions.

  13. Thank you for the providing the links. I have not tried this yet but I will keep you up to date on progress. I do have one question I should have asked you. You had me run this command: sudo gedit /etc/apache2/conf-available/zoneminder.conf
    I changed line 13 as instructed to: AllowOverride All

    My file looked different from yours after that.

    # Apache 2.4
    Require all granted

    # Apache 2.2
    Order deny,allow
    Allow from all

    Your screenshot did not contain this code. Should I have left this code on or removed it and simply had the line: “Require all granted” follow “AllowOverride All”

    I removed it and as I said zoneminder works. You did not say anything about deleting part of the code so I am now wondering if that code is actually needed.
    What do you think?

    Thanks – Marty

  14. Mr Jayasundera, great job. I followed this HOWTO had zero issues. I’m using a HP thin client T620 plus – has only 16G SSD – and I followed your other HOWTO and set up an external USB stick to store images/captures on. Working great so far. I’m going to look thru your other archieves and see what other neat stuff you figured out in your retirement!

    Ralph

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