Installing ZoneMinder on UbuntuServer – Enable and Start ZM

Enabling and Starting ZoneMinder:

systemctl enable zoneminder
Note: It came back with:
Synchronizing state of zoneminder.service with SysV init with /lib/systemd/systemd-sysv-install…
Executing /lib/systemd/systemd-sysv-install enable zoneminder

systemctl start zoneminder
Note: It didn’t come back with anything re: prompts. Probably OK, though.

Edit TimeZone
nano /etc/php/7.0/apache2/php.ini

Search for [Date] (Ctrl + w then type Date and press Enter) and change date.timezone for your time zone, see [this]( Don’t forget to remove the ; from in front of date.timezone

Configured so it looks like this:
; Defines the default timezone used by the date functions
date.timezone = America/Los_Angeles

Reload Apache Service
systemctl reload apache2

Making sure ZM is running:
Note: Freakin’ awesome!!! I have a console to work with

Optional API Check

Note: Came back with:
version “1.30.4”
apiversion “1.0”

Note: Looks all good right now!!!

NOTE: At the end of the installation, there was a comment about:

PPA install may need some tweaking of ZMS_PATH in ZoneMinder options.
Note: I didn’t do anything, but may need to come back to this after installing a camera.

Installing ZoneMinder on UbuntuServer – Configure Apache

a2enconf zoneminder
Note: It came back with: To activate the new configuration, you need to run:
service apache2 reload
Note: Not sure if I do this now or not…
Decided to do now, even though two more commands to go

a2enmod cgi
Note: It came back with: AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using Set the ‘ServerName’ directive globally to suppress this message
Enabling module cgi.
To activate the new configuration, you need to run:
service apache2 restart
Note: Did the: service apache2 restart

a2enmod rewrite
Note: It came back with: Enabling module rewrite.
To activate the new configuration, you need to run:
service apache2 restart
Note: Did the: service apache2 restart

Note: That’s it for this post. Now it’s on to enable and start ZoneMinder.

Installing ZoneMinder on UbuntuServer – Configuring dB

Now that the software is installed, I need to configure the ZoneMinder database.

ZoneMinder Installation

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql Note: Entered my root password on file. I suppose this is creating a database. I also confirmed the files path of zoneminder files before running the command. mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';" Note: I did a copy and past of this command; entered password; came back pretty quick. Maybe it's just a security update. Setting Permissions
Set /etc/zm/zm.conf to root:www-data 740 and www-data access to content
Note: Not sure what this means, but I’m setting permissions
chmod 740 /etc/zm/zm.conf
Note: Done
chown root:www-data /etc/zm/zm.conf
Note: Done
chown -R www-data:www-data /usr/share/zoneminder/
Note: Done

Note: That’s it for this post. On to configuring Apache.

Installing ZoneMinder on UbuntuServer – Zoneminder repo

Goal is to install the latest version of ZoneMinder

ZoneMinder Installation

Either run commands in this install using sudo or use the below to become root
sudo -i
Note: When I do this it asks for my password, and the prompt goes from $ to #, so I know it’s root access now

Appears that ZoneMinder is available via Ubuntu directly, but if I want the absolute latest, I need to configure something for iconnor — not sure who or what iconnor is, but I’ll do that

add-apt-repository ppa:iconnor/zoneminder
Note: Came back with references to requesting keyrings. Says that a trustdb is created.
Says Launchpad PPA for Isaac Connor imported — so it some guy called Isaac…

Update repo and upgrade
Note: I’m thinking this is redundant because I’ve just done the upgrade to UbuntuServer 16.04, but I’ll do anyway
apt-get update
Note: Done
apt-get upgrade
Note: Done
apt-get dist-upgrade
Note: Done

Configuring MySQL:
Looks like I have version 5.7.29 of MySQL installed
Certain new defaults in MySQL 5.7 are currently causing some issues with ZoneMinder, the workaround is to modify the sql_mode setting of MySQL.

To better manage the MySQL server it is recommended to copy the sample config file and replace the default my.cnf symbolic link.

rm /etc/mysql/my.cnf (this removes the current symbolic link)
Note: This removes the file my.cnf
Note: Before doing this command, I opened the file. Aside from a bunch of comments, there are lines:
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

rm /etc/mysql/my.cnf
Note: File has been deleted

cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
Note: The file my.cnf has way more stuff in it now

Change the settings in my.cnf with an application called nano
nano /etc/mysql/my.cnf

In the [mysqld] section add the following:

CTRL+o then [Enter] to save
CTRL+x to exit
Note: I went back into to my.cnf and confirmed change. OK.

Restart MySQL Server
systemctl restart mysql
Note: Done

Install ZoneMinder
Note: I’m going to do a new post for the configuration, as this is getting long.
Note: So far so good. Don’t exactly know what all the commands are really doing, but I’m just following instructions…

apt-get install zoneminder
Note: This takes a while. Letting it unpack and chug.
Note: Wasn’t that bad — about 4-5 minutes long.

Now to configure the database

Installing ZoneMinder on UbuntuServer – LAMP

Now that I’ve done the upgrade to UbuntuServer 16.04, I can start the installation of ZoneMinder.

ZoneMinder Installation

Summary: Got Apache, MySQL and PHP installed and verified versions. See below.

First thing is installing LAMP (Apache, MySQL, PHP).

I’m not sure if this is already running, though. I checked with these statements:
dpkg -s apache2 | grep Status
Not installed
dpkg -s php5 | grep Status
Not installed

Installing LAMP, because I must not have done this during initial server install:
sudo tasksel install lamp-server
Note: Entered a password for MySQL Administrative “Root” user and filed

Tested to see if LAMP now installed/running:
dpkg -s apache2 | grep Status
Came back with files and directory

dpkg -s php5 | grep Status
Note: didn’t come back installed, but maybe LAMP is a different version of PHP

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Note: This confirms I did the server upgrade correctly to 16.04

/usr/sbin/apache2 -V
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2017-09-18T15:09:02
Note: Looks like it installed version 2.4.18 of Apache

dpkg -s apache2 | grep Status
Status: install ok installed
Note: Really confirming that Apache is installed

mysql -u root -p
Note: I forgot that I had created a password for root.
mysql> select version();
| version() |
| 5.7.20-0ubuntu0.16.04.1 |
1 row in set (0.00 sec)
Note: Looks like I have version 5.7.29 of MySQL installed
Note: “quit” to quit out of MySQL prompt

php5 -v
No command ‘php5’ found, did you mean:
Command ‘php’ from package ‘php7.0-cli’ (main)
Note: Guess I don’t have version 5 of PHP

php -v
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies
Note: Confirmed I have version 7.0.22 installed

Nearly forgot to test to see if my webserver is up and running:
This is the default welcome page used to test the correct operation of the Apache2 server after installation on Ubuntu systems. It Works!

Looks like LAMP is installed, webserver is running, and now on to the next step…

Compilation of interests, thoughts and musings…