Zoneminder – installation tune-up

I think what happened is that I went through an easy install, and a bunch of things didn’t quite get installed or configured. Good thing is that the camera has an orange light, but I’m getting log errors and also not seeing the image within ZM.

I’m going to follow this wiki and do the various recommended configs:
https://wiki.zoneminder.com/Ubuntu_Server_16.04_64-bit_with_Zoneminder_1.29.0_the_easy_way

-I’m going to keep MySQL database for now, and hold off on MariaDB

-I’m sure I did the my.cnf setting, but I confirmed:
nano /etc/mysql/my.cnf
In the [mysqld] section add the following:
sql_mode = NO_ENGINE_SUBSTITUTION

-Optional: A tool that you may want to install is mysqltuner. This is handy to see what database parameters need to be adjusted as your ZM system builds up events.
Note: Will come back to this later, when I’ve got camera working
apt-get install mysqltuner
Once installed, run mysqltuner from a command prompt as root (sudo). Review recommended changes. Edit the configuration file (my.cnf) and make the recommended changes. Stop zoneminder, restart the database server then start zoneminder.

-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 Note: I didn't do this command because I already see the file zm_create.sql mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';" Note: I tried this but it didn't work when I entered root password. Not sure what this means. mysqladmin -uroot -p reload Note: Same error trying to login to root. Not sure what this is -Set permissions of /etc/zm/zm.conf to root:www-data 740 chmod 740 /etc/zm/zm.conf chown root:www-data /etc/zm/zm.conf adduser www-data video Note: Come back with: Adding user `www-data' to group `video' ... Adding user www-data to group video -Enable CGI, Zoneminder and rewrite configuration in Apache. Note: I think this is the issue I'm having, so see what happens... a2enmod cgi Note: Comes back with: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message Module cgi already enabled NOTE: I'm going to hold off on any more changes, because in the log it says: Logi-USB-Orbit: 500000 - Capturing at 14.93 fps Checked the log again. Now I see this again Socket /var/run/zm/zms-014138s.sock does not exist. This document address several things -- easy install; iConnor PPA https://github.com/ZoneMinder/ZoneMinder/issues/1879 One should simply execute the following to enable zoneminder's apache config: sudo service apache2 stop sudo service zoneminder stop a2enconf zoneminder Note: Comes back with Conf zoneminder already enabled http://zoneminder.readthedocs.io/en/latest/faq.html#why-can-t-i-see-streamed-images-when-i-can-see-stills-in-the-zone-window-etc Checking httpd.conf within /etc Enable CGI, Zoneminder and rewrite configuration in Apache. Open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths Change PATH_ZMS to /zm/cgi-bin/nph-zms (Caution: make sure you enter only /zm/cgi-bin/nph-zms with no space at the end or your video will not work!) Note: PATH_ZMS was going to /cgi-bin/nph-zms I was tinkering inside /usr/lib and see a cgi-lib folder which is empty Within /usr/lib there is a zoneminder folder and... Within /usr/lib/zoneminder is a freakin' cgi-bin folder... Within that there is nph-zms and zms The above documentation is slightly correct, but I'm going to go in Zoneminder, options and change to: /zoneminder/cgi-bin/nph-zms Did a: service apache2 restart service zoneminder restart Note: I think I may have addressed the cgi-bin location, but don't think zms is running Note: This is Ubuntu's doc on Apache -- https://help.ubuntu.com/lts/serverguide/httpd.html I noticed within Options, Path, PATH_ZMS, I had forgotten to add the leading / Note: Corrected that and did a: service zoneminder restart The /cgi-bin directory that contains the program zms and the symlink nph-zms. These are needed to see a live stream. The /cgi-bin needs to be declared or assigned an alias, as is done in Apache or Hiawatha in the configuration file. This also is the case with nginx. So I think that your issue involves the path to the /cgi-bin....which on my system which is at the moment Puppy Linux Tahr 6.0.6 (Ubuntu 14.04 binaries), lives at /usr/lib/zoneminder/cgi-bin and is aliased to http://your_server/cgi-bin. look at Options->Paths->Path_ZMS….does this path match the alias setup in your web servers config?
I definitely think your problem involves this issue in someway.

In my case, within /usr/lib/zoneminder/cgi-bin there are nph-zms (symlink) and zms (program)
Note: In all the boards I’ve seen they reference zm but mind is zoneminder

Within /var/log/apache2 is an error.log file
[cgi:error] [pid 3587] [client 192.168.1.4:58602] AH02811: script not found or unable to stat: /usr/lib/cgi-bin/nph-zms, referer: http://192.168.1.15/zm/in$

Well… that makes sense because the directory is empty. The cgi-bin files are within /usr/lib/zoneminder/cgi-bin

Went into: /etc/apache2/sites-available
nano default-ssl.conf and changed from:
/usr/lib/cgi-bin to:
/usr/lib/zoneminder/cgi-bin

Checked the error.log again
I think I fixed the cgi-bin path issue, but still have the socket issue:
[:error] [pid 6353] [client 192.168.1.4:62739] ERR [Socket /var/run/zm/zms-028757s.sock does not exist. This file is created by zms, and since it does not exist

That happens when your Apache ScriptAlias directive is configured incorrectly or overlaps with another ScriptAlias (like the one that ships with your httpd.conf).

Went back into 000-default.conf and entered:

SSLOptions +StdEnvVars


SSLOptions +StdEnvVars

I read someplace to add this to the 000-default.conf file
ScriptAlias /cgi-bin/ /usr/lib/zoneminder/cgi-bin/

Options +ExecCGI
AddHandler cgi-script .cgi .pl
Options FollowSymLinks
Require all granted

service apache2 start
service zoneminder start
Note: Orange light comes on in camera

sudo a2enmod cgi
Comes back with:
[alias:warn] [pid 7584] AH00671: The ScriptAlias directive in /etc/apache2/sites-enabled/000-default.conf at line 34 will probably never match because it overlaps an earlier ScriptAlias.

Back to 000-default.conf
Reviewing this site – where it all began…
https://code-maven.com/set-up-cgi-with-apache

I looked around the /etc/apache2 directory, which is the standard place to find the configuration files of Apache. I’ve found the /etc/apache2/conf-available/serve-cgi-bin.conf file that has a symbolic link from /etc/apache2/conf-enabled/serve-cgi-bin.conf. It has a section that maps the /cgi-bin path in the URLs to the /usr/lib/cgi-bin/ directory in the hard disk and enables CGI execution in this directory.

Within /etc/apache2/conf-available/serve-cgi-bin.conf I think the issue is that it’s pointing to:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
Note: This explains the error I had regarding overlap. It’s also needing to be pointed to the zoneminder folder

Changed it to ScriptAlias /cgi-bin/ /usr/lib/zoneminder/cgi-bin/

sudo service apache2 restart
sudo a2enmod cgi

Still getting the overlap message. Maybe I don’t need the entry in 000-default, so I will remark it out

sudo a2enmod cgi
I think progress, because only msg about ServerName

sudo service apache2 start
sudo service zoneminder start

I think the answer is within this board posting, but I’m still not clear:
https://bugs.launchpad.net/ubuntu/+source/zoneminder/+bug/1159361

Hmmmn…. I checked out this site and looked carefully:
http://zoneminder.readthedocs.io/en/latest/installationguide/ubuntu.html#harder-way-build-package-from-source

/etc/apache2/conf-enabled/zoneminder.conf
# Remember to enable cgi mod (i.e. “a2enmod cgi”).
ScriptAlias /zm/cgi-bin “/usr/lib/zoneminder/cgi-bin”

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride All
Require all granted

Issue is that I really need to be putting /zm/cgi-bin within PATH_ZMS is set to /zm/cgi-bin/nph-zms.

Just saw this:

Changed Default DB User
If you have changed your DB login/password from zmuser/zmpass, you need to update these values in zm.conf.

Edit zm.conf to change ZM_DB_USER and ZM_DB_PASS to the values you used.

I FREAKIN’ FIGURED IT OUT!!!!

I needed to create a zmuser (because that was a default account created).

Now I can see the real-time camera image within the browser. Cool!!!!

Now I can move on to something else.

Note: Color still on orange.