Ubuntu 7.10 server/ZM 1.23.2 from src, how to (31/03/2008)

Support and queries relating to all previous versions of ZoneMinder
User avatar
caladeira
Posts: 64
Joined: Wed Dec 05, 2007 10:57 am
Location: Lisbon

Ubuntu 7.10 server/ZM 1.23.2 from src, how to (31/03/2008)

Post by caladeira »

UPDATE: 05/02/2008
Solved autostart and add apache2 configuration

UPDATE: 07/02/2008
Solved NTP/Timezone issues

UPDATE: 10/03/2008
SOLVED FFMPEG issue (step 17)

UPDATE: 12/03/2008
Change from ZM 1.23.1 to 1.23.2

UPDATE: 31/03/2008
Update FFMPEG compile instructions to fix changes in most recent versions from SVN


Hello!
I've been experiencing with ZoneMinder for some time now.
My first install was with zoneminder_1.22.3-10_i386.deb and it worked better than I was expecting.

Now, I want to try 1.23.2 and since no package available, I decided to reinstall everything from source.
I'm not an expert in linux and my setup still has some problems as I'll describe in the end.

So let's start:

1.Install Ubutu 7.10 Server 32bits without no extra options
2. Install ssh to allow remote access and set network card static IP.

Code: Select all

sudo apt-get install ssh
sudo nano /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.2.90
netmask 255.255.255.0
gateway 192.168.2.1

3. edit the hosts file

Code: Select all

sudo nano /etc/hosts

192.168.2.90    computer.domain.pt dvr
4. Add additional repositories, update and reboot

Code: Select all

sudo nano /etc/apt/sources.list
sudo apt-get update
sudo apt-get  upgrade
sudo reboot


5. Install several packages needed

Code: Select all

sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server libmysqlclient15-dev
sudo apt-get install libarchive-tar-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl
sudo apt-get install libjpeg62 libjpeg62-dev libmime-perl libstdc++6 libwww-perl zlib1g
sudo apt-get install zip unzip patch ntp openssl libpcre3-dev libssl-dev libjpeg-progs
sudo apt-get install build-essential subversion libcurl4-gnutls-dev
6. Configure my PICO2000 4 inputs video card

Code: Select all

modprobe bttv
lsmod
dmesg | grep bttv
sudo nano /etc/modprobe.d/devfsd

alias char-major-81 videodev
alias char-major-81-0 bttv
options bttv card=77 tuner=-1 radio=0 triton1=0 vsfx=0 autoload=0

sudo reboot
lsmod
dmesg | grep bttv

7. Install Munim for remote server stats

Code: Select all

sudo apt-get install munin munin-node 
8. We have to set the PHP timezone to our current timezone and provide a more suitable server for NTP service

Code: Select all

sudo nano /etc/php5 /apache2/php.ini

date.timezone = Europe/Lisbon

sudo nano /etc/ntp.conf

server europe.pool.ntp.org
9. Install FFMPEG from SVN

Code: Select all

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg
. ./configure --enable-shared --enable-postproc --enable-swscale --enable-gpl --prefix=/opt/ 
make
sudo make install
10. Add PHP Serialization

Code: Select all

sudo perl -MCPAN -e shell

install PHP::Serialization
exit
11. Download ZM and build it

Code: Select all

wget http://www.zoneminder.com/downloads/ZoneMinder-1.23.2.tar.gz
tar zxvf ZoneMinder-1.23.2.tar.gz
cd ZoneMinder-1.23.2
./configure --with-webdir=/var/www/html/zm --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data --with-ffmpeg=/opt
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';
quit
mysqladmin -u root -p reload
sudo make install
cd ..
sudo nano /etc/init.d/zm

#!/bin/sh
# description: Control ZoneMinder as a Service
# chkconfig: 2345 35 15
# 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: "
        $ZM_PATH_BIN/zmfix –a
        $command start
        RETVAL=$?
        [ $RETVAL = 0 ] && echo success
        [ $RETVAL != 0 ] && echo failure
        echo
        [ $RETVAL = 0 ] && touch /var/lock/zm
        return $RETVAL
}
stop() {
        echo -n $"Stopping $prog: "
        #
        # Why is this status check being done?
        # as $command stop returns 1 if zoneminder
        # is stopped, which will result in
        # this returning 1, which will stuff
        # dpkg when it tries to stop zoneminder before
        # uninstalling . . .
        #
        result=`$command status`
        if [ ! "$result" = "running" ]; then
                echo "Zoneminder already stopped"
                echo
                RETVAL=0
        else
                $command stop
                RETVAL=$?
                [ $RETVAL = 0 ] && echo success
                [ $RETVAL != 0 ] && echo failure
                echo
                [ $RETVAL = 0 ] && rm -f /var/lock/zm
        fi
}
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' | 'force-reload')
        stop
        start
        ;;
'status')
        status
        ;;
*)
        echo "Usage: $0 { start | stop | restart | status }"
        RETVAL=1
        ;;
esac
exit $RETVAL
# end of file


sudo chmod 755 /etc/init.d/zm
sudo chmod +x /etc/init.d/zm
sudo update-rc.d zm defaults
sudo /etc/init.d/zm restart
sudo touch /var/www/index.html
sudo nano /etc/apache2/conf.d/zoneminder.conf

Alias /zm /var/www/html/zm
<Directory>
  php_flag register_globals off
  Options Indexes FollowSymLinks
  <IfModule>
    DirectoryIndex index.php
  </IfModule>
</Directory>

sudo /etc/init.d/apache2 force-reload

12. Some additional settings

Code: Select all

sudo adduser www-data video
sudo chmod 666 /dev/video0
sudo chmod 4755 /usr/local/bin/zmfix
zmfix -a
sudo chown www-data.www-data /var/www/html/zm/temp
13. Shared memory settings

Code: Select all

sudo nano /etc/sysctl.conf

kernel.shmall = 134217728
kernel.shmmax = 134217728
14. Install Cabonzola and Mootools (from my local machine)

Code: Select all

wget http://www.charliemouse.com/code/cambozola/cambozola-latest.zip
unzip cambozola-latest.zip
sudo cp cambozola-0.68/dist/* /var/www/html/zm/
wget http://192.168.2.101/mootools-release-1.11.js
sudo cp mootools-release-1.11.js /var/www/html/zm/mootools.js
15. Start ZoneMinder

Code: Select all

sudo zmpkg.pl start
16. Configure mysql to allow other machines on my network to access using ZM4MS

Code: Select all

sudo vi /etc/mysql/my.cnf

# bind-address 127.0.0.1

mysql -u root -p

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.2.%' IDENTIFIED BY '*****' WITH GRANT OPTION;
quit

sudo /etc/init.d/mysql restart

17. Edit zmvideo.pl to solve ffmpeg error: "Video generation failed!"

Code: Select all

sudo nano /usr/bin/zmvideo.pl
(remove the ‘&’ at line 323 to fix zmvideo.pl problem near the end)
After this, the system is running very well except:

- With the DVR style streaming enabled I can't edit Zones (BUG)

I hope this post help Ubuntu crew. :twisted:

Best regards.
Last edited by caladeira on Mon Mar 31, 2008 4:22 pm, edited 9 times in total.
PeterHoward
Posts: 319
Joined: Thu Jul 20, 2006 1:07 am
Location: Australia

Here's as good a location as any . . .

Post by PeterHoward »

There still isn't a debian/ubuntu package. The problem relates to step 10 in the above instructions. I'm still trying to get PHP::Serialization installed from package (as opposed to CPAN). I expected libdata-serializer-perl would do it, but it doesn't have everything set up as I would expect. :cry:

Still investigating . . .

Worth also noting. The above package (libdata-serializer-perl) does not exist in Dapper or Edgy. Which means that, even when I resolve the problem, there probably won't be a package for Ubuntu versions lower than Gutsy. Maybe Feisty (don't know right now if the package exists there).

PJH
mcouture
Posts: 32
Joined: Sun Jan 20, 2008 2:15 pm
Location: US/Maine

Post by mcouture »

ZoneMinder newbie! Ubuntu amature.

I too am having issues install ZoneMinder on Ubuntu Gutsy 7.10.

I have been able to get everything installed, but I can't get any of my monitors to view. I get a broken link when I click on the camera. If I set it up to record, then I go to the events directory and there are thousands of JPG files...and they are good snapshots. But if I'm recording, why is ZM generating JPGs rather than one MPEG file....?

I'm trying to evaluate ZM to see if this works for my needs. However, I've spent many hours trying to install ZM and have not been able to see any output yet....

HELP!
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Re: Here's as good a location as any . . .

Post by zoneminder »

PeterHoward wrote:There still isn't a debian/ubuntu package. The problem relates to step 10 in the above instructions. I'm still trying to get PHP::Serialization installed from package (as opposed to CPAN). I expected libdata-serializer-perl would do it, but it doesn't have everything set up as I would expect. :cry:

Still investigating . . .

Worth also noting. The above package (libdata-serializer-perl) does not exist in Dapper or Edgy. Which means that, even when I resolve the problem, there probably won't be a package for Ubuntu versions lower than Gutsy. Maybe Feisty (don't know right now if the package exists there).

PJH
This module could possible be changed for the next release. It just needs to be something that php and perl both understand. Perhaps json would work, though the existing filters would have to be migrated.
Phil
User avatar
caladeira
Posts: 64
Joined: Wed Dec 05, 2007 10:57 am
Location: Lisbon

Post by caladeira »

mcouture wrote:ZoneMinder newbie! Ubuntu amature.

I too am having issues install ZoneMinder on Ubuntu Gutsy 7.10.

I have been able to get everything installed, but I can't get any of my monitors to view. I get a broken link when I click on the camera. If I set it up to record, then I go to the events directory and there are thousands of JPG files...and they are good snapshots. But if I'm recording, why is ZM generating JPGs rather than one MPEG file....?

I'm trying to evaluate ZM to see if this works for my needs. However, I've spent many hours trying to install ZM and have not been able to see any output yet....

HELP!
Hi there!

ZM actually records only jpegs. Then if you want, you can generate videos for the events you chose.

The broken links, I had that problem in the past with authentication.
It could also be related with the step 12 of my how to.

Don't quit, ZM is very powerful and flexible, you just have to be patient and dig in the foruns.

If you are a windows user, give a look at the user contribution: search for ZM4MS.

About my how to, let me remind you that I still have some problem with video generation.

Best regards.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

The problem is that in order for ZM to be packaged and supplied in a distributions Repo, all required elements must be able to be acquired through the package management system (rpm, rpmi, dpki, apt-get, yum, etc) I can already see issues with 1.23.x since it needs mootools which is not really a packagable tool. same is true for some of the perl modules if they are not available via yum, or apt, then there is no way to supply the dependency.

With my private repo this is not so much a problem, if I have to do some thing unethical, there is no one that cares so I can just throw mootools into the zm package and there is no one to say that it's not how we do things if you know what I mean.

before, most I had to worry about was just perl modules, and I learned how to package them.
I'll have to see what I can do about mootools and is various options, but then again thats fine for me, but does no good for other Repos.
PeterHoward
Posts: 319
Joined: Thu Jul 20, 2006 1:07 am
Location: Australia

The continuing saga. . .

Post by PeterHoward »

zoneminder wrote:
PeterHoward wrote:There still isn't a debian/ubuntu package. The problem relates to step 10 in the above instructions. I'm still trying to get PHP::Serialization installed from package (as opposed to CPAN). I expected libdata-serializer-perl would do it, but it doesn't have everything set up as I would expect. :cry:

Still investigating . . .

Worth also noting. The above package (libdata-serializer-perl) does not exist in Dapper or Edgy. Which means that, even when I resolve the problem, there probably won't be a package for Ubuntu versions lower than Gutsy. Maybe Feisty (don't know right now if the package exists there).

PJH
This module could possible be changed for the next release. It just needs to be something that php and perl both understand. Perhaps json would work, though the existing filters would have to be migrated.
I'd rather not impose on you like that if I can avoid it. Especially as we might just hit the same problem again :-(

However, there doesn't seem to be an easy answer to the problem in terms of pre-packaged stuff. Both Debian and Ubuntu use the same libdata-serializer-perl package, and neither seems to set up PHP::Serialization for direct use, and there doesn't seem to be another package which does.

If I actually knew perl in detail I could possibly redo the usage in terms of the perl Data::Serializer setup (which would indirectly use PHP::Serialization), though I'm not 100% sure that that will really work either.

I need to hassle some other forums/IRC rooms a bit more before I concede defeat on this one. I'll keep you informed. Meanwhile, for those wanting 1.23 on Debian/Ubuntu, all I can do is recommend the process at the top of this thread.

PJH
User avatar
rdmelin
Posts: 863
Joined: Wed Oct 29, 2003 2:23 pm
Location: Ellensburg, WA USA

Post by rdmelin »

However, there doesn't seem to be an easy answer to the problem in terms of pre-packaged stuff.
Peter, I use cpan2rpm to build the few modules not provided in the Mandriva distro. Google shows there is also a cpan2deb utility that may be of help to you.

Just thought I'd mention it :)
User avatar
caladeira
Posts: 64
Joined: Wed Dec 05, 2007 10:57 am
Location: Lisbon

Post by caladeira »

Hi everyone!

What about the fact that I can't generate videos using the setup described above.

Does anyone have any clue?

Appreciate any help.
ziopippo
Posts: 18
Joined: Tue Sep 05, 2006 10:43 am
Location: Italy

Post by ziopippo »

same problems for me! :evil: :(


caladeira wrote:Hi everyone!

What about the fact that I can't generate videos using the setup described above.

Does anyone have any clue?

Appreciate any help.
Sorry for my BAD english! :oops:
User avatar
Lee Sharp
Posts: 1069
Joined: Sat Mar 31, 2007 9:18 pm
Location: Houston, TX

Post by Lee Sharp »

There have been many posts on ffmpeg problems, and generating videos. In other words, your problem is no surprise. A few seconds of search will confirm this and show you the known fixes or workarounds.
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

caladeira,

I notice in your Zoneminder build steps you have "--with-ffmpeg" when you call configure. I think the correct syntax is "--with-ffmpeg=<path>" where the path to ffmpeg is usually /usr/local/bin/ffmpeg (you can confirm the path by typing "whereis ffmpeg" at the command line).

Other than that, I would say make sure that you make sure ZM_PATH_FFMPEG (in options under the "image" tab) is set to the correct path to ffmpeg.

I'm able to generate videos on my ubuntu 7.10 server system with ZM 1.23.1 and ffmpeg version SVN-r11637.
barkeep8
Posts: 15
Joined: Fri Mar 31, 2006 2:55 am

How about Dapper support?

Post by barkeep8 »

Hello,

This tutorial is great. I thought I would try it on a Dapper system as I have several ZM machines, all ZM 1.22.3 and Ubuntu 6.06 LTS. I prefer LTS because of it's long term support to 2011.

I noticed right away that there was no libcurl4-openssl-dev package for dapper. I also noticed alot of people having trouble with FFMPEG.

I'm going to set up a 7.10 box to see how that works, but I've got nearly ALL of my linux boxes (35 or so) running dapper. This works best for me since I'm not stuck in a constant stream of upgrading, tweaking and fixing, and I support 5 times as many windows boxes at linux. I like the LTS option so that when I get one up and going the way I like it, I don't have to redo it in six months cause the newest latest stuff is taking over.

Does anyone have a tutorial for upgrading ZM 1.22.3 on Ubuntu 6.06 server to 1.23.1? Would it be better to wait for the next version?

Thanks!
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Re: How about Dapper support?

Post by timcraig »

barkeep8 wrote: Does anyone have a tutorial for upgrading ZM 1.22.3 on Ubuntu 6.06 server to 1.23.1?
The wiki has documentation on upgrading: http://www.zoneminder.com/wiki/index.ph ... #Upgrading

I followed it for upgrading my ZM 1.22.3 install to 1.23.1 and it worked fine for me. Don't use the new deep storage feature if you have events in ZM you want to keep.
barkeep8
Posts: 15
Joined: Fri Mar 31, 2006 2:55 am

Re: How about Dapper support?

Post by barkeep8 »

timcraig wrote:
barkeep8 wrote: Does anyone have a tutorial for upgrading ZM 1.22.3 on Ubuntu 6.06 server to 1.23.1?
The wiki has documentation on upgrading: http://www.zoneminder.com/wiki/index.ph ... #Upgrading

I followed it for upgrading my ZM 1.22.3 install to 1.23.1 and it worked fine for me. Don't use the new deep storage feature if you have events in ZM you want to keep.
THANKS!!!
Locked