Difference between revisions of "Ubuntu Server 18.04 64-bit with Zoneminder 1.32.x the easy way"

From ZoneMinder Wiki
Jump to navigationJump to search
m
 
(39 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This "Easy" install will use the Snapshot version of Zoneminder from the PPA "master." Be advised
[[Ubuntu|<Home]]


that sometimes there are bugs in the snapshot version. My experience is that everything important
__TOC__


in Zoneminder does work.
===Things to check before installing Zoneminder on Bionic!===


If you install Ubuntu from server CD, install OpenSSH Server, and LAMP Server (LAMP installs
'''We recommend you read the release notes to see what has changed in this version. The release notes can be found here: https://github.com/ZoneMinder/zoneminder/releases'''


Apache2, PHP, and MySQL server)
'''There have been some reports of the install failing. We feel this is due to missing repositories in the sources.list. You can check this by running


If you use the minimum Ubuntu ISO CD, install Basic Server, OpenSSH Server, and LAMP Server (LAMP
nano /etc/apt/sources.list


installs Apache2, PHP, and MySQL server)
Look for the universe repositories of which there should be three, bionic universe, bionic-updates universe and bionic-security universe


Log in then become root:
See: https://help.ubuntu.com/community/Repositories/CommandLine'''


  sudo su
===Install Zoneminder on Ubuntu 18.04 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 18.04 install with LAMP (Apache, MySQL and PHP) installed desktop or server. As an alternate you may use Mariadb in lieu of MySQL
 
Shell script file contents:
 
  #!/bin/sh
clear
read -p "This script installs Zoneminder 1.32.x on Ubuntu 18.04 AMD64 with LAMP (MySQL) installed...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "You must be logged in as root using sudo su ...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "Next we will add the PPA repository, install and configure the system to run Zoneminder.
Press enter to continue" nothing
apt install -y software-properties-common
clear
add-apt-repository ppa:iconnor/zoneminder-1.32
apt update
clear
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Install complete.Press enter to continue" nothing
clear
 
Copy the contents of the script, open a terminal and run:
 
nano zm-install
 
Paste the contents of the script into Nano
 
Then:
 
Ctrl + o
Ctrl + x
 
Next run:
 
chmod 755 zm-install
 
Start the script by entering:
 
./zm-install
 
Follow the prompts. Things are pretty simple. The timezone will be detected from the OS and added to the php.ini.
 
Good Luck!
 
While this script worked for me I can't be responsible if you loose data when you run this. It is intended for a new install not an upgrade.
 
===Install Apache2, Mariadb, PHP and Zoneminder on Ubuntu 18.04 with shell script===


If you used the server install CD
I created this to install Zoneminder on a Raspberry Pi 3B+ 64 BIT version of Bionic. Should work with other flavors of Bionic
apt-get update
apt-get upgrade
apt-get dist-upgrade


Optional: Set static IP address
See above for use


  nano /etc/network/interfaces
  #!/bin/sh
clear
read -p "This script installs Apache2, Mariadb Server, PHP and Zoneminder 1.32.x on Ubuntu 18.04 ...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "You must be logged in as root using sudo su ...
Press Enter to continue or Ctrl + c to quit" nothing
apt install -y apache2 php mariadb-server php-mysql libapache2-mod-php7.2
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 add the PPA repository, install and configure the system to run Zoneminder.
Press enter to continue" nothing
apt install -y software-properties-common
clear
add-apt-repository ppa:iconnor/zoneminder-1.32
apt update
clear
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Install complete.Press enter to continue" nothing
clear


Make changes similar to this:
===Ubuntu 18.04 LEMP (NGNIX, Mariadb, PHP)===


auto eth0
Thanks to "terdinglage" for the input to get this to work!
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


Start with a basic Ubuntu 18.04 install. You can use a server or desktop install. Do not install LAMP!


Reboot server
Become root


CGI is not enabled in Ubuntu 15.04 by default. Enable it this way:
sudo su


a2enmod cgi
Install Ngnix, Mariadb and PHP components


Restart Apache
apt install nginx mariadb-server php-fpm php-mysql fcgiwrap


service apache2 restart
Secure the Mariadb server


Add Repository
mysql_secure_installation


apt-get install python-software-properties
Restart Mariadb
add-apt-repository ppa:iconnor/zoneminder-master
apt-get update


Install Zoneminder
systemctl restart mysql


apt-get install zoneminder
Edit the php.ini file


You may need to install "extra" VLC components (I will check this and edit as needed)
nano /etc/php/7.2/fpm/php.ini


apt-get install libvlc-dev libvlccore-dev vlc
Locate (Ctrl+w) cgi.fix_pathinfo=1 and change to


Note: as of the latest Snapshot builds the zoneminder.service file is included. Am leaving this section in place for reference.
cgi.fix_pathinfo=0
-------------------------------------------------------------------------------------------------------------------------------
Create a file called zoneminder.service


  nano /lib/systemd/system/zoneminder.service
Remember to remove the leading ;


Paste or enter the following:
Also fix date. Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone. Make sure to remove the ; from the front of date.timezone


  # ZoneMinder systemd unit file
[Date]
  # This file is intended to work with all Linux distributions
; Defines the default timezone used by the date functions
  [Unit]
; http://php.net/date.timezone
  Description=ZoneMinder CCTV recording and security system
date.timezone = America/New_York
  After=network.target mysql.service apache2.service
  Requires=mysql.service apache2.service
  [Service]
  User=www-data
  Type=forking
  ExecStart=/usr/bin/zmpkg.pl start
  ExecReload=/usr/bin/zmpkg.pl restart
  ExecStop=/usr/bin/zmpkg.pl stop
  PIDFile="/run/zm/zm.pid"
  [Install]
  WantedBy=multi-user.target


Ctrl+o Enter to save
Ctrl+o Enter to save
CTRL+x to exit
---------------------------------------------------------------------------------------------------------------------------------
Create a file called zoneminder.conf


nano /etc/tmpfiles.d/zoneminder.conf
CTRL+x to exit
 
Restart php-fpm


Paste or enter the following
systemctl restart php7.2-fpm


d /var/run/zm 0755 www-data www-data


CTRL+o to save the file
Add Repository
CTRL+x to exit nano


Change permissions on the file
NOTE:You may need to run: "apt install software-properties-common" if you did the minimal net install of Ubuntu.


  chmod 755 /etc/tmpfiles.d/zoneminder.conf
  add-apt-repository ppa:iconnor/zoneminder-1.32


Enable Zoneminder


systemctl enable zoneminder.service
Install Zoneminder


Start Zoneminder
apt install zoneminder


systemctl start zoneminder.service
Create a new user if you plan to use local (USB or capture card) cameras.


Check to see that Zoneminder is running
adduser www-data video


systemctl status zoneminder.service
Fix Permissions


Create a directory in apache2
chown -R www-data:www-data /usr/share/zoneminder/


mkdir /etc/apache2/conf.d
Change the ZM_PATH_ZMS in the 01-system-paths.conf file to /cgi-bin/nph-zms by dropping the /zm/  


Create two symbolic links
nano /etc/zm/conf.d/01-system-paths.conf


ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
Ctrl+o Enter to save


ln -s /etc/zm/apache.conf /etc/apache2/conf-enabled/zoneminder.conf
CTRL+x to exit


Enable and start Zoneminder


Create a new user
systemctl enable zoneminder


  adduser www-data video
  service zoneminder start


Restart Apache


service apache2 restart
Edit the Ngnix default configuration.


Install Cambozola (needed if you use Internet Explorer)
nano /etc/nginx/sites-available/default


Locate the line "index index.html index.htm index.nginx-debian.html;" and add index.php


  cd /usr/src && wget http://www.andywilcock.com/code/cambozola/cambozola-latest.tar.gz
  index index.php index.html index.htm index.nginx-debian.html;


tar -xzvf cambozola-latest.tar.gz
In the "server" section after listen [::] :80 default_Server; add


  replace 936 with cambozola version downloaded
  include /etc/nginx/zoneminder.conf;


cp cambozola-0.936/dist/cambozola.jar /usr/share/zoneminder
Ctrl+o Enter to save


You should now be able to access the web server using https://servername
CTRL+x to exit


Optional NTP Daily Sync
Create a Zoneminder conf file


  nano /etc/cron.daily/ntpdate
  nano /etc/nginx/zoneminder.conf


Copy the following into nano
Enter the following into the zoneminder.conf file (This file was improved by databoy2k)


  !/bin/sh ntpdate ntp.ubuntu.com
  location /cgi-bin {
auth_basic off;
        alias /usr/lib/zoneminder/cgi-bin;   
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param HTTP_PROXY "";
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location /zm/cache {
auth_basic off;
        alias /var/cache/zoneminder/cache;
}
location ~ /zm/api/(css|img|ico) {
auth_basic off;
        rewrite ^/zm/api(.+)$ /api/app/webroot/$1 break;
        try_files $uri $uri/ =404;
}
location /zm {
auth_basic off;
        alias /usr/share/zoneminder/www;
        try_files $uri $uri/ /index.php?$args =404;   
        location /zm/api {
auth_basic off;
                rewrite ^/zm/api(.+)$ /zm/api/app/webroot/index.php?p=$1 last;
          }
                location ~ \.php$ {
                auth_basic off;
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_param HTTP_PROXY "";
                fastcgi_index index.php;
                        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }
    }


Ctrl+o Enter to save
Ctrl+o Enter to save


CTRL+x to exit
CTRL+x to exit  
 
Restart Ngnix
 
service nginx restart
 
Note: If Nginx gives you an error on restart go back one step and re-enter include /etc/ngnix/zoneminder.conf;


chmod 755 /etc/cron.daily/ntpdate
Note: 29JUL18 Thanks to Tiver for this suggestion that seems to work with the fcgiwrap issue.


Open Zoneminder in web browser
If it does not exist create


http://serverip/zm
nano /etc/default/fcgiwrap


Click Options
and insert (with the number of children -c equal to the number of cameras)


Uncheck: Check with zoneminder.com for updated versions (?) click Save
DAEMON_OPTS=-c 10


Click Images tab
then restart the fcgiwrap service.


check Is the (optional) cambozola java streaming client installed (?) Click Save
systemctl restart fcgiwrap

Latest revision as of 17:17, 18 March 2019

<Home

Things to check before installing Zoneminder on Bionic!

We recommend you read the release notes to see what has changed in this version. The release notes can be found here: https://github.com/ZoneMinder/zoneminder/releases

There have been some reports of the install failing. We feel this is due to missing repositories in the sources.list. You can check this by running

nano /etc/apt/sources.list

Look for the universe repositories of which there should be three, bionic universe, bionic-updates universe and bionic-security universe

See: https://help.ubuntu.com/community/Repositories/CommandLine

Install Zoneminder on Ubuntu 18.04 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 18.04 install with LAMP (Apache, MySQL and PHP) installed desktop or server. As an alternate you may use Mariadb in lieu of MySQL

Shell script file contents:

#!/bin/sh
clear
read -p "This script installs Zoneminder 1.32.x on Ubuntu 18.04 AMD64 with LAMP (MySQL) installed...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "You must be logged in as root using sudo su ...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "Next we will add the PPA repository, install and configure the system to run Zoneminder. 
Press enter to continue" nothing
apt install -y software-properties-common
clear
add-apt-repository ppa:iconnor/zoneminder-1.32
apt update
clear
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Install complete.Press enter to continue" nothing
clear

Copy the contents of the script, open a terminal and run:

nano zm-install

Paste the contents of the script into Nano

Then:

Ctrl + o
Ctrl + x

Next run:

chmod 755 zm-install

Start the script by entering:

./zm-install

Follow the prompts. Things are pretty simple. The timezone will be detected from the OS and added to the php.ini.

Good Luck!

While this script worked for me I can't be responsible if you loose data when you run this. It is intended for a new install not an upgrade.

Install Apache2, Mariadb, PHP and Zoneminder on Ubuntu 18.04 with shell script

I created this to install Zoneminder on a Raspberry Pi 3B+ 64 BIT version of Bionic. Should work with other flavors of Bionic

See above for use

#!/bin/sh
clear
read -p "This script installs Apache2, Mariadb Server, PHP and Zoneminder 1.32.x on Ubuntu 18.04 ...
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "You must be logged in as root using sudo su ...
Press Enter to continue or Ctrl + c to quit" nothing
apt install -y apache2 php mariadb-server php-mysql libapache2-mod-php7.2
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 add the PPA repository, install and configure the system to run Zoneminder. 
Press enter to continue" nothing
apt install -y software-properties-common
clear
add-apt-repository ppa:iconnor/zoneminder-1.32
apt update
clear
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Install complete.Press enter to continue" nothing
clear

Ubuntu 18.04 LEMP (NGNIX, Mariadb, PHP)

Thanks to "terdinglage" for the input to get this to work!

Start with a basic Ubuntu 18.04 install. You can use a server or desktop install. Do not install LAMP!

Become root

sudo su

Install Ngnix, Mariadb and PHP components

apt install nginx mariadb-server php-fpm php-mysql fcgiwrap

Secure the Mariadb server

mysql_secure_installation

Restart Mariadb

systemctl restart mysql

Edit the php.ini file

nano /etc/php/7.2/fpm/php.ini

Locate (Ctrl+w) cgi.fix_pathinfo=1 and change to

cgi.fix_pathinfo=0

Remember to remove the leading ;

Also fix date. Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone. Make sure to remove the ; from the front of date.timezone

[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

Restart php-fpm

systemctl restart php7.2-fpm


Add Repository

NOTE:You may need to run: "apt install software-properties-common" if you did the minimal net install of Ubuntu.

add-apt-repository ppa:iconnor/zoneminder-1.32


Install Zoneminder

apt install zoneminder

Create a new user if you plan to use local (USB or capture card) cameras.

adduser www-data video

Fix Permissions

chown -R www-data:www-data /usr/share/zoneminder/

Change the ZM_PATH_ZMS in the 01-system-paths.conf file to /cgi-bin/nph-zms by dropping the /zm/

nano /etc/zm/conf.d/01-system-paths.conf

Ctrl+o Enter to save

CTRL+x to exit

Enable and start Zoneminder

systemctl enable zoneminder
service zoneminder start


Edit the Ngnix default configuration.

nano /etc/nginx/sites-available/default

Locate the line "index index.html index.htm index.nginx-debian.html;" and add index.php

index index.php index.html index.htm index.nginx-debian.html;

In the "server" section after listen [::] :80 default_Server; add

include /etc/nginx/zoneminder.conf;

Ctrl+o Enter to save

CTRL+x to exit

Create a Zoneminder conf file

nano /etc/nginx/zoneminder.conf

Enter the following into the zoneminder.conf file (This file was improved by databoy2k)

location /cgi-bin {
auth_basic off;
        alias /usr/lib/zoneminder/cgi-bin;     
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param HTTP_PROXY "";
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location /zm/cache {
auth_basic off;
        alias /var/cache/zoneminder/cache;
}
location ~ /zm/api/(css|img|ico) {
auth_basic off;
        rewrite ^/zm/api(.+)$ /api/app/webroot/$1 break;
        try_files $uri $uri/ =404;
}
location /zm {
auth_basic off;
        alias /usr/share/zoneminder/www;
        try_files $uri $uri/ /index.php?$args =404;    
        location /zm/api {
auth_basic off;
                rewrite ^/zm/api(.+)$ /zm/api/app/webroot/index.php?p=$1 last;
         }
                location ~ \.php$ {
                auth_basic off;
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_param HTTP_PROXY "";
                fastcgi_index index.php;
                        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }
    }

Ctrl+o Enter to save

CTRL+x to exit

Restart Ngnix

service nginx restart

Note: If Nginx gives you an error on restart go back one step and re-enter include /etc/ngnix/zoneminder.conf;

Note: 29JUL18 Thanks to Tiver for this suggestion that seems to work with the fcgiwrap issue.

If it does not exist create

nano /etc/default/fcgiwrap

and insert (with the number of children -c equal to the number of cameras)

DAEMON_OPTS=-c 10

then restart the fcgiwrap service.

systemctl restart fcgiwrap