How to Install ZoneMinder on Ubuntu 16.04

To Install ZoneMinder on Ubuntu 16.04

ZoneMinder is a free, open source application for operating your security cameras developed for Linux and FreeBSD. It is Web-based, so you need a LAMP stack and some knowledge of running a Web server. Then you need supported cameras, and some twiddling in Zoneminder' s multitude of options to get them working the way you want. It is so simple to install ZoneMinder on Ubuntu 16.04.

Installing ZoneMinder

First, you need to install the LAMP, so install it with tasksel.

root@linuxhelp:~#  tasksel install lamp-server

Once the installation is done, you need to update the repository.

ZoneMinder 1.29.0 is now part of the current standard Ubuntu repository. But if you wish to install the later releases of ZoneMinder you will need to add the iconnor /zoneminder PPA.

root@linuxhelp:~# add-apt-repository ppa:iconnor/zoneminder
Stable releases of ZoneMinder.
This is to provide newer official packages for older ubuntu dists.
If you would like to make a donation to directly support this ppa, you may do so by sending paypal to < email address hidden>  or send bitcoin to
.
.
a [4,712 B]
Fetched 4,129 kB in 15s (258 kB/s)                                                                 
Reading package lists... Done

Once the repo is added, you shall update it by making use of the following command.

root@linuxhelp:~#apt-get update

Reading package lists... Done
Building dependency tree      
Reading state information... Done
Calculating upgrade... Done
.
.
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for resolvconf (1.78ubuntu5) ...

Also, you need to upgrade and for that make use of the following command.

root@linuxhelp:~#apt-get upgrade
root@linuxhelp:~#apt-get dist-upgrade

Reading package lists... Done
Building dependency tree      
Reading state information... Done.
.
.
Setting up update-manager (1:16.04.10) ...
Setting up update-notifier (3.168.5) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

Once it is done, you need to configure your MySQL database. Since some of the new defaults in MySQL 5.7 are currently causing some issues with ZoneMinder, it is suggested 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.

In order to change the MySQL settings, you need to make use of the following command.

root@linuxhelp:~# nano /etc/mysql/my.cnf

In the [mysqld] section add the following

sql_mode = NO_ENGINE_SUBSTITUTION

Save it and exit once it is done.

Next, you need to restart MySQL as follows.

root@linuxhelp:~# systemctl restart mysql

Now, you shall proceed with the installation of ZoneMinder, and that can be done by making use of the following command.

root@linuxhelp:~# apt-get install zoneminder

Next, you need to configure the ZoneMinder Database. Make sure you run the following commands for the same process.

root@linuxhelp:~# mysql -uroot -p <  /usr/share/zoneminder/db/zm_create.sql
root@linuxhelp:~# mysql -uroot -p -e " grant select,insert,update,delete,create,alter,index,lock tables on zm.* to ' zmuser' @localhost identified by ' zmpass'  " 

After that, you need to set permissions. You need to set /etc/zm/zm.conf to root:www-data 740 and www-data access to content.

root@linuxhelp:~# chmod 740 /etc/zm/zm.conf
root@linuxhelp:~# chown root:www-data /etc/zm/zm.conf
root@linuxhelp:~# chown -R www-data:www-data /usr/share/zoneminder/

And now you need to configure Apache correctly by making use of the following command.

root@linuxhelp:~# a2enconf zoneminder

Enabling conf zoneminder.
To activate the new configuration, you need to run:
  service apache2 reload

You are enabling a conf Zoneminder.

root@linuxhelp:~# a2enmod cgi

AH00557: apache2: apr_sockaddr_info_get() failed for linuxhelp
AH00558: apache2: Could not reliably determine the server' s fully qualified domain name, using 127.0.0.1. Set the ' ServerName'  directive globally to suppress this message
Enabling module cgi.
To activate the new configuration, you need to run:
  service apache2 restart

And then, you need to rewrite the enabling module, make use of the following command.

root@linuxhelp:~# a2enmod rewrite

Enabling module rewrite.
To activate the new configuration, you need to run:
  service apache2 restart

Now you shall enable and start Zoneminder by making use of the following two commands.

root@linuxhelp:~# systemctl enable zoneminder
root@linuxhelp:~# systemctl start zoneminder

And after that, you need to edit Timezone in PHP, so run the following command to execute that action.

root@linuxhelp:~# 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](http://php.net/manual/en/timezones.php). Don’ t forget to remove the from in front of date.timezone

[Date]
  Defines the default timezone used by the date functions
  http://php.net/date.timezone
date.timezone = America/New_York

Once it is done, you need to save and exit from the file.

And now, you need to reload the Apache service by making use of the following command.

root@linuxhelp:~# systemctl reload apache2

Everything is done, and if you want to make sure that your ZoneMinder works, then you need to open your browser and go to http://hostname_or_ip/zm. It should bring up ZoneMinder Console.

With this, the installation of Zoneminder on Ubuntu 16.04 comes to an end.

Comment
simonfear
Mar 03 2019
Hello I have followed your video and have installed Zoneminder even the addtions as I am running Ubuntu 18. When I go to the web page localhost/zm I get the below text file

//
// ZoneMinder main web interface file, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
namespace ZM;

error_reporting(E_ALL);

The file goes on

This is displays on all machines connecting to the server. Apache is running but I am not able to find the next steps to trouble shoot has anyone else experienced this?
Add a comment
FAQ
Q
What is usage of zoneminder?
A
ZoneMinder is an integrated set of applications which provide a complete surveillance solution allowing capture, analysis, recording and monitoring of any CCTV or security cameras attached to a Linux based machine. It is designed to run on distributions which support the Video For Linux (V4L) interface and has been tested with video cameras attached to BTTV cards, various USB cameras and also supports most IP network cameras.
Q
How do I enable ZoneMinder’s security?
A
In the console, click on Options. Check the box next to “ZM_OPT_USE_AUTH”. You will immediately be asked to login. The default username is ‘admin’ and the password is ‘admin’.

To Manage Users: In main console, go to Options->Users.

You may also consider to use the web server security, for example, htaccess files under Apache scope; You may even use this as an additional/redundant security on top of Zoneminders built-in security features;
Q
What is zoneminder?
A
ZoneMinder is a free, open source closed-circuit television software application developed for Linux and FreeBSD. It is released under the terms of the GNU General Public License. ZoneMinder is controlled via web based interface and also provides LiveCD. Application can use standard cameras or IP based camera devices.
Q
where I can download latest version of zoneminder?
A
use the following link to download latest version of zoneminder, https://zoneminder.com/downloads/
Q
mention some of the alternatives for zoneminder?
A
use the alternatives for zoneminder are
Shinobi,
Kerberos.IO,
MotionEye.