当前位置: 首页 > 工具软件 > ZoneMinder > 使用案例 >

ZONEMINDER

呼延渝
2023-12-01

ZoneMinder is arguably one of the best video camera applications available for Linux, especially if you need to capture images and/or video from multiple cameras, both remote and local. It offers a huge set of features that just aren’t available in other pieces of free software. Getting it to compile on Centos 6 (64bit), however, is a bit of a chore.

There is some information in the ZoneMinder wiki on compiling and installing ZoneMinder on Centos 6, but these instructions are incomplete, and will not work. After helping a coworker get it up and running, and finding little information out there for Centos 6, I decided to turn it into a blog post.

The following procedure will allow you to compile and install ZoneMinder 1.25 on Centos 6 64bit with all options enabled. All actions should be done as root.

Procedure

1] Install Centos 6 using the 64bit minimal install DVD. I highly recommend using the minimal install, but you can probably use disk 1 of the full install if you want.

2] Run updates:

yum -y update

3] Disable SELinux by editing /etc/sysconfig/selinux and changing the SELINUX line to disabled:

SELINUX=disabled

4] Reboot

5] Install RPMForge yum repository:

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -ihv http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

6] Install needed dependencies:

yum install gcc gcc-c++ wget mysql-devel mysql-server php php-mysql php-pear php-pear-DB php-mbstring \
bison bison-devel httpd make ncurses ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver \
sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel libv4l-devel ffmpeg ffmpeg-devel \
zlib zlib-devel openssl openssl-devel gnutls-devel php-process perl-Time-HiRes perl-CPAN pcre-devel libjpeg-devel \
perl-Date-Manip perl-libwww-perl perl-Module-Load perl-Net-SFTP-Foreign perl-Archive-Tar perl-Archive-Zip perl-Expect \
perl-MIME-Lite perl-Device-SerialPort

7] Install Sys::Mmap module if you want mmap enabled. Also install MIME::Entity and X10 camera support, if desired. Just hit enter to accept the default for any question you’re asked. Do each of these separately, one at a time (ie, don’t just copy and paste the following three lines in one go, do one at a time).

perl -MCPAN -e 'install Sys::Mmap'
perl -MCPAN -e 'install MIME::Entity'
perl -MCPAN -e 'install X10::ActiveHome'

8] Download Zoneminder install:

cd /usr/local/src
wget http://www2.zoneminder.com/downloads/ZoneMinder-1.25.0.tar.gz
tar xzvf ZoneMinder-1.25.0.tar.gz
cd ZoneMinder-1.25.0

9] Run configure. NOTE: The database username and password specified in this step are also used in step 13.

CXXFLAGS=-D__STDC_CONSTANT_MACROS ./configure --with-webdir=/var/www/html/zm  --with-cgidir=/var/www/cgi-bin --with-webuser=apache \
--with-webgroup=apache ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=YOURZMUSER ZM_DB_PASS=YOURZMPASSWORD ZM_SSL_LIB=openssl \
--with-extralibs="-L/usr/lib64 -L/usr/lib64/mysql -L/usr/local/lib" --with-libarch=lib64 --with-ffmpeg

If you don’t want mmap support, add “–enable-mmap=no“:

CXXFLAGS=-D__STDC_CONSTANT_MACROS ./configure --with-webdir=/var/www/html/zm  --with-cgidir=/var/www/cgi-bin --with-webuser=apache \
--with-webgroup=apache ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=YOURZMUSER ZM_DB_PASS=YOURZMPASSWORD ZM_SSL_LIB=openssl \
--with-extralibs="-L/usr/lib64 -L/usr/lib64/mysql -L/usr/local/lib" --with-libarch=lib64 --with-ffmpeg --enable-mmap=no

10] Compile and install:

make
make install

11] Start mysqld for the first time:

service mysqld start

12] Set your root mysql password by following the instructions in the output:

/usr/bin/mysqladmin -u root password 'NEWPASSWORD'

13] Create your Zoneminder database and user, and give the user access to the database, and reload privs. NOTE: YOURZMUSER and YOURZMPASSWORD need to be the same as in the configure statement in step 9. When prompted for the password for root, use the one you set in step 12.

mysql -u root -p
create database zm;
CREATE USER 'YOURZMUSER'@'localhost' IDENTIFIED BY 'YOURZMPASSWORD';
grant CREATE, INSERT, SELECT, DELETE, UPDATE on zm.* to YOURZMUSER@localhost;
FLUSH PRIVILEGES;
exit

14] Load in initial SQL data for ZoneMinder:

mysql -u root -p zm < /usr/local/src/ZoneMinder-1.25.0/db/zm_create.sql

15] Copy the start script to /etc/init.d and configure it to start on boot. Also set other services to start on boot:

cp /usr/local/src/ZoneMinder-1.25.0/scripts/zm /etc/init.d/
chmod +x /etc/init.d/zm
chkconfig zm on
chkconfig mysqld on
chkconfig httpd on

16] Copy Cambozola jar file:

cd /var/www/html/zm
wget http://www.zoneminder.com/sites/zoneminder.com/downloads/cambozola.jar
chown apache:apache /var/www/html/zm/cambozola.jar

17] Edit php.ini and set:

short_open_tag = On

This is off by default.
18] Start Apache and ZoneMinder:

service httpd start
service zm start

19] Browse to your web interface using http://YOURIP/zm. You should see the ZoneMinder Console web interface.

 

Troubleshooting

If you are not able to pull up the web interface, check the following:

Iptables - Centos 6 comes with a restrictive set of iptables rules. If you’re providing firewall through some other method (ex, a hardware firewall), you can shut iptables off and prevent it from starting on boot by doing the following:

service iptables stop
chkconfig iptables off

If you need to use iptables for firewalling, edit /etc/sysconfig/iptables and add a line just below the line for port 22 (SSH) to allow web (port 80) connections:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Then restart iptables:

service iptables restart

PHP Short Open Tags – Check your /var/log/httpd/error_log file. If you have error messages like the following, redo step 17.

PHP Parse error:  syntax error, unexpected $end in /var/www/html/zm/includes/functions.php on line 2437

After editing the /etc/php.ini file, you must restart httpd:

service httpd restart

Next Steps

Once you have the web interface up, you’ll want to click on Options in the upper right.

The System tab will allow you to turn on authentication. By default, ZoneMinder does not require any username and password.

Under the Images tab, click the check box next to OPT_CAMBOZOLA to use the Java streaming client for better refresh rates.

On the main page, click Add New Monitor to start adding cameras to monitor.

 类似资料:

相关阅读

相关文章

相关问答