Posts Tagged ‘security’


Installing ZoneMinder on Ubuntu 14.04 Trusty Tahr

   Posted by: Dante    in General

ZoneMinder is a free open-source PVR for security cameras with plenty of features such as zone-based motion detection, support for network cameras with various protocols, etc. The install instructions on the program’s website are a bit misleading for a new install, so we’re going to do a step-by-step install walk-through here. This is based on the 1.27 release of ZoneMinder and the Server release of Ubuntu 14.04 LTS. On my first install, I used a low power machine with an Atom D525 processor, and that wasn’t nowhere near the capability needed for a single network camera, so I had to change the hardware to something beefier. Take that into consideration before starting the process. In the end, I used a small DELL desktop with an Intel C2D E6300 and it worked out great for 3 ACTi network cameras.

Let’s start with deploying Ubuntu on the machine you’ll use to record video. I did a base install with the basic Ubuntu server, OpenSSH and Samba packages, no X and no LAMP stack (this will be installed later). Configure disk as needed during the install.

After the system is operating, then we’ll add the repository for ffmpeg. With Ubuntu 14.04, they’ve switched to libav and there’s no package for ffmpeg, so we’ll add it from the official PPA. Issue these commands:

user@host:~$ sudo apt-add-repository ppa:jon-severinsson/ffmpeg
user@host:~$ sudo apt-get update

Now we’ll add a whole slew of packages, required by ZoneMinder. Issue this command:

user@host:~$ sudo apt-get install apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf libjpeg8-dev libjpeg8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libphp-serialization-perl libgnutls-dev libjpeg8-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libtool libnetpbm10-dev libavdevice-dev libmime-lite-perl dh-autoreconf dpatch git ffmpeg libvlccore-dev libvlc-dev libcurl4-gnutls-dev libjson-any-perl netpbm zip libnet-sftp-foreign-perl libio-pty-perl libexpect-perl libtiff5

Define a secure password for your MySQL install. After it completes, we’ll continue by retrieving the ZoneMinder and building the package. Let’s clone the repository under /opt and build the .deb package for installation (note that the ubuntu1204 link is not misspelled):

user@host:/opt$ sudo git clone zoneminder
user@host:/opt$ cd zoneminder
user@host:/opt/zoneminder$ sudo ln -s distros/ubuntu1204 debian
user@host:/opt/zoneminder$ sudo dpkg-checkbuilddeps
(the above command should return no results)
user@host:/opt/zoneminder$ sudo dpkg-buildpackage

This should result in a few packages being available under /opt. We’ll install the .deb package using:

user@host:/opt$ sudo dpkg -i ./zoneminder_1.27.1-1_amd64.deb

After installing the package, if it complains about dependencies, do ‘sudo apt-get -f install’ followed by ‘sudo dpkg-reconfigure zoneminder’ to correct the situation. At the time of writing, this came out clean. Now we’re going to make the web interface available via Apache:

user@host:/opt$ sudo cp /etc/zm/apache.conf /etc/apache2/sites-available/zm.conf
user@host:/opt$ sudo a2ensite zm
user@host:/opt$ sudo a2enmod cgi
user@host:/opt$ sudo service apache2 restart

This should make the web interface available through http://host/zm. Beware that this is a standard install with all defaults, so it’d be recommended to follow standard procedures to tighten down Apache’s config as well as MySQL and the system itself.

From here, standard ZoneMinder configuration applies, so just add your cameras as desired. There’s a good starter tutorial for motion detection here.

Tags: , , , , ,