Install Zoneminder 1.25.0 in your Guruplug

Forum for questions and support relating to the 1.25.x releases only.
Locked
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Install Zoneminder 1.25.0 in your Guruplug

Post by PacoLM »

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 all

mysqladmin -u root -pnosoup4u password 'yournewpwd'
Change ssh keys

Code: Select all

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 all

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 all

# 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 all

apt-get update && apt-get upgrade
In case of problems with GPG keys

Code: Select all

 
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 all

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 all

vi /etc/ntp.conf
Add ntp servers (for Spain) to the file and save it

Code: Select all

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 all

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://download.webmin.com/download/repository sarge contrib
In case of errors complaining about buffer size, edit or create a file /etc/apt/apt.conf file and add

Code: Select all

APT::Cache-Limit 33554432;
Update your system again

Code: Select all

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 all

vi /etc/apache2/httpd.conf 
Add line -> ServerName localhost

Code: Select all

  
/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 all

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 all

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 all

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 all

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 all

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 all

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=zpass 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 all

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 all

vi /etc/init.d/zoneminder
Paste this lines

Code: Select all

#!/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 all

chmod 755 /etc/init.d/zoneminder
service zoneminder status
Configure apache, edit the file /etc/apache2/sites-enabled/000-default , replace:

Code: Select all

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 all

$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

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: Install Zoneminder 1.25.0 in your Guruplug

Post by bb99 »

While I don't have or use an ARM this is an exceptional effort! Can't wait for the posts from the smart phone users (ARM processors) running ZM native...
Locked