ZoneMinder: Cara Instalasi

From OnnoWiki
Revision as of 05:27, 23 July 2012 by Onnowpurbo (talk | contribs) (New page: For a new installation the next thing you will need to do is create your database and database users. So type the commands as follows when in the folder of the extracted zm files, Create ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For a new installation the next thing you will need to do is create your database and database users. So type the commands as follows when in the folder of the extracted zm files,

Create the ZoneMinder database 'zm' and populate it with the tables for ZoneMinder:

$ mysql
mysql> create database zm;
mysql> exit;
$ mysql zm < db/zm_create.sql   <This file doesn't exist until after 'make'>

Finally, create a MySQL user account for ZoneMinder:

$ mysql zm
mysql> grant select,insert,update,delete on zm.* to '<database user>'@localhost identified by '<database password>';
mysql> quit;
$ mysqladmin reload

You may need to supply a username and password to the mysql commands in the first place to give yourself sufficient privileges to perform the required commands. To do that it's something like:

mysql -uroot -p<root database password> zm.

If you want to host your database on a different machine than that which ZoneMinder is running on then you will need to perform this step on the remote machine and reference the ZoneMinder machine instead of localhost. If you are running remote databases you probably already know all this, if you are not then don’t worry about it!

At this stage typing

make install

will install everything to the desired locations, you may need to su to root first though to give yourself adequate permissions. The installation routine will copy the binaries and scripts to your chosen install location, usually /usr/local/bin and then move zms (and nph-zms) to your cgi-bin area. It will then copy the web files to your chosen directory and ensure they have the right permissions, and install the ZoneMinder perl modules in the standard perl locations. It will also install a copy of the zm.conf file (generated by configure) to your system configuration area (e.g. /usr/local/etc). Finally it tries to link zm.php to index.php but will not overwrite an existing file if it already exists.

The 'zm' script does not get installed automatically as it is not necessary for the operation of the ZoneMinder setup per se and is not necessarily likely to work correctly for distributions other than those from the RedHat or Fedora families. However if you want to ensure that ZoneMinder is started on reboot etc copy it to your init.d directory, usually something like /etc/rc.d/init.d or /etc/inid.d and then add it by doing

chkconfig --add zm

or similar command for your distribution. ZoneMinder will then start up when your machine reboots and can be controlled (by the root user) by doing 'service zm start' or 'service zm stop' etc. You may need to use the ‘—levels’ parameter to chkconfig to ensure that ZoneMinder is started when you need it to.

If you do this you should find that you have files named S99zm in some of the /etc/rcX.d directories and K99zm in some of the others. The S99zm files are used for starting up ZoneMinder on system boot and the K99zm ones are used to close it on system shutdown. The 99 part is a priority, which may run from 0 to 99 and indicates where in the startup and shutdown sequences that ZoneMinder should start or stop. So S99zm means that ZoneMinder should be one of the last things to startup, which is good as it needs things like the database to be running first.

By the same token, the K00zm scripts indicate that ZoneMinder should be one of the first things to shut down. This prevents any nasty messages on your console about the database having gone away first and also will give ZoneMinder chance to shutdown in a controlled manner without introducing any corruption into the database or filesystem.

As mentioned above, this script is for Redhat, and related, distributions only. I would be grateful for any similar scripts for other distributions so if you know of one, or create one, then please send it to me.

If you are running a distribution which doesn’t support the zm script, or if you just prefer more direct control, you can now start ZoneMinder by typing

zmpkg.pl start

which, after a few seconds, should return without error. You can subsequently stop and restart everything by changing the ‘start’ parameter to ‘stop’ or ‘restart’.

Now fire up your web browser, point it at your zm.php and off you go.

Note, if you ever need to uninstall ZoneMinder you can do this by simply typing

make uninstall

though as with installation you may need to change user to have sufficient privileges. This will remove all installed files, however you will need to manually remove any databases you have created.


Referensi

Pranala Menarik