My First Referral Payout From Digital Ocean

Referral Payout From DigitalOcean
Referral Payout From DigitalOcean

After using DigitalOcean for a couple of months and referring their excellent service to friends, I finally received my first referral payout. I opt’d for the payout to be credited to my account, which goes into paying for the hosting of this blog and my home surveillance with ZoneMinder.

Thank you friends for using DigitalOcean! Lol!

To sign up with my referral link, go to http://bit.ly/FreeDigitalOcean. For new sign ups you get USD $10 of credit which good for 2 months if you are using their most basic VM. I’m running 2 of those. At the moment, I think it’s the most value for money. The SSD makes up for the lower RAM, my geeky friends will know how to make the most out of the faster IO. :)

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

Building ZoneMinder deb Packages On Debian 7.1 (Wheezy)

This a condensation of what I needed to build the ZoneMinder deb packages. I’m on Debian 7.1 (Wheezy).

1. Clone the ZoneMinder source from git.

git clone https://github.com/ZoneMinder/ZoneMinder zoneminder

2. Go into the zone minder directory and do the necessary linking for deb package compilation

cd zoneminder
ln -s distros/debian .

 

3. Install the necessary packages for compiling deb packages.

aptitude update && aptitude -y install build-essential

4. Install the necessary packages for compilation and running of ZoneMinder

aptitude -y install  debhelper autoconf automake dpatch libphp-serialization-perl libgnutls-dev libmysqlclient-dev libdbd-mysql-perl libdate-manip-perl libwww-perl libjpeg8-dev libpcre3-dev libavcodec-dev libavformat-dev libswscale-dev  libavutil-dev libv4l-dev libbz2-dev libtool libsys-mmap-perl ffmpeg libnetpbm10-dev libavdevice-dev libdevice-serialport-perl libarchive-zip-perl libmime-lite-perl libjpeg8 dh-autoreconf libvlc-dev libvlc5 libvlccore-dev libvlccore5 vlc-data vlc

5. Get libjpeg-turbo. This needed for libvlc to work. Else libvlc can only do grayscale streams.

wget "http://downloads.sourceforge.net/project/libjpeg-turbo/1.3.1/libjpeg-turbo-official_1.3.1_amd64.deb"
dpkg -i libjpeg-turbo-official_1.3.1_amd64.deb

6. Add your new libjpeg-turbo to the LD_LIBRARY_PATH

echo "/opt/libjpeg-turbo/lib64" > /etc/ld.so.conf.d/libjpeg-turbo.conf
ldconfig

7. Edit the debian/rules file to make sure that the compilation uses libjpeg-turbo instead of libjpeg8. Please do not attempt to remove libjpeg8. It’s going to break a lot of stuff in your system. Edit the CXXFLAGS

Edit the CXXFLAGS in the debian/rules
Edit the CXXFLAGS in the debian/rules
CXXFLAGS = -DHAVE_LIBCRYPTO -I/opt/libjpeg-turbo/include -L/opt/libjpeg-turbo/lib64

Add this in your debian/rules as well.  Do this somewhere at the bottom.

Edit the debian/rule file
Edit the debian/rule file
override_dh_shlibdeps:
    dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

8. Start the compilation!

dpkg-buildpackage

9. At the end of build you should see this.

Successfully built ZoneMinder
Successfully built ZoneMinder

10. Install the ZoneMinder package. The deb packages are one level up from the source. You should see these packages.

The ZoneMinder deb Packages
The ZoneMinder deb Packages

Install the dependencies for ZoneMinder.

aptitude -y install apache2 libapache2-mod-php5 php5 php5-mysql mysql-client libjson-any-perl netpbm zip libnet-sftp-foreign-perl libio-pty-perl libexpect-perl mysql-server

To install ZoneMinder:

dpkg -i zoneminder_1.26.5-1_amd64.deb

Ignore the version number. The current version of ZoneMinder is 1.27.1. The right version will appear when you use the software.

Configure the Apache portion to ZoneMinder:

cd /etc/apache2/conf.d
ln -s /etc/zm/apache.conf .
/etc/init.d/apache2 restart

That’s it! ZoneMinder built and installed!

 

Optimization WordPress Plugins & Solutions by W3 EDGE