Page 1 of 1

Ubuntu 9.10 PPC-PS3 ZM 1.24.2 Source Installation - Sony PS3

Posted: Sun Nov 01, 2009 10:54 pm
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 a Sony Playstation 3.

Code: Select all

INSTALL SERVER OS
Install Ubuntu Server PPC-PS3. 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

GET RID OF NON-COMPATIBLE FFMPEG STUFF
apt-get autoremove ffmpeg
apt-get autoremove x264
apt-get autoremove libx264-dev

ADD THIS STUFF FOR DOING OTHER FFMPEG STUFF
apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libx11-dev libxvidcore4-dev zlib1g-dev

INSTALL x264
cd /usr/src
git clone git://git.videolan.org/x264.git
cd x264
./configure
make
sudo checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`-0.0ubuntu1" --default

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 ZONEMINDER 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 sysvinit-utils 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-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab

make

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

ldconfig

SETUP FFMPEG PATHS SO THAT OTHER UBUNTU APPS CAN FIND IT
cd /usr/bin/
ln -s /usr/local/bin/ffmpeg ./ffmpeg
ln -s /usr/local/bin/ffplay ./ffplay
ln -s /usr/local/bin/ffserver ./ffserver
ln -s /usr/local/bin/x264 ./x264

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=no --with-webgroup=www-data --with-webuser=www-data --disable-crashtrace

aclocal
autoconf
automake

If you are using Ubuntu 9.10 (karmic) or an OS that uses gcc 4.4.0 you will need to add this to your src/zm_utils.cpp:
#include <cstdio>

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/cambozola/cambozola-latest.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/jscalendar/jscalendar-1.0.zip?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

UPDATE /etc/rc.local TO START ZONEMINDER UPON REBOOT
vi /etc/rc.local

ADD THESE LINES:
#Start Zoneminder
/etc/init.d/zm start

REBOOT THE SERVER
/sbin/shutdown now -r
Do this to tune your MySQL database:

Code: Select all

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