ZoneMinder video camera security and surveillance: Difference between revisions
m (missing details) |
Ranger0665 (talk | contribs) (Added community repo reference, changed vim to vi, updated PHP5 to PHP8 references, fixed zm.conf to proper location, added reference to start/connect to MySql) |
||
Line 1: | Line 1: | ||
[https://www.zoneminder.com/ ZoneMinder] usually runs with [[Apache]], but in this short how-to we use [[Lighttpd]]. | [https://www.zoneminder.com/ ZoneMinder] usually runs with [[Apache]], but in this short how-to we use [[Lighttpd]]. | ||
ZoneMinder is found in the community repositories, please enable it by following the instructions [[Repositories#Enabling_the_community_repository|here]] | |||
First, add the needed packages to our system | First, add the needed packages to our system | ||
apk add zoneminder mariadb mysql-client lighttpd | apk add zoneminder mariadb mysql-client lighttpd php8-fpm php8-pdo php8-pdo_mysql | ||
Initialize [https://www.mysql.com/ MySQL] database | Initialize [https://www.mysql.com/ MySQL] database | ||
/etc/init.d/mariadb setup | /etc/init.d/mariadb setup | ||
Start the database | |||
/etc/init.d/mariadb start | |||
Set root password for MySQL as instructed by MySQL setup | Set root password for MySQL as instructed by MySQL setup | ||
/usr/bin/mysqladmin -u root password 'your_secure_root_mysql_password' | /usr/bin/mysqladmin -u root password 'your_secure_root_mysql_password' | ||
You can log into MySQL as current root user with | |||
mysql | |||
Create a ZoneMinder MySQL database and user | Create a ZoneMinder MySQL database and user | ||
Line 23: | Line 32: | ||
We are running <code>lighttpd</code>, so let's run <code>php-fpm</code> as lighttpd user/group | We are running <code>lighttpd</code>, so let's run <code>php-fpm</code> as lighttpd user/group | ||
vi /etc/php8/php-fpm.conf | |||
Add this section to the bottom of the file: | |||
; Unix user/group of processes | ; Unix user/group of processes | ||
Line 37: | Line 46: | ||
Enable the php cgi fpm config in <code>lighttpd.conf</code> | Enable the php cgi fpm config in <code>lighttpd.conf</code> | ||
vi /etc/lighttpd/lighttpd.conf | |||
Go down to the includes section, it should look like: | Go down to the includes section, it should look like: | ||
Line 53: | Line 62: | ||
Edit lighttpd cgi config and add old style cgi support by adding to cgi.assign | Edit lighttpd cgi config and add old style cgi support by adding to cgi.assign | ||
vi /etc/lighttpd/mod_cgi.conf | |||
which should look like | which should look like | ||
Line 65: | Line 74: | ||
Start php-fpm | Start php-fpm | ||
/etc/init.d/php- | /etc/init.d/php-fpm8 start | ||
Start lighttpd | Start lighttpd | ||
Line 77: | Line 86: | ||
And set <code>ZM_SERVER_HOST</code> to your ZoneMinder hostname/ipaddress | And set <code>ZM_SERVER_HOST</code> to your ZoneMinder hostname/ipaddress | ||
vi /etc/zm/zm.conf | |||
Which should look like: | Which should look like: | ||
Line 106: | Line 115: | ||
Change ownership of <code>zm.conf</code> to <code>lighttpd</code> | Change ownership of <code>zm.conf</code> to <code>lighttpd</code> | ||
chown lighttpd.lighttpd /etc/zm.conf | chown lighttpd.lighttpd /etc/zm/zm.conf | ||
Initialize the ZoneMinder database | Initialize the ZoneMinder database | ||
Line 124: | Line 133: | ||
rc-update add lighttpd default | rc-update add lighttpd default | ||
rc-update add mariadb default | rc-update add mariadb default | ||
rc-update add php- | rc-update add php-fpm8 default | ||
rc-update add zoneminder default | rc-update add zoneminder default | ||
Revision as of 12:56, 2 October 2022
ZoneMinder usually runs with Apache, but in this short how-to we use Lighttpd.
ZoneMinder is found in the community repositories, please enable it by following the instructions here
First, add the needed packages to our system
apk add zoneminder mariadb mysql-client lighttpd php8-fpm php8-pdo php8-pdo_mysql
Initialize MySQL database
/etc/init.d/mariadb setup
Start the database
/etc/init.d/mariadb start
Set root password for MySQL as instructed by MySQL setup
/usr/bin/mysqladmin -u root password 'your_secure_root_mysql_password'
You can log into MySQL as current root user with
mysql
Create a ZoneMinder MySQL database and user
mysql> create database zm;
mysql> CREATE USER zmuser@localhost IDENTIFIED BY 'your_zm_password_as_set_in_config';
mysql> grant ALL on zm.* to zmuser@localhost;
We are running lighttpd
, so let's run php-fpm
as lighttpd user/group
vi /etc/php8/php-fpm.conf
Add this section to the bottom of the file:
; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. ;user = nobody ;group = nobody user = lighttpd group = lighttpd
Enable the php cgi fpm config in lighttpd.conf
vi /etc/lighttpd/lighttpd.conf
Go down to the includes section, it should look like:
# {{{ includes include "mime-types.conf" # uncomment for cgi support include "mod_cgi.conf" # uncomment for php/fastcgi support # include "mod_fastcgi.conf" # uncomment for php/fastcgi fpm support include "mod_fastcgi_fpm.conf" # }}}
Edit lighttpd cgi config and add old style cgi support by adding to cgi.assign
vi /etc/lighttpd/mod_cgi.conf
which should look like
cgi.assign = ( "" => "", ".pl" => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" )
Start php-fpm
/etc/init.d/php-fpm8 start
Start lighttpd
/etc/init.d/lighttpd start
Set the MySQL hostname, username, password.
Change the ZoneMinder user (ZM_WEB_USER
) and group (ZM_WEB_GROUP
) to lighttpd
And set ZM_SERVER_HOST
to your ZoneMinder hostname/ipaddress
vi /etc/zm/zm.conf
Which should look like:
# Username and group that web daemon (httpd/apache) runs as ZM_WEB_USER=lighttpd ZM_WEB_GROUP=lighttpd ZM_PATH_DATA=/usr/share/zoneminder
# ZoneMinder database type: so far only mysql is supported ZM_DB_TYPE=mysql # ZoneMinder database hostname or ip address ZM_DB_HOST=localhost # ZoneMinder database name ZM_DB_NAME=zm # ZoneMinder database user ZM_DB_USER=zmuser # ZoneMinder database password ZM_DB_PASS=your_zm_password_as_set_in_config # Host of this machine ZM_SERVER_HOST=yourserver
Change ownership of zm.conf
to lighttpd
chown lighttpd.lighttpd /etc/zm/zm.conf
Initialize the ZoneMinder database
/etc/init.d/zoneminder setup
Start ZoneMinder
/etc/init.d/zoneminder start
Profit!
To access ZoneMinder, browse to http://yourserver/zm/
To make it start automatically on boot:
rc-update add lighttpd default rc-update add mariadb default rc-update add php-fpm8 default rc-update add zoneminder default
Added notes to work with Nginx
Later to add some notes about running via nginx
Related Links
- https://wiki.alpinelinux.org/wiki/Raspberry_Pi_3_-_Browser_Client - Kiosk to watch Streams