Ubuntu Server 9.04 - ZM 1.24.2 Source Installation Guide

Forum for questions and support relating to the 1.24.x releases only.
MILxDOT
Posts: 64
Joined: Wed Mar 29, 2006 5:12 am

Ubuntu Server 9.04 - ZM 1.24.2 Source Installation Guide

Post by MILxDOT »

I thought that this little updated step by step guide might help others. Most of the content was from jsylvia's wiki guide. I have performed this install on 64 and 32 bit systems.

INSTALL SERVER OS
Install Ubuntu Server 9.04 amd64. Do not install any packages other than openssh-server.

GO SUDO AND STAY THERE FOR ENTIRE INSTALLATION
sudo -i

UPDATE SERVER OS
apt-get update; apt-get dist-upgrade

CHANGES FOR LIB PATHS
echo "/usr/local/lib" > /etc/ld.so.conf.d/ffmpeg.conf
echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> /etc/bash.bashrc
echo "export LD_LIBRARY_PATH" >> /etc/bash.bashrc
ldconfig

INSTALL ALL PREREQUISITES
apt-get install build-essential linux-headers-`uname -r` automake perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libmd5-perl apache2 php5-mysql libapache2-mod-php5 mysql-server libmysqlclient15-dev libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libjpeg62 libjpeg62-dev libmime-perl libstdc++6 libwww-perl zlib1g zip unzip patch ntp openssl libpcre3-dev libssl-dev libjpeg-progs libcurl4-gnutls-dev munin munin-node libmime-lite-perl netpbm libbz2-dev subversion sysvconfig checkinstall

INSTALL PERL MODULES
perl -MCPAN -e shell

install CPAN
exit

perl -MCPAN -e shell
install YAML PHP::Serialization Module::Load X10::ActiveHome

exit

INSTALL FFMPEG
cd /usr/src

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

cd ffmpeg

./configure --enable-gpl --enable-shared --enable-pthreads

make
checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3" --default

ldconfig

INSTALL AND CONFIGURE ZONEMINDER
cd /usr/src
svn co http://svn.zoneminder.com/svn/zm/trunk zm
cd zm

./configure --with-webdir=/var/www --with-cgidir=/usr/lib/cgi-bin ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass --enable-debug=yes --with-webgroup=www-data --with-webuser=www-data

aclocal
autoconf
automake
make

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';
flush privileges;
quit

checkinstall --fstrans=no --install=yes --pkgname=ZoneMinder --pkgversion "1.24.svn`date +%Y%m%d`" --default

INSTALL CAMBOZOLA
cd /usr/src
wget http://www.charliemouse.com:8080/code/c ... est.tar.gz
tar -xzvf cambozola-latest.tar.gz
cp cambozola-0.76/dist/cambozola.jar /var/www

INSTALL JSCALENDAR
cd /usr/src
wget http://prdownloads.sourceforge.net/jsca ... p?download
unzip jscalendar-1.0.zip
mkdir /var/www/tools/jscalendar
cp -R jscalendar-1.0/* /var/www/tools/jscalendar

REMOVE EXISTING index.html
rm /var/www/index.html

CREATE ZONEMINDER STARTUP SCRIPT
**If you don't know how to use vi then use nano instead for next stop**

vi /etc/init.d/zm

(PASTE THE FOLLOWING)

#!/bin/sh
# description: Control ZoneMinder as a Service
# chkconfig: 2345 99 99

# Source function library.
#. /etc/rc.d/init.d/functions

prog=ZoneMinder
ZM_PATH_BIN="/usr/local/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 AND EXIT)

MAKE ZM STARTUP SCRIPT EXECUTABLE
chmod 755 /etc/init.d/zm

USE sysvconfig TO START ZONEMINDER UPON REBOOT
sysvconfig

IF YOU ARE USING UBUNTU amd64 VERSION CREATE SYMBOLIC LINKS
cd /usr/lib64
ln -s /usr/local/lib/libswscale.so.0 ./libswscale.so.0
ln -s /usr/local/lib/libavformat.so.52 ./libavformat.so.52
ln -s /usr/local/lib/libavcodec.so.52 ./libavcodec.so.52
ln -s /usr/local/lib/libavutil.so.50 ./libavutil.so.50
ln -s /usr/local/lib/libavdevice.so.52 ./libavdevice.so.52

REBOOT THE SERVER
/sbin/shutdown now -r
Zealhybrid
Posts: 4
Joined: Tue Jul 28, 2009 9:48 pm

Thanks a lot for This !!!!

Post by Zealhybrid »

This article helped me a lot!!! :lol:
:idea:(BTW, can you please tell how to configure recorded motion detection, because, even with the "best, low sensitivity" preset, it records all the time, and stuff my disk up. :x (8 cameras @ 4fps.)

Cheers,
Mauricio.
MILxDOT
Posts: 64
Joined: Wed Mar 29, 2006 5:12 am

Post by MILxDOT »

When you are at your main zoneminder page where you can see your cameras, click in the number 1 under the Zones column. From there click on All then adjust your Min/Max Pixel Threshold setting.
MILxDOT
Posts: 64
Joined: Wed Mar 29, 2006 5:12 am

Post by MILxDOT »

If you use the above installation guide you may see some issues with timestamps with a date of 12/31/1969. I had to install mysqltuner and tweak my my.cnf file and haven't seen the issue happen since.

I had asked for help and cordel responded that it is probably an issue with mysql and he recommended that I tune mysql:
http://www.zoneminder.com/forums/viewtopic.php?t=14410

TO DO THIS FIRST INSTALL mysqltuner:
sudo -i
apt-get install mysqltuner

STOP ZONEMINDER
/etc/init.d/zm stop

STOP MYSQL
/etc/init.d/mysql stop

EDIT YOUR my.cnf FILE
vi /etc/mysql/my.cnf

UNCOMMENT skip-innodb OR ADD IT IF IT IS NOT IN THERE

MAKE SURE THE THE FOLLOWING PARAMETERS ARE SET:
key_buffer = 16M
max_allowed_packet = 32M
thread_stack = 128K
thread_cache_size = 8
query_cache_limit = 1M
query_cache_size = 24M

ADD THESE PARAMETERS:
tmp_table_size = 32M
max_heap_table_size = 16M

SAVE AND EXIT

START MYSQL
/etc/init.d/mysql start

START ZONEMINDER
/etc/init.d/zm start

IF YOU WANT TO TUNE YOUR OWN SYSTEM, LET YOUR SYSTEM RUN NORMALLY FOR ABOUT 15 MINUTES AND THEN RUN:
mysqltuner

IT WILL ASK YOU FOR YOUR MYSQL ROOT USERNAME AND PASSWORD SO ENTER IT

ONCE YOU ENTER YOUR USERNAME AND PASSWORD IT WILL GIVE YOU SOME RECOMMENDATIONS. I WOULD GUESS THAT IF YOU APPLY THE ABOVE SETTINGS IT WILL NOT RECOMMEND ANY CHANGES.

You can disregard this:
General recommendations:
Enable the slow query log to troubleshoot bad queries

You will probably find that your system will run with greater efficiency
User avatar
kingofkya
Posts: 1110
Joined: Mon Mar 26, 2007 6:07 am
Location: Las Vegas, Nevada

Post by kingofkya »

Thanks for this

i have never seen my filters load so quick (I am using the ZMarch cd) the same still applies
erikp
Posts: 2
Joined: Mon Mar 09, 2009 12:51 pm
Location: Tartu

Post by erikp »

Thanks for the write up, made life much easier.

One item that is missing is setting the shared memory options.

> either add --enable-mmap=yes to the zm ./configure command to use /dev/shm (I like this method, as it auto sizes, and is easy)

or

> Configure shared memory... (Possibly lower system load, but harder to configure. See the numorus posts on what the appropriate values should be.)

erik
kerlo
Posts: 10
Joined: Fri Apr 10, 2009 11:13 am

Post by kerlo »

After install (i follow instruction of this post )
with --enable-mmap=yes to the configure of zoneminder
on Ubuntu 9.04

i've this problem
zmc -m 1' exited abnormally, exit status 255
when i tried to start zoneminder in the web interface

( /etc/init.d/zm start is success )

Do you have an idea
Many thanks for any help
namwons
Posts: 7
Joined: Thu Aug 27, 2009 6:28 pm

Post by namwons »

Did you install Sys::Mmap? Zoneminder won't build without it if you enable shared memory. I have used this successfully doing so.



perl -MCPAN -e shell
install Sys::Mmap
radix
Posts: 8
Joined: Thu Oct 09, 2008 8:11 pm

Post by radix »

I have probably stupid question, how to run ZM console? :D
I did everything written in here ( I am new in linux ) and can't find how to run ZM :(
quietas
Posts: 102
Joined: Wed May 23, 2007 5:30 pm

Post by quietas »

Open up a web browser and go to the IP, defualt username is admin, password is admin to start.

BTW, thanks for the writeup Miket. This would be a great addition to the Wiki. This is everything needed from start to finish for installing Zoneminder.
radix
Posts: 8
Joined: Thu Oct 09, 2008 8:11 pm

Post by radix »

What do you mean "...go to the IP..." ?
http://localhost/zm/ doesn't work :(
quietas
Posts: 102
Joined: Wed May 23, 2007 5:30 pm

Post by quietas »

You need the IP address of the computer you have Zoneminder installed on. When you installed Ubuntu you will have either used DHCP with is dynamic and will change or you assigned a static IP. Either way, you can issue the command "ifconfig". It will show something like this:

Code: Select all

eth0      Link encap:Ethernet  HWaddr 00:21:70:5c:ee:2b
          inet addr:192.168.13.8  Bcast:192.168.13.255  Mask:255.255.0.0
          inet6 addr: fe80::221:70ff:fe5c:ee2b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:495623241 errors:0 dropped:0 overruns:0 frame:0
          TX packets:701059180 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:36073187962 (36.0 GB)  TX bytes:715054922378 (715.0 GB)
          Interrupt:252 Base address:0xe000
The section with inet addr: xxx.xxx.xxx.xxx is your IP address.

Open a web browser and put that IP address into the address section where you would normally type something like http://www.google.com.
Last edited by quietas on Tue Oct 06, 2009 5:48 pm, edited 2 times in total.
quietas
Posts: 102
Joined: Wed May 23, 2007 5:30 pm

Post by quietas »

localhost addresses the computer you are currently working on.

In my previous comment I would put in http://192.168.13.8
radix
Posts: 8
Joined: Thu Oct 09, 2008 8:11 pm

Post by radix »

Thanks for explaining, one problem solved, here is another: "Could not select database: Unknown database 'zm'"
quietas
Posts: 102
Joined: Wed May 23, 2007 5:30 pm

Post by quietas »

You might have missed a few steps.

Code: Select all

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';
flush privileges;
quit
That bit in his instructions is the part which creates the database based on db/zm_create.sql.
Locked