ZoneMinder RPM Repository Now Available

zoneminder-logo

My ZoneMinder installation has been nagging me to update to 1.28 for the last few weeks. Things are not broken, so I thought I do not want touch anything.

Well, today I checked out the git repo for ZoneMinder and saw something new in the README.MD.

Additional repositories must be added before one can build zoneminder on CentOS or RHEL:

  1. Zmrepo ZoneMinder WiKi

Zmrepo is new. I have never seen this before. Checking the commits by the developers, I found that it had just been added.

The link to the wiki says,

Zmrepo – A ZoneMinder repository for RPM based distros 

I’d like to introduce you to a new, easier way to install ZoneMinder on CentOS. Zmrepo is meant to be a turn-key solution. There is no compiling, no installing modules from CPAN, and no more complicated repository instructions.

This repository brings together a ZoneMinder rpm built by the development team, with all features enabled. It also includes all dependencies that are not found in the default CentOS repositories. A few Perl modules are built by us, but all the rest of the dependencies are mirrored from popular sites such as EPEL and RPMFusion. There is no longer a need to add these additional repositories to your system. Zmrepo takes care of that for you.

Please note that zmrepo has not had a lot of testing! If unsure, try it out first in a virtual environment before using this in production.

And lastly, only CentOS 6 is supported at the moment. This repo will not work with CentOS 7.

This is great news. No more fumbling with self-compilation. But of course, it has to be tested to see if the problems I had in the past with libvlc and libjpeg-turbo has been resolved.

The easiest way for me to test this out to spin up a VM on DigitalOcean. Note that the repo only works on CentOS 6, so do not get a CentOS 7 VM. I shan’t go into the details of bringing up the VM.

With the VM up, the first thing I tried was to install the repo and tried install ZoneMinder without RPMForge and EPEL. I wanted to see the zmRepo takes care of all the dependencies instead of depending on 3rd-party repos. And bingo! The installation completed without any 3rd party repos.

By the way, the ZoneMinder version in the repo is 1.28.

Installation is just 3 steps now.

wget http://zmrepo.connortechnology.com/el/6/i386/zmrepo-6-4.el6.noarch.rpm
sudo yum install --nogpgcheck zmrepo-6-4.el6.noarch.rpm
sudo yum install zoneminder

After the installation, there’s a bunch of instructions to be completed before ZoneMinder will work.

=======================================================================
 NEW INSTALLS
=======================================================================
1. Unless you are already using MySQL server, you need to ensure that
the server is confired to start during boot and properly secured
by running:

sudo service mysqld start
/usr/bin/mysql_secure_installation
sudo chkconfig mysqld on

2. Using the password for the root account set during the previous step, you will need to create the ZoneMinder database:

mysql -uroot -p
mysql> create database zm;
mysql> grant select,insert,update,delete,lock tables,alter on zm.* to 'zmuser'@localhost identified by 'zmpass';
mysql> exit;
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysqladmin -uroot -p reload

3. If you have chosen to change the zoneminder mysql credentials to something other than zmuser/zmpass then you must now edit /etc/zm.conf. Change ZM_DB_USER and ZM_DB_PASS to the values you created in step 2.

4. IMPORTANT: Edit /etc/php.ini and put in the appropriate timezone for date.timezone!

5. The ZoneMinder web interface is disabled by default, you will need to edit this file to enable it: 

/etc/httpd/conf.d/zoneminder.conf

HINT: Most users will want to simply delete the line that says

"Deny from all".

6. Configure the web server to start automatically:
sudo chkconfig httpd on
sudo service httpd start

7. This package will automatically configure and install an SELinux policy called local_zoneminder. A copy of this policy is in the documentation folder. 

Unfortunately, this has not resolved all the SELinux issues so
most will want to disable SELinux permanently by editing the following: 
/etc/selinux/conf

Change SELINUX line from "enforcing" to "disabled". This change will not take effect until a reboot, however. To avoid a reboot, execute the following from the commandline:

sudo setenforce 0

8. Finally, you may start the ZoneMinder service:

sudo service zoneminder start

Then point your web browser to http:///zm

Once you have completed the steps above for new installation, ZoneMinder should run.

Something additional that I did was to increase the swap memory on the VM. ZoneMinder needs alot of memory to run.

# dd if=/dev/zero of=/swapfile bs=1M count=2048
# mkswap /swapfile 
# swapon /swapfile

To make this permanent, add this line into /etc/fsab

/swapfile swap swap defaults 0 0

This is the interesting part about DigitalOcean. I got the smallest instance of the VM with 512MB of memory. And since DigitalOcean runs all the VMs on SSD, having swap on SSD seems to be a good idea. I have tested this on another VM of mine running other services and the performance has been satisfactory.

Okay, here’s where the problem comes. If I use libvlc, as the source, the error I get is dbus related. ZoneMinder complains that /bin/dbus is missing. This can be resolved by installing dbus-x11.

# yum -y install dbus-x11

But after this is resolved, another problems crops up. Now the complain is :

Failed to connect to the D-Bus session daemon: /bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.

Up to this point, I decided to give up and use ffmpeg instead. Disk space and RAM are both limited on this USD $5 VM from DigitalOcean. I’m not about to install all the X-11 dependencies and run redundancy services.

In conclusion, this RPM repo really makes life easy for installation of ZoneMinder. The whole process from spinning up of the VM to configuring the first camera took me less than 20 mins. Of course to be fair, I do have prior understanding of ZoneMinder, but my guess is it wouldn’t take more than an hour even for someone completely new to ZoneMinder.

Here’s a referral link to DigitalOcean. Signing up with this link gives you USD $10 credit to try them out and earn me credits for use with DigitalOcean, on which I host this blog and my ZoneMinder server.

https://www.digitalocean.com/?refcode=e49cbd44c56b

Author: yibi

YiBi's numb :) YiBi writes about anything. Technology, Gossips, Rubbish YiBi's a half f%#k geek :P

Optimization WordPress Plugins & Solutions by W3 EDGE