New IT forum
10 August 2022, 10:52:43 pm *
Welcome, %1$s. Please login or register.

: PiHub now in stock.
 
Pages: [1]

Author Topic: Install Zoneminder 1.25.0 in your Guruplug  (Read 26891 times)

PacoLM

  • Full Member
  • ***
  • Posts: 108
Install Zoneminder 1.25.0 in your Guruplug
« on: 22 October 2011, 08:36:56 pm »

Here is the comprehensive list of steps to have the fantastic Zoneminder application in your Guruplug (should work also in Sheeva plugs). I wrote all the steps I followed after reflashing my Guruplug with the original kernel and rootfs.

Change mysql root password
Code: [Select]
mysqladmin -u root -pnosoup4u password 'yournewpwd'
Change ssh keys
Code: [Select]
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server

Comment or delete all the lines in init_setup.sh and wlan.sh-To have a fixed IP address, add these lines in your init_setup.sh, replace the XXX with your own parameters:
Code: [Select]
ifconfig eth0 xxx.xxx.xxx.xxx netmask 255.255.255.0 up
route add -net xxx.xxx.xxx.xxx netmask 255.255.255.0 eth0
route add default gw xxx.xxx.xxx.xxx eth0

Also, edit the file /etc/network/interfaces to look like this, as above, replace the XXX with your settings:
Code: [Select]
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx

Reboot, now the ipaddress should be the one you selected.

Update your system:
Code: [Select]
apt-get update && apt-get upgrade

In case of problems with GPG keys
Code: [Select]

apt-get install debian-archive-keyring && apt-get update && apt-get upgrade

I removed some apps that I'm not planning to use, then install some packages
Code: [Select]
apt-get purge alsa-base linux-sound-base
apt-get autoremove && apt-get clean
apt-get install locales localepurge
dpkg-reconfigure locales
dpkg-reconfigure tzdata
apt-get install di htop chkconfig
apt-get install ntp
apt-get autoremove && apt-get clean

Setup your ntp
Code: [Select]
vi /etc/ntp.conf
add servers (for Spain) to the file and save it
Code: [Select]
server 0.es.pool.ntp.org
server 1.es.pool.ntp.org
server 2.es.pool.ntp.org
server 3.es.pool.ntp.org

Change /etc/apt/sources.list to have these lines
Code: [Select]
deb-src http://security.debian.org/ wheezy/updates main
deb http://security.debian.org wheezy/updates main contrib non-free
deb http://ftp.fr.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.fr.debian.org/debian/ squeeze main contrib non-free
deb http://ftp.us.debian.org/debian wheezy main contrib non-free
deb http://http.us.debian.org/debian stable main contrib non-free
#deb http://ftp.us.debian.org/debian/ lenny main contrib non-free
#deb http://www.backports.org/debian lenny-backports main contrib non-free
#deb http://download.webmin.com/download/repository sarge contrib
#deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
#deb http://ftp.es.debian.org/debian/ wheezy main
#deb http://ftp.es.debian.org/debian/ wheezy main
#deb-src http://ftp.es.debian.org/debian/ wheezy main
#deb http://security.debian.org/ wheezy/updates main

In case of errors complaining about buffer size,  edit or create a file /etc/apt/apt.conf file and add
Code: [Select]
APT::Cache-Limit 33554432;
Update your system again
Code: [Select]
apt-get update && apt-get upgrade
apt-get dselect-upgrade (fix broken dependencies & update system)
apt-get clean && apt-get autoremove
apt-get purge bluez samba alsa-base alsa-utils lighttpd
apt-get autoremove
apt-get install mysql-server apache2
dpkg-reconfigure apache2

After restarting apache2, fix the error "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName"
Code: [Select]
vi /etc/apache2/httpd.conf Add line -> ServerName localhost
Code: [Select]
 
/etc/init.d/apache2 restart
apt-get install ufw preload fail2ban ffmpeg libjs-mootools
apt-get install ntp tzdata fail2ban locate nmap tar zip
apt-get install debian-archive-keyring bc coreutils
apt-get purge exim4
apt-get install postfix mailx phpmyadmin

Update kernel
Code: [Select]
cd /root
wget http://sheeva.with-linux.com/sheeva/README-PLUG-UPDATE.sh
mv README-PLUG-UPDATE.sh upgradeGuru.sh
chmod +x upgradeGuru.sh
./upgradeGuru.sh 3.0.7 --nandkernel
rm sheeva-3*
reboot

Install systemd to improve performance
Code: [Select]
apt-get install systemd
apt-get autoremove

In case Webmin is needed, but be careful, you will need almost 100Mbytes, so installing it in flash is not recommended. Uncomment this line in /etc/apt/sources.list
#deb http://download.webmin.com/download/repository sarge contrib
Then:
Code: [Select]
wget -q http://www.webmin.com/jcameron-key.asc -O- | apt-key add -
apt-get install webmin

Install the packages needed to compile and run ZM
Code: [Select]
apt-get install autoconf automake make
apt-get install gcc  
apt-get install g++
apt-get install libphp-serialization-perl libgnutls-dev gnutls-bin
apt-get install build-essential libmysqlclient-dev libjpeg8-dev
apt-get install libcrypto++-dev libssl-dev perl libdate-manip-perl
perl -MCPAN -e shell
install Sys::Mmap Device::SerialPort Net::SFTP::Foreign Expect Archive::Zip MIME::Lite MIME::Entity X10::ActiveHome LWP::UserAgent
quit
apt-get install gawk mawk php5 php5-mysql libdbd-mysql-perl libwww-perl
apt-get install libavformat-dev libswscale-dev libavutil-dev libv4l-dev
apt-get install libpcre3-dev libsys-mmap-perl libavcodec-dev libavdevice-dev libbz2-dev
apt-get install dh-autoreconf libnet-ssleay-perl openssl libauthen-pam-perl
apt-get clean && apt-get autoremove

Get ZM and modify bugs
Code: [Select]
cd /usr/src
wget http://www.zoneminder.com/downloads/ZoneMinder-1.25.0.tar.gz
tar -xzvf ZoneMinder-1.25.0.tar.gz
mv ZoneMinder-1.25.0 zm

Important, to compile Zoneminder in Arm, edit /usr/src/zm/scr/zm_signal.cpp, change all the occurrences of context.cr2 to context.fault_address
Acknowledgment to the user paketecuento from plugcomputer.org, he gave me the clue!

Compile ZM
Code: [Select]
export CFLAGS="-march=armv5te -O2 -mtune=arm926ej-s -Fno-strict-aliasing -msoft-float -D__GCC_FLOAT_NOT_NEEDED" && \
export CXXFLAGS="${CFLAGS}" && \
export CPPFLAGS="${CFLAGS}"
./configure --with-webdir=/usr/share/zoneminder --with-cgidir=/usr/lib/cgi-bin --prefix=/usr/bin \
ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser \
ZM_DB_PASS=zmpass ZM_SSL_LIB=openssl --enable-debug=no \
--with-webgroup=www-data --with-webuser=www-data --enable-mmap=yes --with-libarch=lib --with-ffmpeg=/usr/local/bin CPPFLAGS="-D__STDC_CONSTANT_MACROS ${CPPFLAGS}"
make
automake
aclocal
mysqladmin -u root -p -f drop zm
mysql -u root -p < db/zm_create.sql
mysql -u root -p
grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
quit
mysqladmin -p reload
make install
make clean

Install Cambozola
Code: [Select]
cd /usr/src && wget http://www.charliemouse.com:8080/code/cambozola/cambozola-latest.tar.gz
tar -xzvf cambozola-latest.tar.gz
cp cambozola-0.92/dist/cambozola.jar /var/www/zm

Create the startup script
Code: [Select]
vi /etc/init.d/zoneminder
Paste this lines
Code: [Select]
#!/bin/sh
prog=ZoneMinder
ZM_PATH_BIN="/usr/bin/bin"
command="$ZM_PATH_BIN/zmpkg.pl"

start() {
        echo -n "Starting $prog: "
        $command start
        RETVAL=$?
        [ $RETVAL = 0 ] && echo success
        [ $RETVAL != 0 ] && echo failure
        return $RETVAL
}
stop() {
        echo -n "Stopping $prog: "
        $command stop
        RETVAL=$?
        [ $RETVAL = 0 ] && echo success
        [ $RETVAL != 0 ] && echo failure
}
status() {
        result=`$command status`
        if [ "$result" = "running" ]; then
                echo "ZoneMinder is running"
                RETVAL=0
        else
                echo "ZoneMinder is stopped"
                RETVAL=1
        fi
}

case "$1" in
'start')
        start
        ;;
'stop')
        stop
        ;;
'restart')
        stop
        start
        ;;
'status')
        status
        ;;
*)
        echo "Usage: $0 { start | stop | restart | status }"
        RETVAL=1
        ;;
esac
exit $RETVAL

Save it, then
Code: [Select]
chmod 755 /etc/init.d/zoneminder
service zoneminder status

Configure apache, edit the file /etc/apache2/sites-enabled/000-default , replace:
Code: [Select]
DocumentRoot /var/www
by
DocumentRoot /usr/share/zoneminder
and
<Directory /var/www/>
by
<Directory /usr/share/zoneminder/>
service apache2 restart

To remove errors "zmwatch[2429].ERR [Shared data size conflict in shared_data for monitor Monitor-1, expected 328, got 316]", edit /usr/local/share/perl/5.12.4/ZoneMinder/Memory.pm and replace:
Code: [Select]
$arch = int(3.2*length(~0));
with
$arch = 32;

Cleanup & free some space
apt-get purge autoconf automake make gcc g++-4.6 libstdc++6-4.6-dev

Now you could setup your Zoneminder surveillance system in this small beast!

Hope it helps,

PacoLM
« Last Edit: 11 November 2011, 06:20:43 am by PacoLM »
Logged

kai

  • Newbie
  • *
  • Posts: 8
Re: Install Zoneminder 1.25.0 in your Guruplug
« Reply #1 on: 11 November 2011, 06:11:46 am »

Dear Paco LM

I install the ZM-1.25.0 according your installation instruction

when I start the ZM

this is error messages

[email protected]:~# service zoneminder start
Starting ZoneMinder: DBI connect('database=zm;host=localhost','zmuser',...) failed: Access denied for user 'zmuser'@'localhost' (using password: YES) at /usr/bin/share/perl/5.12.4/ZoneMinder/Config.pm line 89
Can't call method "prepare_cached" on an undefined value at /usr/bin/share/perl/5.12.4/ZoneMinder/Config.pm line 91.
BEGIN failed--compilation aborted at /usr/bin/share/perl/5.12.4/ZoneMinder/Config.pm line 100.
Compilation failed in require at /usr/bin/share/perl/5.12.4/ZoneMinder.pm line 33.
BEGIN failed--compilation aborted at /usr/bin/share/perl/5.12.4/ZoneMinder.pm line 33.
Compilation failed in require at /usr/bin/bin/zmpkg.pl line 37.
BEGIN failed--compilation aborted at /usr/bin/bin/zmpkg.pl line 37.
failure

Please help me

thx

Kai
Logged

PacoLM

  • Full Member
  • ***
  • Posts: 108
Re: Install Zoneminder 1.25.0 in your Guruplug
« Reply #2 on: 11 November 2011, 06:20:11 am »

Sorry, typo error in the configuration part:

Code: [Select]
./configure --with-webdir=/usr/share/zoneminder --with-cgidir=/usr/lib/cgi-bin --prefix=/usr/bin \
ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser \
ZM_DB_PASS=[b]zpass[/b] ZM_SSL_LIB=openssl --enable-debug=no \
--with-webgroup=www-data --with-webuser=www-data --enable-mmap=yes --with-libarch=lib --with-ffmpeg=/usr/local/bin CPPFLAGS="-D__STDC_CONSTANT_MACROS ${CPPFLAGS}"

Should be:
Code: [Select]
./configure --with-webdir=/usr/share/zoneminder --with-cgidir=/usr/lib/cgi-bin --prefix=/usr/bin \
ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser \
ZM_DB_PASS=[b]zmpass[/b] ZM_SSL_LIB=openssl --enable-debug=no \
--with-webgroup=www-data --with-webuser=www-data --enable-mmap=yes --with-libarch=lib --with-ffmpeg=/usr/local/bin CPPFLAGS="-D__STDC_CONSTANT_MACROS ${CPPFLAGS}"

In your case run this:
Code: [Select]
mysqladmin -u root -p -f drop zm
mysql -u root -p < db/zm_create.sql
mysql -u root -p
grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zpass';
quit
mysqladmin -p reload

Using zpass as the mysql password. Should work.

I will edit the original post to avoid this errors.

Hope it helps,

PacoLM
« Last Edit: 11 November 2011, 06:23:09 am by PacoLM »
Logged

kai

  • Newbie
  • *
  • Posts: 8
Re: Install Zoneminder 1.25.0 in your Guruplug
« Reply #3 on: 18 November 2011, 07:36:49 am »

Dear Paco LM

Thank you for your help

B.R.

Kai
Logged

bulek

  • Newbie
  • *
  • Posts: 9
Re: Install Zoneminder 1.25.0 in your Guruplug
« Reply #4 on: 14 December 2011, 07:37:28 pm »

Hi,

can you both please give some more info about how Zoneminder works on Plug ? What cameras do you use? Motion Detection?

How much CPU does it take ? Is Plug fast enough ?

Thanks in advance,

regards,

Bulek.
Logged

PacoLM

  • Full Member
  • ***
  • Posts: 108
Re: Install Zoneminder 1.25.0 in your Guruplug
« Reply #5 on: 14 December 2011, 09:38:48 pm »

can you both please give some more info about how Zoneminder works on Plug ? What cameras do you use? Motion Detection?
I have 3 ipcams working in motion detection mode, their resolution is 320x240, enough for the areas being surveilled.

How much CPU does it take ? Is Plug fast enough ?

The CPU load depends on the FPS you capture and the area of the zone used for motion detection basically, bigger the area, more CPU load, it's a bit tricky, but easy to get good results.
 When not in alarm mode, the average log is about 0.3, and the free memory is about 200Mbytes from 512Mbytes. Each zma and zmu process for the image capture and process takes about 3% of CPU. The CPU load gets higher when an alarm is fired due to the motion detection, then I have a filter that creates a video of the alarm and sends an email, that could rise the CPU load up to 3 or 4 depending on the rest of processes running.
 The plug, in my opinion makes a good job, even that a faster processor and bigger memory would be nice to have. I'm happy because before I had a computer to do the same job, and the power comsumption and performance of this small beast is good enough for my needs.


 By the way, my guruplug boots from a SSD SATA hard drive, I have written a procedure to install the complete debian distribution from scratch and then install ZM1.25, let me know if you want to try it!.

Hope it helps,

PacoLM
« Last Edit: 14 December 2011, 09:43:29 pm by PacoLM »
Logged
Pages: [1]
 
 

Powered by MySQL Powered by PHP SMF 2.0.10 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!