ZoneMinder

ZoneMinder Capture, analyse, record and monitor any cameras attached to your system.

Dependicies
Enable the following USE flags for dev-lang/php:
 * Apache2 www-servers/apache
 * MySQL dev-db/mariadb
 * PHP dev-lang/php

Enable the following USE flags for app-admin/eselect-php:

Apache

 * Select correct version of PHP


 * Edit /etc/php/apache2-php5.6/php.ini to reflect:


 * Edit /etc/conf.d/apache2 and add "-D PHP5 -D PROXY" to APACHE2_OPTS


 * Remove Apache startup warning: "...fully qualified domain name..."


 * Create /etc/apache2/vhost.d/10_zoneminder.conf and add the following:

MySQL

 * Create ZoneMinder's database, zm, as a standard user


 * Import the database schema and base data, the .sql script is created by the configure phase above, so make sure you do that first.


 * Create a MySQL user for ZM to use. If you change the user and/or password from the defaults here, then make sure you set those in the source configure phase.

ZoneMinder

 * Edit /etc/zm.conf and add the above MySQL database username and password:

OpenRC
Start the Apache server:

Add Apache to the default runlevel:

Reload the Apache configuration files:

Start PHP server:

Add PHP to the default runlevel:

Start MySQL server:

Add MySQL to the default runlevel:

Start ZoneMinder server:

Add ZoneMinder to the default runlevel:

systemd
Start the Apache server:

Add Apache to startup:

Start the PHP server:

Add PHP to startup:

Start the MySQL server:

Add MySQL to startup:

Start the ZoneMinder server:

Add ZoneMinder to startup:

Selinux
If you are using selinux you must create a policy. Hopefully later when the ebuild comes back this will be done automatically.

Make local_zoneminder.te module local_zoneminder 1.0;

require { type httpd_t; type initrc_var_run_t; type initrc_t; type v4l_device_t; type file_t; class unix_stream_socket { read connectto }; class file { read lock }; class shm { unix_read unix_write associate read write getattr }; class chr_file getattr; }

allow httpd_t initrc_t:unix_stream_socket connectto; allow httpd_t initrc_t:shm { unix_read unix_write associate read write getattr }; allow httpd_t initrc_var_run_t:file { read lock }; allow httpd_t v4l_device_t:chr_file getattr; Now it's time to build the modules.
 * 1) ============= httpd_t ==============

Other
Shared memory: sysctl kernel.shmmax=536870912