Moving zoneminder to /home/ folder in Virtualmin

Forum for questions and support relating to the 1.31.x releases only.
Locked
amityweb
Posts: 3
Joined: Sat Jul 15, 2017 1:43 am

Moving zoneminder to /home/ folder in Virtualmin

Post by amityweb »

I have virtualmin on the server. I believe php will only run under /home/. So I created a virtualmin server for zoneminder to move the www files into. I did this and made path changes to the conf file for the server software and web software.

zoneminder has started ok on the server.

All seems to work ok EXCEPT in the web console it says Console Stopped at the top. I've added an ip camera which I know works in the browser but in zoneminder the Host address in the list is red, there's no cameras showing.

So I think I'm missing something due to the move to /home/zoneminder/public_html/www/

Does anyone know what needs changing in total to move the zoneminder web root somewhere else?

Thanks
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Moving zoneminder to /home/ folder in Virtualmin

Post by rockedge »

You need to change some paths in the Apache configuration as well as make some changes to /etc/zm/conf.d/zmcustom.conf...this all depends on the version your running of ZM and what OS your using where these changes are made. In principle it is an easy transfer to change the ZM web console root.
amityweb
Posts: 3
Joined: Sat Jul 15, 2017 1:43 am

Re: Moving zoneminder to /home/ folder in Virtualmin

Post by amityweb »

I did change the file /etc/zm/zm.conf (and the conf file in the website folder is the same too). Am using ZM v1.30.4, and Centos 7.

Here it is:

Code: Select all

# ==========================================================================
#
# ZoneMinder Base Configuration, $Date$, $Revision$
#
# ==========================================================================
#
# This file is generated by 'configure'. Care should be taken if manually
# editing this file as an changes may be overwritten by subsequent configuration
# or installations.
#

# Path to installed data directory, used mostly for finding DB upgrade scripts
ZM_PATH_DATA=/home/zoneminder/public_html

# Path to ZoneMinder binaries
ZM_PATH_BIN=/usr/bin

# Path to ZoneMinder libraries (none at present, for future use)
ZM_PATH_LIB=/usr/lib64

# Path to ZoneMinder configuration (this file only at present)
ZM_PATH_CONF=/etc/zm

# Path to ZoneMinder web files
ZM_PATH_WEB=/home/zoneminder/public_html/www

# Path to ZoneMinder cgi files
ZM_PATH_CGI=/home/zoneminder/public_html/cgi-bin

# Username and group that web daemon (httpd/apache) runs as
ZM_WEB_USER=zoneminder
ZM_WEB_GROUP=zoneminder

# ZoneMinder database type: so far only mysql is supported
ZM_DB_TYPE=mysql

# ZoneMinder database hostname or ip address and optionally port or unix socket
# Acceptable formats include hostname[:port], ip_address[:port], or localhost:unix_socket
ZM_DB_HOST=localhost

# ZoneMinder database name
ZM_DB_NAME=zoneminder

# ZoneMinder database user
ZM_DB_USER=mydbuser

# ZoneMinder database password
ZM_DB_PASS=myddbpass

# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server
# You have been warned
#
# The name specified here must have a corresponding entry
# in the Servers tab under Options
ZM_SERVER_HOST=
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Moving zoneminder to /home/ folder in Virtualmin

Post by rockedge »

what happens if you start a terminal and use?

Code: Select all

#zmpkg.pl start
did you look at the Apache virtual host configuration? That Apache is also correctly setup with the ZM paths?
amityweb
Posts: 3
Joined: Sat Jul 15, 2017 1:43 am

Re: Moving zoneminder to /home/ folder in Virtualmin

Post by amityweb »

Getting this error:

Code: Select all

[root@hostname ~]# systemctl status zoneminder.service
● zoneminder.service - ZoneMinder CCTV recording and security system
   Loaded: loaded (/usr/lib/systemd/system/zoneminder.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2017-07-17 23:07:18 BST; 5s ago
  Process: 2293 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=255)

Jul 17 23:07:15 hostname sudo[2301]:   apache : user NOT in sudoers ; TTY=unknown ; PWD=/home/zoneminder/public_html/www ; USER=zoneminder ; CO.../bin/true
Jul 17 23:07:15 hostname su[2306]: pam_unix(su:auth): auth could not identify password for [zoneminder]
Jul 17 23:07:15 hostname su[2306]: FAILED SU (to zoneminder) apache on none
Jul 17 23:07:16 hostname su[2311]: pam_unix(su:auth): auth could not identify password for [zoneminder]
Jul 17 23:07:16 hostname su[2311]: FAILED SU (to zoneminder) apache on none
Jul 17 23:07:17 hostname zmpkg[2293]: ERR [Unable to find valid 'su' syntax]
Jul 17 23:07:18 hostname systemd[1]: zoneminder.service: control process exited, code=exited status=255
Jul 17 23:07:18 hostname systemd[1]: Failed to start ZoneMinder CCTV recording and security system.
Jul 17 23:07:18 hostname systemd[1]: Unit zoneminder.service entered failed state.
Jul 17 23:07:18 hostname systemd[1]: zoneminder.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
Virtualmin created the virtual hosts config file. I thought maybe the cgi-bin was one of the reasons, so I copied the cg-bin code from the install instructions to the vhosts file:

Code: Select all

SuexecUserGroup "#1002" "#1002"
ServerName zoneminder.mydomain
ServerAlias www.zoneminder.mydomain
ServerAlias webmail.zoneminder.mydomain
ServerAlias admin.zoneminder.mydomain
DocumentRoot /home/zoneminder/public_html/www
ErrorLog /var/log/virtualmin/zoneminder.mydomain_error_log
CustomLog /var/log/virtualmin/zoneminder.mydomain_access_log combined

DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/zoneminder/public_html/www>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/zoneminder/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/zoneminder/fcgi-bin/php5.fcgi .php5
</Directory>

ScriptAlias /cgi-bin-zm "/usr/libexec/zoneminder/cgi-bin"
<Directory "/usr/libexec/zoneminder/cgi-bin">
    SSLRequireSSL
    AllowOverride All
    Options +ExecCGI +FollowSymLinks
    <IfModule mod_authz_core.c>
       # Apache 2.4
       Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
    </IfModule>
</Directory>

RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.zoneminder.mydomain
RewriteRule ^(.*) https://zoneminder.mydomain:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.zoneminder.mydomain
RewriteRule ^(.*) https://zoneminder.mydomain:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
FcgidMaxRequestLen 1073741824
Locked