ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Forum for questions and support relating to the 1.30.x releases only.
Locked
terdinglage
Posts: 11
Joined: Thu Jan 03, 2019 7:14 am

ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by terdinglage »

I am currently on Ubuntu 16.04, Zoneminder 1.30.4, installed using the LEMP tutorial, similar to the one found here for 17.10:

https://wiki.zoneminder.com/Ubuntu_Serv ... and_PHP.29

My install is working behind an NGINX reverse proxy, so I really need to keep this LEMP approach.

I have been trying to get a successful do-release-upgrade, and have had absolutely no luck. I've attempted multiple installations, and keep ending up with a completely broken install.

I was hoping someone could point me in the right direction for a LEMP tutorial that works on 18.04?

I even found a previous post where there was a Wiki tutorial for LEMP on 18.04, but that is gone now:

Post: viewtopic.php?t=27098#p105228
Tutorial: https://wiki.zoneminder.com/Ubuntu_Serv ... .2C_PHP.29
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by bbunge »

Note: the links for the files in Google drive have changed. See: viewtopic.php?f=36&t=27783

Not gone completely. If you look at the history for that link you can find:

Ubuntu 18.04 LEMP (NGNIX, Mariadb, PHP)

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

Download the Zoneminder install package. This may take a minute to connect

wget --no-check-certificate 'https://docs.google.com/uc?export=downl ... zwtOcCiisX' -O /tmp/zoneminder-1.30.4-bionic-amd64.deb

Install Zoneminder

apt install /tmp/zoneminder-1.30.4-bionic-amd64.deb

Create a new user

adduser www-data video

Fix Permissions

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

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;

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 /zm/cgi-bin {
gzip off;
alias /usr/lib/zoneminder/cgi-bin;

include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}

location /zm {
# if ($scheme ~ ^http:){
# rewrite ^(.*)$ https://$host$1 permanent;
# }

gzip off;
alias /usr/share/zoneminder/www;
index index.php;

location ~ \.php$ {
if (!-f $request_filename) { return 404; }
expires epoch;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}


location ~ \.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires 33d;
}

location /zm/api/ {
alias /usr/share/zoneminder/www/api;
rewrite ^/zm/api(.+)$ /zm/api/index.php?p=$1 last;
}
}

Ctrl+o Enter to save

CTRL+x to exit

Edit the default sites enabled

nano /etc/nginx/sites-enabled/default

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

include /etc/nginx/zoneminder.conf;

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;

IMPORTANT FINAL STEP: Open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms

Note: 01JUL18 There is currently an issue getting this configuration to view monitors in Montage. The previous recommendation to modify the fcgiwrap config did not work. Will investigate as time permits but if you need a system that works install Mariadb, Apache, PHP and Zoneminder.
terdinglage
Posts: 11
Joined: Thu Jan 03, 2019 7:14 am

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by terdinglage »

bbunge wrote: Thu Jan 03, 2019 8:15 pm Note: the links for the files in Google drive have changed. See: viewtopic.php?f=36&t=27783

Not gone completely. If you look at the history for that link you can find:

Ubuntu 18.04 LEMP (NGNIX, Mariadb, PHP)
Thank you so much for pointing me in the right direction, sorry that I was unable to find your post without having to ask the question. I noticed it mentioned at the bottom of the tutorial that Montage doesn’t work right. I’m guessing that means that zmNinja may not work for me, but I’ll give it a try.

Are you aware of any progress as far as getting 1.32 working behind NGiNX? It seemed like in this post that databoy2k and Nocifer maybe got it figured out:

viewtopic.php?f=38&t=27633&start=30

I couldn’t find a finalized install walkthrough or zoneminder.conf file for NGiNX, though.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by bbunge »

I tried to get 18.04 LEMP and 1.32.3 working this afternoon without full success. I suspect there is a fix but have not taken the time to look for it.
terdinglage
Posts: 11
Joined: Thu Jan 03, 2019 7:14 am

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by terdinglage »

bbunge wrote: Fri Jan 04, 2019 2:22 am I tried to get 18.04 LEMP and 1.32.3 working this afternoon without full success. I suspect there is a fix but have not taken the time to look for it.
Just curious, but what configuration did you base your attempt off of? The one from that post I referenced, or something of your own design? Right now this is the one I am set to start off my efforts with:

https://pastebin.com/pUSDWiFM

Plus whatever instructions remained in the thread I referenced earlier. Do you think that’s my best bet, or would you want to share the configuration file that you use during your attempt?
Kylermiles
Posts: 1
Joined: Fri Jan 04, 2019 3:17 pm

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by Kylermiles »

I'm trying to run ZoneMinder on an even older version of Ubuntu and it's still not working for me either. Trying to figure out what I could do to fix it
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by bbunge »

Kylermiles wrote: Fri Jan 04, 2019 3:21 pm I'm trying to run ZoneMinder on an even older version of Ubuntu and it's still not working for me either. Trying to figure out what I could do to fix it
What Ubuntu version and Zoneminder version?
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by bbunge »

terdinglage wrote: Fri Jan 04, 2019 2:39 am
bbunge wrote: Fri Jan 04, 2019 2:22 am I tried to get 18.04 LEMP and 1.32.3 working this afternoon without full success. I suspect there is a fix but have not taken the time to look for it.
Just curious, but what configuration did you base your attempt off of? The one from that post I referenced, or something of your own design? Right now this is the one I am set to start off my efforts with:

https://pastebin.com/pUSDWiFM

Plus whatever instructions remained in the thread I referenced earlier. Do you think that’s my best bet, or would you want to share the configuration file that you use during your attempt?
Most of the recent Ubuntu and Debian how to packages are of my effort. I build on and learn from others. Try to share what works.
Effort today used the 17.10 package with 18.04 and 1.32.3 plus some patches from the 1.32.x forum. Failed again but plan to do it again several times this weekend. Have 18.04 LEMP cloned so it is a snap to doitagain!
terdinglage
Posts: 11
Joined: Thu Jan 03, 2019 7:14 am

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by terdinglage »

bbunge wrote: Sat Jan 05, 2019 2:21 am
terdinglage wrote: Fri Jan 04, 2019 2:39 am
bbunge wrote: Fri Jan 04, 2019 2:22 am I tried to get 18.04 LEMP and 1.32.3 working this afternoon without full success. I suspect there is a fix but have not taken the time to look for it.
Just curious, but what configuration did you base your attempt off of? The one from that post I referenced, or something of your own design? Right now this is the one I am set to start off my efforts with:

https://pastebin.com/pUSDWiFM

Plus whatever instructions remained in the thread I referenced earlier. Do you think that’s my best bet, or would you want to share the configuration file that you use during your attempt?
Most of the recent Ubuntu and Debian how to packages are of my effort. I build on and learn from others. Try to share what works.
Effort today used the 17.10 package with 18.04 and 1.32.3 plus some patches from the 1.32.x forum. Failed again but plan to do it again several times this weekend. Have 18.04 LEMP cloned so it is a snap to doitagain!
How far were you able to get with your recent attempt? I believe I now have the interface working fine, but I’m getting an error after setting up my first RTSP camera. Here is a blip of my log file showing the error message that it keeps repeating:

Date/Time Component Server PID Level Message File Line
2019-01-05 00:57:40.147106 zmc_m1 2489 ERR Failed to prime capture of initial monitor zmc.cpp 253
2019-01-05 00:57:40.144816 zmc_m1 2489 ERR Unable to open input rtsp://192.168.1.50:554/videoMain due to: Operation now in progress zm_ffmpeg_camera.cpp 357
2019-01-05 00:57:40.130674 zmc_m1 2489 INF Priming capture from rtsp://192.168.1.50:554/videoMain zm_ffmpeg_camera.cpp 163
2019-01-05 00:57:30.122280 zmc_m1 2489 ERR Failed to prime capture of initial monitor zmc.cpp 253
2019-01-05 00:57:30.120079 zmc_m1 2489 ERR Unable to open input rtsp://192.168.1.50:554/videoMain due to: Operation now in progress zm_ffmpeg_camera.cpp
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by bbunge »

Not making much progress with LEMP. Can get php to work and am 1.32.3 to start but the display is lousy. Had to take a mental break...
terdinglage
Posts: 11
Joined: Thu Jan 03, 2019 7:14 am

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by terdinglage »

bbunge wrote: Sun Jan 06, 2019 8:01 pm Not making much progress with LEMP. Can get php to work and am 1.32.3 to start but the display is lousy. Had to take a mental break...
I’ve been working with the config and the person from the thread I referenced earlier and have everything working except for zmauth. I will post what I’m using as soon as I get that last issue sorted out.
terdinglage
Posts: 11
Joined: Thu Jan 03, 2019 7:14 am

Re: ZoneMinder 1.30.4 on Ubuntu 18.04 with LEMP

Post by terdinglage »

bbunge wrote: Sun Jan 06, 2019 8:01 pm Not making much progress with LEMP. Can get php to work and am 1.32.3 to start but the display is lousy. Had to take a mental break...
I think I have this completely solved now, my updated is posted here if you want to build a tutorial out of it:

viewtopic.php?f=38&t=27926
Locked