Difference between revisions of "Ubuntu Server 19.04 Zoneminder 1.32.3"

From ZoneMinder Wiki
Jump to navigationJump to search
m
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Zoneminder 1.28.0 on Ubuntu 14.04. Also works on Ubuntu 14.10 running init.
'''While this procedure still works a version with full support including MP4 can be found here: https://wiki.zoneminder.com/Ubuntu_Server_19.04_Zoneminder_1.32.3_(with_mp4_support)'''


I did this install on a 64 BIT server but it should work on 32 BIT. As of 20OCT14 I have tested this with a local USB camera and a remote h.264 camera with Ffmpeg and Libvlc.


If you install from CD install Ubuntu Server, OpenSSH Server, and LAMP Server (LAMP installs Apache2, PHP, and MySQL server)


If you use the minimum ISO CD install Basic Server, OpenSSH Server, and LAMP Server (LAMP installs Apache2, PHP, and MySQL server)
'''Ubuntu Server 19.04 with Zoneminder 1.32.2'''


Log in then become root:
29MAR19 This was done with Ubuntu 19.04 Beta which contains Zoneminder 1.32.3. This is a preliminary procedure and may not work as changes are made to the release.


sudo su
'''Note-30MAR19 - The MP4 recording and playback does not work as there are missing libraries. If you install this switch to saving jpeg's.'''


If you used the server install CD
Install Ubuntu Server from the Ubuntu Server Live install.
apt-get update
apt-get upgrade
apt-get dist-upgrade


Optional: Set static IP address
Note: If you want to remove the cloud services see: https://nucco.org/2018/05/ubuntu-18-04-chronicles-removing-cloud-init.html


nano /etc/network/interfaces
My install did not allow the time zone to be set in the install. To set the time zone:


Make changes similar to this:
nano /etc/timezone


auto eth0
Change the UTC to your local area and time zone such as America/New_York
iface eth0 inet static
  address 192.168.1.10
  netmask 255.255.255.0
  gateway 192.168.1.1
  dns-nameservers 192.168.1.1


Note: for Ubuntu 14.04 the resolv.conf is dynamically assigned. The "dns-servers" entry in the interfaces file will set the DNS Multiple DNS server entries can be used.
Ctrl+o Enter to save


Reboot server
CTRL+x to exit


Log in and become root
Install ntp and ntpdate


  sudo su
  apt install ntp ntpdate


Suggested changes to MySQL
Copy your zoneinfo file as shown. Use your time zone:


For most of you Zoneminder will run just fine with the default MySQL settings. There are a couple of settings that may, in time, provide beneficial especially if you have a number of cameras and many events with a lot of files. One setting I recommend is the "innodb_file_per_table" This will be a default setting in MySQL 5.6 but should be added in MySQL 5.5 which comes with Ubuntu 14.04. A description can be found here: http://dev.mysql.com/doc/refman/5.5/en/innodb-multiple-tablespaces.html
cp /usr/share/zoneinfo/America/New_York /etc/localtime


To add "innodb_file_per_table" edit the my.cnf file:
Optional: to disable auto updates edit:


  nano /etc/mysql/my.cnf
  nano /etc/apt/apt.conf.d/20auto-upgrades


Under [mysqld] add
Change the "1" to "0"
 
innodb_file_per_table


Ctrl+o Enter to save
Ctrl+o Enter to save
Line 53: Line 41:
CTRL+x to exit
CTRL+x to exit


Restart MySQL
Restart your server.
 
service mysql restart
 
As you add cameras to your system and the events build up you may need to increase the size of the "innodb_buffer_pool_size" when this setting runs out of space your system may act like it is out of disk space. One way to check this is to install mysqltuner and run it from the command line. When the results are shown you can edit the my.cnf file and change the buffer size. The default "innodb_buffer_pool_size" is 128M. In the ZM forum I have found a recommended setting of 256M. My production server required a setting greater than 410M. Install and run mysqltuner to determine the recommended size for your system. Be sure to restart MySQL after making changes.
 
CGI is not enabled in Ubuntu 14.04 by default. Enable it this way:
 
a2enmod cgi
 
Restart Apache
 
/etc/init.d/apache2 force-reload


or
Install Apache2, Mariadb and PHP (I use Mariadb because of some password length issues with the newer version of MySQL)


  service apache2 restart
  apt install apache2 php mariadb-server php-mysql libapache2-mod-php7.2


Add Repository
Next secure Mariadb server by entering requested information.


  apt-get install software-properties-common python-software-properties
  mysql_secure_installation
add-apt-repository ppa:iconnor/zoneminder
apt-get update


Install Zoneminder
Install Zoneminder


  apt-get install zoneminder
  apt install zoneminder
 
Note: a couple of package configurations will open up. These are to configure Nullmailer. You can just OK them and come back to configure them later.
 
You will need to install "extra" VLC components torun Libvlc (verified 20OCT14)
 
apt-get install libvlc-dev libvlccore-dev vlc
 
Add delay to allow MySQL to start before Zoneminder


nano /etc/init.d/zoneminder
The database is not created automatically. Create the database with


Add sleep 15 as shown:
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql


  start() {
  mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
      sleep 15
      echo -n "Starting $prog: "


Ctrl+o Enter to save
mysqladmin -uroot -p reload


CTRL+x to exit
Fix permissions


Create a directory in apache2
chmod 740 /etc/zm/zm.conf


  mkdir /etc/apache2/conf.d
  chown root:www-data /etc/zm/zm.conf


Create two symbolic links
chown -R www-data:www-data /usr/share/zoneminder/


ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
Enable Zoneminder service


  ln -s /etc/zm/apache.conf /etc/apache2/conf-enabled/zoneminder.conf
  systemctl enable zoneminder.service


 
Add a user for local cameras
Create a new user


  adduser www-data video
  adduser www-data video


Restart Apache
Enable Apache Features


  /etc/init.d/apache2 force-reload
  a2enmod cgi


or
a2enmod rewrite


  service apache2 restart
  a2enconf zoneminder


Note: There is a slight bug that causes the screen to not refresh when a camera is added. In a terminal edit file:
Add timezone to PHP


  sudo nano /usr/share/zoneminder/skins/classic/js/skin.js
  nano /etc/php/7.2/apache2/php.ini


search for and remove line:
Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone


window.addEvent( 'domready', checkSize);
[Date]
 
; Defines the default timezone used by the date functions
(should be line 89)
; http://php.net/date.timezone
 
date.timezone = America/New_York
add the line to the end of the file as shown below:
 
{
      windowToFront();
}
window.addEvent( 'domready', checkSize);
 
Save the edited file (CTRL+o then CTRL+x)
 
Restart Zoneminder
 
Install Cambozola (needed if you use Internet Explorer)
 
 
cd /usr/src && wget http://www.andywilcock.com/code/cambozola/cambozola-latest.tar.gz
 
tar -xzvf cambozola-latest.tar.gz
 
replace 935 with cambozola version downloaded
 
cp cambozola-0.935/dist/cambozola.jar /usr/share/zoneminder
 
You should now be able to access the web server using https://servername
 
NTP Daily Sync
 
nano /etc/cron.daily/ntpdate
 
Copy the following into nano
 
!/bin/sh
ntpdate ntp.ubuntu.com


Ctrl+o Enter to save
Ctrl+o Enter to save
Line 171: Line 102:
CTRL+x to exit
CTRL+x to exit


chmod 755 /etc/cron.daily/ntpdate
Start Zoneminder


Open Zoneminder in web browser
service zoneminder start


http://serverip/zm
Restart Apache
 
Click Options
 
Uncheck: Check with zoneminder.com for updated versions (?) click Save


Click Images tab
service apache2 reload


check Is the (optional) cambozola java streaming client installed (?) Click Save
Zoneminder should work! Open Zoneminder in a web browser (http://server-ip/zm).

Latest revision as of 13:06, 26 May 2019

While this procedure still works a version with full support including MP4 can be found here: https://wiki.zoneminder.com/Ubuntu_Server_19.04_Zoneminder_1.32.3_(with_mp4_support)


Ubuntu Server 19.04 with Zoneminder 1.32.2

29MAR19 This was done with Ubuntu 19.04 Beta which contains Zoneminder 1.32.3. This is a preliminary procedure and may not work as changes are made to the release.

Note-30MAR19 - The MP4 recording and playback does not work as there are missing libraries. If you install this switch to saving jpeg's.

Install Ubuntu Server from the Ubuntu Server Live install.

Note: If you want to remove the cloud services see: https://nucco.org/2018/05/ubuntu-18-04-chronicles-removing-cloud-init.html

My install did not allow the time zone to be set in the install. To set the time zone:

nano /etc/timezone

Change the UTC to your local area and time zone such as America/New_York

Ctrl+o Enter to save

CTRL+x to exit

Install ntp and ntpdate

apt install ntp ntpdate

Copy your zoneinfo file as shown. Use your time zone:

cp /usr/share/zoneinfo/America/New_York /etc/localtime 

Optional: to disable auto updates edit:

nano /etc/apt/apt.conf.d/20auto-upgrades

Change the "1" to "0"

Ctrl+o Enter to save

CTRL+x to exit

Restart your server.

Install Apache2, Mariadb and PHP (I use Mariadb because of some password length issues with the newer version of MySQL)

apt install apache2 php mariadb-server php-mysql libapache2-mod-php7.2

Next secure Mariadb server by entering requested information.

mysql_secure_installation

Install Zoneminder

apt install zoneminder

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
chown root:www-data /etc/zm/zm.conf
chown -R www-data:www-data /usr/share/zoneminder/

Enable Zoneminder service

systemctl enable zoneminder.service

Add a user for local cameras

adduser www-data video

Enable Apache Features

a2enmod cgi
a2enmod rewrite
a2enconf zoneminder

Add timezone to PHP

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 = America/New_York

Ctrl+o Enter to save

CTRL+x to exit

Start Zoneminder

service zoneminder start

Restart Apache

service apache2 reload

Zoneminder should work! Open Zoneminder in a web browser (http://server-ip/zm).