Umvirt ZoneMinder

Research project aimed to port ZoneMinder to Umvirt Linux From Scratch.

Installation

1. Zoneminder installation

Zoneminder is not just LAMP-stack application it also videoprocessing application.

Therefore Xorg and multimedia packages are needed.

If you wish to work with WEB-application locally with Falkon browser install it after KDE or LXQT installation.

If you wish to work with WEB-application remotely install it after MATE, XFCE installation.

To install zoneminder package and it dependencies in ULFS just run:

    chimp install zoneminder

This command installs zoneminder and its dependencies:

2. Apache HTTP-server configuration

2.1. PHP-scripts support

Apache HTTP-server should be edited to execute PHP-scripts. There are many ways how to do that. In BLFS book FastCGI PHP Module (php-fpm) is described.

To enable PHP-scripts execution in Apache HTTP-server with php-fpm just copy and paste:

    sed -i -e '/proxy_module/s/^#//'      \
    -e '/proxy_fcgi_module/s/^#//' \
    /etc/httpd/httpd.conf

    echo \
    'ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/srv/www/$1' >> \
    /etc/httpd/httpd.conf

    echo "AddType application/x-httpd-php-source .phps" >> /etc/httpd/httpd.conf

    sed -i -e "s/DirectoryIndex index.html/DirectoryIndex index.html index.php/" /etc/httpd/httpd.conf

2.2. Systemd services

To enable php-fpm systemd-service run:

    cd /usr/share/blfs-systemd-units/
    make install-php-fpm

To start php-fpm systemd-service run:

    systemctl start php-fpm.service

To enable Apache HTTP-server systemd-service (httpd) run:

    cd /usr/share/blfs-systemd-units/
    make install-httpd

To start Apache HTTP-server systemd-service (httpd) run:

    systemctl start httpd

2.3. Check

Open browser on other machine and open website on this machine address.

You have to get message: "It works!"

HTTP ready

3. Local MariaDB-server (optional)

Durning zoneminder package installation only MariaDB client is installed to remote MariaDB server connection.

If you wish to install MariaDB server you have to install it on machine with ZoneMinder (local) or other (remote) machine.

3.1. Installation

To install MariaDB-server run:

    chimp install mariadb-server

3.2. First start

After installation you should to start MariaDB-server basic configuration. To do that run:

    install -v -m755 -o mariadb -g mariadb -d /run/mariadb &&
    mariadbd-safe --user=mariadb 2>&1 >/dev/null &

3.3. Systemd-service

To enable MariaDB-server systemd-service run:

    cd /usr/share/blfs-systemd-units/
    make install-mariadb

To start MariaDB-server systemd-service run:

    systemctl start mariadb

3.4. Database installation

To create database run:

    cat /usr/share/zoneminder/db/zm_create.sql | mysql

To create user and grant access to it run:

    echo 'grant lock tables,alter,create,index,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";'\
    | mysql

4. ZoneMinder configuration

4.1 Front-end (Web-application)

Set apache user as owner on web-application directory.

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

Replace http-server documents directory to symlink on Zone Minder web-application directory

    cd /srv
    mv www www_
    ln -s /usr/share/zoneminder/www
4.2. Configuration files

Edit web-application file "/srv/www/includes/config.php" and set another config file name ("zm.php.conf", for example).

Copy original /etc/zm.conf to another config file name defined in "/srv/www/includes/config.php". For example:

    cp /etc/zm.conf /etc/zm.php.conf

In original /etc/zm.conf file edit database type and replace "mysql" to "MariaDB" (keep letter registers).

On another config file replace string

    ZM_DB_HOST=localhost

to

    ZM_DB_HOST=127.0.0.1:3306
4.3. Back-end

Edit zoneminder.service file if you wish to run it localy

    nano /usr/lib/systemd/system/zoneminder.service

Uncomment line

    #After=network.target mariadb.service

Comment line

    After=network.target

To enable zoneminder systemd-service run

    systemctl enable zoneminder

To start zoneminder systemd-service run

    systemctl start zoneminder

To check zoneminder systemd-service run

    systemctl status zoneminder

You should get:

    ● zoneminder.service - ZoneMinder CCTV recording and surveillance system
         Loaded: loaded (/usr/lib/systemd/system/zoneminder.service; enabled; preset: enabled)
         Active: active (running) since Wed 2025-05-28 12:48:38 UTC; 4s ago

5. Check

Open browser on other machine and open website on this machine address.

You have to get Web-application interface and zoneminder service indicator (top-right corner) should display "RUNNING".

ZM Console