zoneminder/distros/opensuse/README.OpenSuse

168 lines
6.0 KiB
Plaintext
Raw Normal View History

2014-03-27 11:05:20 +08:00
OpenSuse Notes
===============
1. OpenSuse, along with other distros, now use systemd for task control.
One of the capabilties of systemd is to use private space for /tmp to reduce
the possibility of cross talk between applications. The default settings
for zoneminder use /tmp for a number of files. When you start/stop
zoneminder from a web page /tmp will be in private space but when the
start/stop script zmpkg.pl is run from a shell it will be looking in the
real /tmp. This can result in two instances of zoneminder running at
the same time.
In order to remove this problem the OpenSuse rpm defaults the temporary
directory to /var/run/zoneminder. For a new install this will not be a
problem but if you use the rpm to upgrade you may have to make database
changes.
Note: the location is held both within the database an explicitly within some
scripts. It is therefore essential that the database conforms to the values
used in the scripts. Please see information in the Upgrades section of this
document.
2. OpenSuse prefers mariadb to mysql. mariadb is a direct replacement for mysql
and all mysql functions work in the same way. These notes assumes that you
are running mariadb.
2014-03-19 11:31:58 +08:00
New installs
============
1. Unless you are already using the MySQL server or you are running it
remotely you will need to ensure that the server is installed and secured:
2014-03-27 11:05:20 +08:00
To install the database issue the following commands (as root):
2014-03-19 11:31:58 +08:00
zypper in mariadb
systemctl enable mysql
systemctl start mysql.service
mysql_secure_installation
2014-03-27 11:05:20 +08:00
IMPORTANT: mariadb defaults to strict mode of operation which will cause
some zoneminder database writes to fail. In order to turn this off -
which will be for the whole database - you will need to edit
/etc/my.cnf and comment out the record
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES.
2014-03-19 11:31:58 +08:00
2. Using the password for the root account set during the previous step, you
will need to create the ZoneMinder database, assuming your database server
is local:
mysql -uroot -p < /opt/zoneminder/share/zoneminder/db/zm_create.sql
mysqladmin -uroot -p reload
3. The database needs a user. One is not created by default because this would
introduce an obvious security issue. The following should set this up:
mysqladmin -uroot -p reload
grant select,insert,update,delete,alter on zm.* to
'zmuser'@localhost identified by 'zmpass';
Obviously, change at least zmpass to an actual, secure password or
passphrase. You can change zmuser as well if you like.
4. Edit /etc/zm.conf and, at the bottom, change ZM_DB_PASS and perhaps
ZM_DB_USER to match.
5. Edit /etc/php5/apache2/php.ini, uncomment the date.timezone line, and add
your local timezone. For whatever reason, PHP will complain loudly if
this is not set, or if it is set incorrectly, and these complaints will
show up in the zoneminder logging system as errors.
If you are not sure of the proper timezone specification to use, look at
http://php.net/date.timezone
6. This package probably does not work with SELinux enabled at the moment. It
may be necessary to disable SELinux for httpd, or even completely for
ZoneMinder to function. This will be addressed in a later release. Run
setenforce 0
for testing, and edit /etc/sysconfig/selinux to disable it at boot time.
2014-03-27 11:05:20 +08:00
7. Now start the web server (as root):
2014-03-19 11:31:58 +08:00
2014-03-27 11:05:20 +08:00
systemctl enable apache2.service
systemctl start apache2.service
2014-03-19 11:31:58 +08:00
9. You should immediately visit http://localhost/zm and secure the system if
it is network facing. To do this:
a) click Options, then System.
b) check OPT_USE_AUTH.
c) set AUTH_HASH_SECRET to a random string.
d) click Save and refresh the main browser window.
e) You should be prompted to log in;
the default username/password is admin/admin.
f) Open Options again, choose the newly visible Users tab.
g) click the admin user and set a password.
h) enable OPT_CONTROL on the Ssytem tab to enable ptz camera control.
2014-03-27 11:05:20 +08:00
10. You should be able to start zoneminder by issuing the commands (as root):
2014-03-19 11:31:58 +08:00
2014-03-27 11:05:20 +08:00
systemctl enable zoneminder
systemctl start zoneminder
If zoneminder fails to start using the service you may also start it
with this command:
2014-03-19 11:31:58 +08:00
2014-03-27 11:05:20 +08:00
/opt/zoneminder/bin/zmpkg.pl start
2014-03-19 11:31:58 +08:00
Upgrades
========
1. Update /etc/zm.conf. Check for any new settings and update the version
information. Comparing /etc/zm.conf and /etc/zm.conf.rpmnew should help to
do this.
2. Add the mysql ALTER permission to the zmuser account:
mysql -u root -p
2014-03-27 11:05:20 +08:00
use zm
grant alter, lock tables on zm.* to 'zmuser'@localhost;
2014-03-19 11:31:58 +08:00
Since this is an upgrade, the assumption is that the zmuser account already
has select, insert, update, and delete permission.
3. You will need to upgrade the ZoneMinder database as described in the
manual. Only if the previous step was succesful, may you run zmupdate like
2014-03-27 11:05:20 +08:00
so (as root):
/opt/zoneminder/bin/zmupdate.pl
2014-03-19 11:31:58 +08:00
2014-03-27 11:05:20 +08:00
4. As mentioned in the OpenSuse notes you may need to change database values.
These steps may be run at any time (as root):
2014-03-19 11:31:58 +08:00
2014-03-27 11:05:20 +08:00
stop the current instance of zoneminder - systemctl stop zoneminder
ensure that all zoneminder processes have terminated:
ps -ef|grep zm
if you find any process still running issue a kill -9 for each
mysql -u root
use zm
update Config set DefaultValue = '/var/run/zoneminder'
where name = 'ZM_PATH_LOGS';
update Config set Value = '/var/run/zoneminder'
where name = 'ZM_PATH_LOGS';
update Config set DefaultValue = '/var/run/zoneminder'
where name = 'ZM_PATH_SOCKS';
update Config set Value = '/var/run/zoneminder'
where name = 'ZM_PATH_SOCKS';
update Config set DefaultValue = '/var/run/zoneminder'
where name = 'ZM_PATH_LOGS';
update Config set Value = '/var/run/zoneminder'
where name = 'ZM_PATH_SWAP';
commit;
exit
2014-03-19 11:31:58 +08:00
2014-03-27 11:05:20 +08:00
You can then restart zoneminder - systemctl start zoneminder