Difference between revisions of "Ubuntu Server 19.10 Zoneminder 1.33.x"

From ZoneMinder Wiki
Jump to navigationJump to search
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Ubuntu|<Home]]
'''Zoneminder 1.33.x on Ubuntu 19.10'''


Zoneminder 1.32 made it into the "official" Ubuntu 19.04 repositories.  
As of 31DEC19 there is no Zonemiinder 1.33.x package in the zoneminder-master PPA for Ubuntu 19.10. This uses Gdebi to install the Ubuntu Disco package.
Unfortunately the MP4 recording and playback does not work with the shipped version as there are missing libraries (libmp4v2-2).
So events can only be saved in jpeg-frames, video recordings do not happen.
[State: 01 MAY 2019]


These instructions will show how to install Zoneminder 1.32-3 from the iconnor ppa with mp4 support to use video recordings.
After installing a basic Ubuntu 19.10 OS add LAMP with Mariadb or MySQL.  


__TOC__


You will need to install LAMP then secure MySQL before installing Zoneminder.
===19.10 with Mariadb Server===
To install LAMP with Mariadb Server see: https://www.techsupportpk.com/2019/10/how-to-install-lamp-stack-ubuntu-1910.html


Become root


sudo su


Install Gdebi


'''Install needed packages:'''
apt install gdebi


sudo apt-get install x264 x265 build-essential checkinstall gdebi
Download the Zoneminder Disco .deb package


wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/18539544/+files/zoneminder_1.33.16~20200109103850-disco_arm64.deb


'''Note: if the above wget download fails with a can't find the file... check the zoneminder-master PPA for the correct file name. This will happen when the Zoneminder package is updated.'''


'''Secure MySQL or Mariadb:'''
Download libmp4v2-2


  mysql_secure_installation
  wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/17493816/+files/libmp4v2-2_2.0.0~dfsg0-6_amd64.deb


Download libmysqlclient20


Add entry into my.cnf:
wget http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.7/libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb


nano /etc/mysql/my.cnf
Install libmysqlclient20


gdebi libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb


Add the following to the end of the file:
Install libmp4v2-2


  [mysqld]
  gdebi libmp4v2-2_2.0.0~dfsg0-6_amd64.deb
sql_mode = NO_ENGINE_SUBSTITUTION


CTRL + o
Install Zoneminder
CTRL + x


Restart MySQL:
gdebi zoneminder_1.33.16~20200109103850-disco_arm64.deb
Fix permissions:


  service mysql restart
  chmod 740 /etc/zm/zm.conf
chown root:www-data /etc/zm/zm.conf
Enable and start Zoneminder


systemctl enable zoneminder.service
systemctl start zoneminder


Enable Apache Modules


'''Install the official repository for the current stable version 1.32:'''
a2enconf zoneminder
a2enmod rewrite
Restart Apache


  sudo add-apt-repository ppa:iconnor/zoneminder-1.32
  service apache2 reload


Now installing zoneminder by "sudo apt-get install zoneminder" will not work because of missing dependencies (as of 05/01/2019)
Open Zoneminder console and set your timezone under Options/Timezone


===19.10 with MySQL Server===
After installing a basic Ubuntu 19.10 OS add LAMP from tasksel


Become root


'''Download and compile libmp4v2-2:'''
sudo su


wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mp4v2/mp4v2-2.0.0.tar.bz2
Secure MySQL if you haven't already done it. Do not activate VALIDATE PASSWORD COMPONENT.
tar xf mp4v2-2.0.0.tar.bz2
cd mp4v2-2.0.0/
mkdir build/ && cd build/
../configure CXXFLAGS='-fpermissive' CFLAGS='-fpermissive'
make
Don't leave this folder.


mysql_secure_installation


Install libmp4v2-2 as debian package:
Edit MySQL configuration to use native password
nano /etc/mysql/mysql.conf.d/mysqld.cnf


sudo checkinstall
Below [mysqld] add
Follow the instructions on the screen.
Change the description values as following: '''Name=libmp4v2-2''', '''Version=2.0''', '''Provides=libmp4v2-2'''


default_authentication_plugin = mysql_native_password


CTRL + o to save
CTRL +x  to exit


We have to repack the zoneminder deb-package to fix the dependencies issue (libx264-155).
restart MySQL
Download the current deb-package:


  wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-1.32/+files/zoneminder_1.32.3-disco_amd64.deb
  systemctl restart mysql


Extract the deb-package:
Install Gdebi


  ar x zoneminder_1.32.3-disco_amd64.deb
  apt install gdebi
tar xf control.tar.xz


Rewrite the required dependencies:
Download the Zoneminder Disco .deb package
nano control
search for "libx264-155" and move it after "libx264-152 | ".


Repack the deb-package:
wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/18539544/+files/zoneminder_1.33.16~20200109103850-disco_arm64.deb


tar c {post,pre}{inst,rm} md5sums control | gzip -c > control.tar.gz
Download libmp4v2-2
ar rcs zoneminder_1.32.3-disco_repacked_amd64.deb debian-binary control.tar.gz data.tar.xz


wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/17493816/+files/libmp4v2-2_2.0.0~dfsg0-6_amd64.deb


Install Zoneminder:
Download libmysqlclient20


  sudo gdebi zoneminder_1.32.3-disco_repacked_amd64.deb
  wget http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.7/libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb


Install libmysqlclient20


gdebi libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb


The database is not created automatically. Create the database with:
Install libmp4v2-2


  mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
  gdebi libmp4v2-2_2.0.0~dfsg0-6_amd64.deb
mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"


mysqladmin -uroot -p reload
Install Zoneminder


gdebi zoneminder_1.33.16~20200109103850-disco_arm64.deb


Fix permissions:
Note: The Zoneminder package will not complete successfully and will show errors. This will be corrected in the next step.


chmod 740 /etc/zm/zm.conf
Create (overwrite) Zoneminder database
chown root:www-data /etc/zm/zm.conf
chown -R www-data:www-data /usr/share/zoneminder/


mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql


Enable Apache features:
Create user and set permissions (press Enter after each entry)


  sudo a2enmod cgi
  mysql (Enter MySQL processing)
sudo a2enmod rewrite
sudo a2enconf zoneminder
sudo service apache2 restart


mysql> CREATE USER 'zmuser'@localhost IDENTIFIED WITH mysql_native_password BY 'zmpass';


Add user www-data to group video, for accessing local cameras:
mysql> GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;


  sudo adduser www-data video
  mysql> FLUSH PRIVILEGES ;
sudo usermod -a -G video www-data


mysql> \q


Enable Zoneminder service:
Reload MySQL


  systemctl enable zoneminder.service
  mysqladmin -uroot -p reload


Fix permissions:


Add timezone to PHP:
chmod 740 /etc/zm/zm.conf
chown root:www-data /etc/zm/zm.conf
chown -R www-data:www-data /usr/share/zoneminder/


sudo nano /etc/php/7.2/apache2/php.ini
Enable and start Zoneminder
Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone


[Date]
systemctl enable zoneminder.service
; Defines the default timezone used by the date functions
systemctl start zoneminder
; http://php.net/date.timezone
date.timezone = America/New_York


CTRL +o Enter to save
Enable Apache Modules
CTRL +x to exit


a2enconf zoneminder
a2enmod rewrite
Restart Apache


Restart Apache and zoneminder
  service apache2 reload
 
  sudo service apache2 reload
sudo service zoneminder restart


Zoneminder should work! Open Zoneminder in a web browser (http://server-ip/zm).
Open Zoneminder console and set your timezone under Options/Timezone

Latest revision as of 13:42, 21 March 2020

Zoneminder 1.33.x on Ubuntu 19.10

As of 31DEC19 there is no Zonemiinder 1.33.x package in the zoneminder-master PPA for Ubuntu 19.10. This uses Gdebi to install the Ubuntu Disco package.

After installing a basic Ubuntu 19.10 OS add LAMP with Mariadb or MySQL.

19.10 with Mariadb Server

To install LAMP with Mariadb Server see: https://www.techsupportpk.com/2019/10/how-to-install-lamp-stack-ubuntu-1910.html

Become root

sudo su

Install Gdebi

apt install gdebi

Download the Zoneminder Disco .deb package

wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/18539544/+files/zoneminder_1.33.16~20200109103850-disco_arm64.deb

Note: if the above wget download fails with a can't find the file... check the zoneminder-master PPA for the correct file name. This will happen when the Zoneminder package is updated.

Download libmp4v2-2

wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/17493816/+files/libmp4v2-2_2.0.0~dfsg0-6_amd64.deb

Download libmysqlclient20

wget http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.7/libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb

Install libmysqlclient20

gdebi libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb

Install libmp4v2-2

gdebi libmp4v2-2_2.0.0~dfsg0-6_amd64.deb

Install Zoneminder

gdebi zoneminder_1.33.16~20200109103850-disco_arm64.deb

Fix permissions:

chmod 740 /etc/zm/zm.conf
chown root:www-data /etc/zm/zm.conf

Enable and start Zoneminder

systemctl enable zoneminder.service
systemctl start zoneminder 

Enable Apache Modules

a2enconf zoneminder
a2enmod rewrite

Restart Apache

service apache2 reload

Open Zoneminder console and set your timezone under Options/Timezone

19.10 with MySQL Server

After installing a basic Ubuntu 19.10 OS add LAMP from tasksel

Become root

sudo su

Secure MySQL if you haven't already done it. Do not activate VALIDATE PASSWORD COMPONENT.

mysql_secure_installation

Edit MySQL configuration to use native password

nano /etc/mysql/mysql.conf.d/mysqld.cnf

Below [mysqld] add

default_authentication_plugin = mysql_native_password

CTRL + o to save CTRL +x to exit

restart MySQL

systemctl restart mysql

Install Gdebi

apt install gdebi

Download the Zoneminder Disco .deb package

wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/18539544/+files/zoneminder_1.33.16~20200109103850-disco_arm64.deb

Download libmp4v2-2

wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/17493816/+files/libmp4v2-2_2.0.0~dfsg0-6_amd64.deb

Download libmysqlclient20

wget http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.7/libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb

Install libmysqlclient20

gdebi libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb

Install libmp4v2-2

gdebi libmp4v2-2_2.0.0~dfsg0-6_amd64.deb

Install Zoneminder

gdebi zoneminder_1.33.16~20200109103850-disco_arm64.deb

Note: The Zoneminder package will not complete successfully and will show errors. This will be corrected in the next step.

Create (overwrite) Zoneminder database

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql

Create user and set permissions (press Enter after each entry)

mysql (Enter MySQL processing)
mysql> CREATE USER 'zmuser'@localhost IDENTIFIED WITH mysql_native_password BY 'zmpass';
mysql> GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES ;
mysql> \q

Reload MySQL

mysqladmin -uroot -p reload

Fix permissions:

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

Enable and start Zoneminder

systemctl enable zoneminder.service
systemctl start zoneminder 

Enable Apache Modules

a2enconf zoneminder
a2enmod rewrite

Restart Apache

service apache2 reload

Open Zoneminder console and set your timezone under Options/Timezone