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

From ZoneMinder Wiki
Jump to navigationJump to search
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. 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]


After installing a basic Ubuntu 19.10 OS add LAMP with Mariadb. See: https://www.techsupportpk.com/2019/10/how-to-install-lamp-stack-ubuntu-1910.html


These instructions will show how to install Zoneminder 1.32-3 from the iconnor ppa with mp4 support to use video recordings.
Become root
 
''N.B.: The version from iconnor ppa has an issue with the required dependencies for libx264 on Ubuntu 19.04, we have to correct this by manually repacking the deb-package.''
 
 
You will need to install LAMP then secure MySQL before installing Zoneminder.
see: https://help.ubuntu.com/community/ApacheMySQLPHP
 
 
 
'''26MAY19 - Added a one step shell script to install Zoneminder 1.32.3 on Ubuntu 19.04 AMD64. This uses files created from the following procedure. See #5 in the menu'''
 
The manual instructions have been tested to work with an RPI3 and Ubuntu 19.04.
 
 
 
== Preparations ==
 
 
'''Install needed packages:'''
 
sudo apt-get install x264 x265 build-essential checkinstall gdebi
 
 
 
'''Secure MySQL or Mariadb:'''
 
mysql_secure_installation
 
 
Add entry into my.cnf:
 
nano /etc/mysql/my.cnf


sudo su


Add the following to the end of the file:
Install Gdebi


  [mysqld]
  apt install gdebi
sql_mode = NO_ENGINE_SUBSTITUTION


CTRL + o
Download the Zoneminder Disco .deb package
CTRL + x


Restart MySQL:
wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-master/+build/18492553/+files/zoneminder_1.33.16~20191229135312-disco_amd64.deb


service mysql restart
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


'''Install the official repository for the current stable version 1.32:'''
wget http://security.ubuntu.com/ubuntu/pool/main/m/mysql-5.7/libmysqlclient20_5.7.28-0ubuntu0.19.04.2_amd64.deb


sudo add-apt-repository ppa:iconnor/zoneminder-1.32
Install libmysqlclient20


Now installing zoneminder by "sudo apt-get install zoneminder" will not work because of missing dependencies (as of 05/01/2019)
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


== Installing libmp4v2-2 ==
gdebi zoneminder_1.33.16~20191229135312-disco_amd64.deb


 
Fix permissions:
'''Download and compile libmp4v2-2:'''
 
wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mp4v2/mp4v2-2.0.0.tar.bz2
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.
 
 
'''Install libmp4v2-2 as debian package:'''
 
sudo checkinstall
Follow the instructions on the screen. Enter anything for the description (e.g. Libraries for Zoneminder MP4 support). On the table of values: change the entries as following:
* Name='''''libmp4v2-2'''''
* Version='''''2.0'''''
* Provides='''''libmp4v2-2'''''
 
== Repacking zoneminder deb-package and installation ==
 
 
We have to repack the zoneminder deb-package to fix the dependencies issue (libx264-155).
 
Download the current deb-package:
 
wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder-1.32/+files/zoneminder_1.32.3-disco_amd64.deb
 
Extract the deb-package:
 
ar x zoneminder_1.32.3-disco_amd64.deb
tar xf control.tar.xz
 
Rewrite the required dependencies:
nano control
search for "libx264-155" and move it after "libx264-152 | ".
 
Repack the deb-package:
 
tar c {post,pre}{inst,rm} md5sums control | gzip -c > control.tar.gz
ar rcs zoneminder_1.32.3-disco_repacked_amd64.deb debian-binary control.tar.gz data.tar.xz
 
 
'''Install Zoneminder:'''
 
sudo gdebi zoneminder_1.32.3-disco_repacked_amd64.deb
Other missing dependencies will automaticely be installed.
 
 
 
 
== Post-installation procedures ==
 
 
'''Create the Database:'''
 
The database is not created automatically. Create the database with:
 
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
 
 
'''Fix permissions:'''


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


 
Enable and start Zoneminder
'''Enable Apache features:'''
 
sudo a2enmod cgi
sudo a2enmod rewrite
sudo a2enconf zoneminder
sudo service apache2 restart
 
 
Add user www-data to group video, for accessing local cameras:
 
sudo adduser www-data video
sudo usermod -a -G video www-data
 
 
'''Enable Zoneminder service:'''


  systemctl enable zoneminder.service
  systemctl enable zoneminder.service
systemctl start zoneminder


Enable Apache Modules


'''Add timezone to PHP:'''
sudo nano /etc/php/7.2/apache2/php.ini
Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Luxembourg
CTRL +o Enter to save, then CTRL +x to exit
'''Finally, restart Apache and zoneminder'''
sudo service apache2 reload
sudo service zoneminder restart
'''Zoneminder should work!''' Open Zoneminder in a web browser (http://server-ip/zm).
==Install Zoneminder with MP4 support on Ubuntu 19.04 AMD64 with shell script==
This will install Zoneminder by using a shell script with one basic command (how easy is that!).
You will need a Ubuntu 19.04 installed desktop or server. This script installs Apache2, Mariadb Server and PHP. If you want to use MySQL replace mariadb-server with mysql-server in the script.
Become root
sudo su
Create the install file
nano install-zm
Copy the following into the file
#!/bin/sh
clear
read -p "This script installs Apache2, Mariadb Server, PHP and Zoneminder 1.32.3 with MP4 support on Ubuntu 19.04 AMD64.
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "You must be logged in as root using sudo su before running this script...
The script will stop and prompt for user action as required
Press Enter to continue or Ctrl + c to quit" nothing
clear
apt -y install apache2 php mariadb-server php-mysql libapache2-mod-php7.2 x264 x265 gdebi
clear
read -p "Next secure MySQL server by entering requested information. Press enter to continue" nothing
mysql_secure_installation
clear
read -p "Next we will download the libmp4v2 package and install it.
Press enter to continue" nothing
wget -O /tmp/libmp4v2-2_2.0-1_amd64.deb --no-check-certificate "https://onedrive.live.com/download?cid=DECAED2A9DCA1993&resid=DECAED2A9DCA1993%2127788&authkey=AIRJsHH6TkX22R8"
apt -y install /tmp/libmp4v2-2_2.0-1_amd64.deb
clear
read -p "Next we will download the Zoneminder (patched) package and install it.
Press enter to continue" nothing
wget -O /tmp/zoneminder_1.32.3-disco_repacked_amd64.deb --no-check-certificate "https://onedrive.live.com/download?cid=DECAED2A9DCA1993&resid=DECAED2A9DCA1993%2127790&authkey=AAa7rrbW8NadXos"
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
gdebi /tmp/zoneminder_1.32.3-disco_repacked_amd64.deb
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enmod cgi
  a2enconf zoneminder
  a2enconf zoneminder
  a2enmod rewrite
  a2enmod rewrite
  chmod 740 /etc/zm/zm.conf
   
chown root:www-data /etc/zm/zm.conf
Restart Apache
chown -R www-data:www-data /usr/share/zoneminder/
 
  service apache2 reload
  service apache2 reload
clear
read -p "Open Zoneminder in a web browser (http://server-ip/zm).
Press enter to continue" nothing
clear
Save and close the file
CTRL+o
CTRL+x
Set permissions
chmod 755 install-zm
Run the file
./install-zm
The script will prompt for user action several times. I have run this script installing Mariadb or MySQL with a functional system with either database server. I do, however, prefer Mariadb. I also recommend running mysqltuner after adding cameras and periodically to tune database settings as events are stored.


You do not need to add the Zoneminder PPA for this install but it may be needed in the future when Zoneminder is updated.
Open Zoneminder console and set your timezone under Options/Timezone

Revision as of 11:28, 31 December 2019

Zoneminder 1.33.x on Ubuntu 19.10

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

After installing a basic Ubuntu 19.10 OS add LAMP with Mariadb. 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/18492553/+files/zoneminder_1.33.16~20191229135312-disco_amd64.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~20191229135312-disco_amd64.deb

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