Here are my build notes. I ultimately needed more than 8 cameras, so I went with the Mandriva live cd solution. However it was pretty fun getting this working in FreeBSD.
-------------
Updating with Csup
csup -L 2 /usr/share/examples/cvsup/stable-supfile
csup -L 2 /usr/share/examples/cvsup/ports-supfile
Net-snmp
cd /usr/ports/net-mgmt/net-snmp
make install clean
/usr/local/bin/snmpconf -i
(This procedure is documented in net-snmp.doc)
echo 'snmpd_enable="YES"' >> /etc/rc.conf
echo 'snmpd_conffile="/usr/local/share/snmp/snmpd.conf"' >> /etc/rc.conf
Recompiling the Kernel
We need to make a copy of the base configuration, and then compile in camera support.
cd /usr/src/sys/i386/conf
cp GENERIC CUSTOM
echo 'device pf' >> CUSTOM
echo 'device pflog' >> CUSTOM
echo 'device pfsync' >> CUSTOM
echo 'options ALTQ' >> CUSTOM
echo 'options ALTQ_CBQ' >> CUSTOM
echo 'options ALTQ_RED' >> CUSTOM
echo 'options ALTQ_RIO' >> CUSTOM
echo 'options ALTQ_HFSC' >> CUSTOM
echo 'options ALTQ_PRIQ' >> CUSTOM
echo 'options ALTQ_NOPCC' >> CUSTOM
echo 'device smbus' >> CUSTOM
echo 'device iicbus' >> CUSTOM
echo 'device iicbb' >> CUSTOM
echo 'device bktr' >> CUSTOM
cd /usr/src
make buildkernel KERNCONF=CUSTOM
make installkernel KERNCONF=CUSTOM
PF
Since we compiled in ALTQ support in the previous step, we mind as well setup the PF firewall for this box.
echo 'pf_enable="YES"' >> /etc/rc.conf
echo 'pf_rules="/etc/firewall.conf"' >> /etc/rc.conf
echo 'pf_flags=""' >> /etc/rc.conf
echo 'pflog_enable="YES"' >> /etc/rc.conf
echo 'pflog_logfile="/var/log/pflog"' >> /etc/rc.conf
echo 'pflog_flags=""' >> /etc/rc.conf
reboot
Apache22
cd /usr/ports/www/apache22
make install clean
echo 'apache22_enable="YES"' >> /etc/rc.conf
touch /usr/local/www/apache22/data/favicon.ico
Setup the http.conf file, which is located at /usr/local/etc/apache22/http.conf. The following lines should be added to the AddType section:
AddType application/x-httpd-php .php .php3 .php4 .phtml
AddType application/x-httpd-php-source .phps
We also need to add the .php extension to the default startup pages:
DirectoryIndex index.html index.php
PHP5
We are going to let the Zoneminder port invoke the PHP5 installation but we want to make sure that when it does, it also builds the Apache module.
cd /usr/ports/lang/php5
make config
Select "Build Apache Module"
cd /usr/ports/lang/php5-extensions
make config
Select "Mysql support"
Select "PCRE support"
Select "Session support"
Zoneminder
If you haven't already, you need to download the latest FreeBSD port of Zoneminder from:
http://catsspat.dyndns.org:2080/zoneminder/ . Upload it to your home folder via scp and then continue.
cd /home/admin
tar xvfz zoneminder.tar.gz
mv zoneminder /usr/ports/multimedia
cd /usr/ports/multimedia/zoneminder
You will need to open up the Makefile in the vi editor and verify the proper dependencies and paths. At the time of this document, version 5.1 is the latest mysql version. You will need to edit the line that reads:
BUILD_DEPENDS= ${LOCALBASE}/bin/mysqld_safe:${PORTSDIR}/databases/mysql51-server:install
Also the web base is different for Apache 2.2.
WEBBASE= ${LOCALBASE}/www/apache22
Once you are happy with the Makefile, time to run make.
make
make install
echo 'zm_enable="YES"' >> /etc/rc.conf
Double-check the configuration settings in /usr/local/etc/zm.conf, however they are probably already correct or the installation would have failed.
Mysql5.1
The Zoneminder port above already installed mysql5, but we still need to setup the databases for Zoneminder.
echo 'mysql_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/mysql-server start
/usr/local/bin/mysql -u root -p
<enter>
SET PASSWORD FOR
root@your.hostname.com = PASSWORD('password');
SET PASSWORD FOR root@"localhost" = PASSWORD('password');
source work/ZoneMinder-1.22.3/db/zm_create.sql
grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
flush privileges;
quit;
Rsync (for backing up)
cd /usr/ports/net/rsync
make install clean
Php5
Now that PHP5 has been installed, we need to configure it.
cd /usr/local/etc
cp php.ini-recommended php.ini
Edit the php.ini to ensure short_open_tag = On
Configuring Zoneminder
Open a browser to
http://localhost/zm/index.php
If all has gone well, you will see the screen above. Click on the "Options" link in the top right corner to get started with configuration. Make sure that if you are running a pop-up blocker, to shut it off or the site will not work properly.
To add a camera and begin testing, click on the "Add New Monitor" button.
1) Give the new camera a name (ex. "Camera01")
2) Change the Function to "Monitor" for testing purposes.
3) Cap the Maximum FPS at 5, which is good enough for our purposes.
4) Click on the "Source" tab.
5) Enter "/dev/bktr" for your Device Path
6) Select NTSC for the Device Format
7) Set the Capture Width and Height to 320x240.
8) Click Save.
Now you can start up Zoneminder by clicking the link at the top of the main page. Watch your logs, specifically /var/log/messages for errors.
Mpeg Support
Compile in optional Mpeg support for display in Xorg.
cd /usr/ports/multimedia/mpeg_encode/
make install clean
Configuring Shared Memory Allocation
This is where it gets a little grey. We need to allocate enough shared memory for each camera without crashing the system at the same time. Add the followup to the /etc/sysctl.conf.
kern.ipc.shmmax=536870912
kern.ipc.shm_use_phys=1
kern.ipc.shmall=524288
Xorg
cd /usr/ports/x11/xorg/
make install clean
cd /usr/ports/x11-fonts/urwfonts
make install clean
Nvidia
cd /usr/ports/x11/nvidia-driver
make install clean
cd /usr/ports/x11/nvidia-settings
make install clean
cd /usr/ports/x11/nvidia-xconfig
make install clean
The rest was configuring the web interface to look how you want it. Hope this helps someone.