Ranjan Upadhyay's Blog

September 3, 2009

Installing Zoneminder v1.24.2 on CentOS 5.3 x86

ZoneMinder Console - Running - v1.24.2

ZoneMinder Console - Running - v1.24.2

Hello there this is my  all new Zoneminder Camera Recording server running on a CentOS Linux Box.

in this post i will show you how to install ZoneMinder v1.24.2

First of all I will give you the Overview of ZoneMinder v1.24.2:-

ZoneMinder is an integrated set of applications which provide a complete surveillance solution allowing capture, analysis, recording and monitoring of any CCTV or security cameras attached to a Linux based machine. It is designed to run on distributions which support the Video For Linux (V4L) interface and has been tested with video cameras attached to BTTV cards, various USB cameras and IP network cameras. A partial list is given in the Wiki and Support sections, please give feedback in the Forums if it works with yours. ZoneMinder also requires MySQL and PHP, and is enhanced by a webserver such as Apache.

ZoneMinder is highly componentised and comprises both the back-end daemons which do the actual image capture and analysis and a user friendly web GUI enabling you to both monitor the current situation and view and organise historical events that have taken place. The web GUI allows you to check and control your ZoneMinder installation from other computers in your home or from anywhere in the world. ZoneMinder does not require X at all, or the web interface for day-to-day functions and so is also suitable for ‘headless’ systems. There is also a simple xHTML interface allowing basic monitoring from suitable phones! Recent versions of ZoneMinder also include optional DVR (digital video recorder) functions allowing you to pause, rewind and even digitally zoom both live and historical video.

There is no hard upper or lower limit to the number of cameras that ZoneMinder can support, it entirely depends on the resources available on the host PC. This means that a basic home CCTV system can often be installed on old hardware that may be lying around unused giving you DIY CCTV completely for free!

Take a look at the feature list and screenshots to see a bit more detail on what it does and then please feel free to download it and have a play. If you have any problems then please have a look through the Support and FAQ pages and the Forums and see if they help solve your problem. If you’re after compatible hardware then I sometimes have special deals on the Shop page.

–source http://www.zoneminder.com/

Feature List

  • Runs on any Linux distribution!
  • Supports video, USB and network cameras.
  • Support Pan/Tilt/Zoom cameras, extensible to add new control protocols.
  • Built on standard tools, C++, perl and php.
  • Uses high performance MySQL database.
  • High performance independent video capture and analysis daemons allowing high failure redundancy.
  • Multiple Zones (Regions Of Interest) can be defined per camera. Each can have a different sensitivity or be ignored altogether.
  • Large number of configuration options allowing maximum performance on any hardware.
  • User friendly web interface allowing full control of system or cameras as well as live views and event replays.
  • Supports live video in mpeg video, multi-part jpeg and stills formats.
  • Supports event replay in mpeg video, multi-part jpeg, stills formats, along with statistics detail.
  • User defined filters allowing selection of any number of events by combination of characteristics in any order.
  • Event notification by email or SMS including attached still images or video of specific events by filter.
  • Automatic uploading of matching events to external FTP storage for archiving and data security.
  • Includes bi-directional X.10 (home automation protocol) integration allowing X.10 signals to control when video is captured and for motion detection to trigger X.10 devices.
  • Highly partitioned design allow other hardware interfacing protocols to be added easily for support of alarm panels etc.
  • Multiple users and user access levels
  • Multi-language support with many languages already included
  • Full control script support allowing most tasks to be automated or added to other applications.
  • Support external triggering by 3rd party applications or equipment.
  • xHTML mobile/cellular phone access allowing access to common functions.

Let’s Start with Installing CentOS 5.3

Install CentOS 5.3

You can get it from http://isoredirect.centos.org/centos/5/isos/x86_64/
Or if you are using 32 bit processor try this http://isoredirect.centos.org/centos/5/isos/i386/

Have a basic Linux Box up and running and proceed to the next steps for installing ZoneMinder on it.
Step 1 – Prepare your Linux Box for Installing ZoneMinder 1.24.2
First we need to download required files and prepare the system for installation.
• Add the RPM Forge repository to CentOS. This will allow the installation of a number of services/applications later on without having to manually install them.

For 32 bit:
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

For 64 bit:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

• Download the needed files ZoneMinder 1.24.2 and the Cambozola addon

wget http://www2.zoneminder.com/downloads/ZoneMinder-1.24.2.tar.gz
wget http://www.zoneminder.com/fileadmin/downloads/cambozola.jar


• Now let’s install all the services and programs that will be needed

yum install mysql mysql-server mysql-devel php php-gd php-mysql httpd gcc pcre-devel gd mod_ssl glib2-devel gcc-c++ ntp gnutls-devel

yum install libjpeg-devel perl-Archive-Tar perl-MIME-Lite perl-MIME-tools perl-Date-Manip perl-Time-HiRes perl-LWP-UserAgent-Determined

yum install perl-PHP-Serialization perl-Device-SerialPort perl-Archive-Zip perl-Module-Load subversion

• Now let’s update everything within the new CentOS install

yum -y update

• At this point it might be useful to reboot your system. Oddly, sometimes things don’t work right unless you reboot after all the updates

reboot   -or-   shutdown -r now

Step 2 – Installing ZoneMinder 1.24.2

• After reboot log back into your system
• Now we need to make sure we use the lasted “tested” version of “ffmpeg”. This is the latest version of ffmpeg that the ZoneMinder developers have tested with

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

cd ffmpeg/

./configure

make

make install

make install-libs

_______________________________________________________________________
NB: If you get an error at this point it may be due to the ../subdir.mak file being missing.
To resolve this go to http://www.ffmpeg.org/download.html and read the info on FFmpeg Git.
Remember to delete the entire ffmpeg tree in your working directory before downloading.
After installing git and downloading the entire source tree ffmpeg installs cleanly.
_______________________________________________________________________

• Turn everything on

chkconfig httpd on

chkconfig mysqld on

chkconfig ntpd on

service httpd start

service mysqld start

service ntpd start

• Next we need to extract the contents of the ZoneMinder “tar” file, and then jump into its directory

cd /root/

tar -zxvf ZoneMinder-1.23.3.tar.gz

cd ZoneMinder-1.23.3

• Now we are going to configure ZoneMinder with some added statements. What is listed are default CentOS directory placements.

./configure –with-webdir=/var/www/html/zm –with-cgidir=/var/www/cgi-bin

By default ZM_DB_HOST=localhost, ZM_DB_NAME=zm, ZM_DB_USER=zmuser, and ZM_DB_PASS=zmpass.

• Change “zmuser” (if you want) with the user that you will use within MySQL to access the ZoneMinder database
• Change “zmpass” with the password you will be using with the “zmuser” account

So if you wish to change it then use a command like:
./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=zmuser ZM_DB_PASS=zmpass

Use IP address of if you want to use it over network.
ZM_DB_HOST=10.1.xx.xx (your IP address) instead of ZM_DB_HOST=localhost in the above command.

• if you get the configure “error zm requires libmysqlclient.a” with centos x86 add the following to the end of you configure statement

–with-extralibs=”-L/usr/lib64 -L/usr/lib64/mysql”

The command below worked in my case

./configure –with-webdir=/var/www/html/zm –with-cgidir=/var/www/cgi-bin –with-webuser=apache –with-webgroup=apache ZM_DB_HOST=192.168.3.2 ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass –with-extralibs=”-L/usr/lib64 -L/usr/lib64/mysql”

Now after the configuration is done compile the source and install it.

make

make install

• Need to add a password for the root user of MySQL
• Create the zm database
• Create the zm database user with permissions and password

mysql
mysql> SET PASSWORD FOR root@localhost=PASSWORD(‘new_root_password’);
/>Query OK, 0 rows affected (0.00 sec)
mysql> create database zm;
/>Query OK, 1 row affected (0.01 sec)
mysql> grant CREATE, INSERT, SELECT, DELETE, UPDATE on zm.* to your_zm_user@localhost;
/>Query OK, 0 rows affected (0.02 sec)
mysql> SET PASSWORD FOR your_zm_user@localhost=PASSWORD(‘your_zm_password_from_above’);
/>Query OK, 0 rows affected (0.25 sec)
mysql> exit
/>Bye

• Import the tables into the zm database
cd ZoneMinder-1.23.3
mysql -u root -p < db/zm_create.sql zm

• Make it so that ZoneMinder will startup automatically when the system is rebooted

cp scripts/zm /etc/init.d/

chmod +x /etc/init.d/zm

chkconfig zm on

• Add the Cambozola Java web interface
cp cambozola.jar /var/www/html/zm/

• and make sure you have permission to view it from apache:
chown apache:apache /var/www/html/zm/cambozola.jar

• Start ZoneMinder
service zm start

• tick the box for support for the Cambozola addon within your ZoneMinder installation: http://ip-address/zm
Now have fun and add your cameras to ZoneMinder knowing that you now have a very stable and streamlined OS to run it on.

Reblog this post [with Zemanta]
Advertisements

2 Comments »

  1. Great Article.I will try it!!
    Thx

    Comment by Alok — December 10, 2009 @ 7:35 pm

  2. I followed your detailed and useful ZoneMinder recipe. It worked (266 packages in yum -y update took a while), except following missing files (yum install cures in parens): libjpeg.a (libpng-devel libjpeg-devel libpng libjpeg), Date::Manip (perl-Date-Manip), LWP::UserAgent (perl-libwww-perl). The last required
    yum whatprovides ‘perl(LWP::Useragent)’
    to find it.
    Perhaps my mistake was to substitute my client 192.168.0.85 for localhost in the ./configure and mysql setup. (Actually, I did grant and set password both for 192.168.0.85 and localhost users with same name and password in the mysql.) I was in root and used root password in the mysql -u command. Everything worked, except
    service zm start
    hangs. So does service zm status, /etc/rc.d/init.d/zm status, etc, but before it does, it reports httpd and mysqld are running, so it appears to hang in loadconf or zmpkg.pl (?). I tried it from both a remote terminal (putty) and the terminal within the CentOS UI. Any ideas would be appreciated.

    Comment by Larry Dickson — February 11, 2010 @ 5:02 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: