README.Debian
1Zoneminder for Debian
2---------------------
3
4Initializing database
5---------------------
6
7 pv /usr/share/zoneminder/db/zm_create.sql | sudo mysql --defaults-file=/etc/mysql/debian.cnf
8OR
9 cat /usr/share/zoneminder/db/zm_create.sql | sudo mysql --defaults-file=/etc/mysql/debian.cnf
10
11 echo 'grant lock tables,alter,create,index,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";'\
12 | sudo mysql --defaults-file=/etc/mysql/debian.cnf mysql
13
14Hint: generate secure password with `pwgen` and update "/etc/zm/zm.conf"
15accordingly.
16
17The following command can help to ensure that zoneminder can read its
18configuration file:
19
20 chgrp -c www-data /etc/zm/zm.conf
21
22
23Upgrading database
24------------------
25
26The database is updated automatically on installation. You should not need to take this step.
27
28Assuming that database is on "localhost" then the following command can be
29used to upgrade "zm" database:
30
31 zmupdate.pl
32
33Additional permissions may be required to perform upgrade:
34
35 echo 'grant lock tables, create, alter on zm.* to 'zmuser'@localhost identified by "zmpass";'\
36 | sudo mysql --defaults-file=/etc/mysql/debian.cnf mysql
37
38The following command prints the current version of zoneminder database:
39
40 echo 'select Value from Config where Name = "ZM_DYN_CURR_VERSION";' \
41 | sudo mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names zm
42
43
44Enabling service
45----------------
46
47By default Zoneminder service is not automatically started and needs to be
48manually enabled once database is configured:
49
50 sudo systemctl enable zoneminder.service
51
52
53Web server set-up
54-----------------
55
56There are few manual steps to get the web interface working:
57
58## Apache2
59
60Apache can be configured as folder "/zm" using sample .conf:
61
62 sudo a2enconf zoneminder
63
64Alternatively Apache web site configuration template can be used to setup
65zoneminder as "http://zoneminder":
66
67 sudo cp -v /usr/share/doc/zoneminder/examples/apache.conf /etc/apache2/sites-available/
68 sudo a2ensite zoneminder.conf
69
70Common configuration steps for Apache2:
71
72 sudo a2enmod cgi
73 sudo service apache2 reload
74
75
76## nginx / fcgiwrap
77
78Nginx needs "php-fpm" package to support PHP and "fcgiwrap" package
79for binary "cgi-bin" applications:
80
81 sudo apt-get install php-fpm fcgiwrap
82
83To enable a URL alias that makes Zoneminder available from
84
85 http://yourserver/zm
86
87the following line is to be added to "server" section of a web site
88configuration:
89
90 include /usr/share/doc/zoneminder/examples/nginx.conf;
91
92For "default" web site it would be sufficient to include the above
93statement to the file
94
95 /etc/nginx/sites-enabled/default
96
97To avoid problems with feeds from multiple cameras "fcgiwrap" should be
98configured to start at least as many processes as there are cameras.
99It can be done by adjusting DAEMON_OPTS in "/etc/default/fcgiwrap".
100Systemd users may be affected by the following bug:
101
102 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=792705
103
104
105## Note:
106
107When Zoneminder web site is running it may be necessary to set
108Options/Paths/PATH_ZMS to "/zm/cgi-bin/nph-zms" or according to chosen web
109site configuration.
110
111
112Changing the location for images and events
113-------------------------------------------
114
115ZoneMinder is now able to be configured to use an alternative location for storing
116events and images at compile time. This package makes use of that, so symlinks in
117/usr/share/zoneminder/www are no longer necessary.
118
119Access to /dev/video*
120---------------------
121
122For cameras which require access to /dev/video*, zoneminder may need the
123www-data user added to the video group in order to see those cameras:
124
125 adduser www-data video
126
127Note that all web applications running on the zoneminder server will then have
128access to all video devices on the system.
129
130 -- Vagrant Cascadian <vagrant@debian.org> Sun, 27 Mar 2011 13:06:56 -0700
131