Ubuntu Server 10.10 64-bit, an updated guide
From ZoneMinder
This guide is an updated version of "Ubuntu Server 10.10 64-bit with ZoneMinder 1.24.2 from source, FFmpeg, libjpeg-turbo, Webmin, Cambozola" so many thanks for putting it up.
Initial Steps
Install Ubuntu Server Edition 10.10 64-bit. (http://www.ubuntu.com/business/get-ubuntu/download)
Note: The system will run much better if a separate hard drive is used for /var which is where the Zoneminder captured images are stored.
At software selection, select LAMP and OpenSSH server. After install completes, login and become root (this applies to every command referred to in here).
sudo su
Discover what IP address been assigned to the Zoneminder system.
ifconfig
From the output, look at the primary network interface (usually eth0) and take note of the "inet addr" (or IP) address listed (it will be needed for SSH access).
Also learn what your network settings are:
Take note of the "Bcast" (or Broadcast) and "Mask" (or Netmask) addresses.
Then:
netstat -r
Take note of the "Destination" (or Network) and "Gateway" addresses (only numbers).
Next, access the Zoneminder system through SSH, from a Terminal window on another Linux (or Mac) computer on your LAN.
Get to this guide from the desired computer, open Terminal and type:
ssh ubuntuserver_username_here@IP_address_of_ubuntu_server
Press Enter, and type 'yes' and enter your password when prompted.
Once logged in through SSH, set a static IP address so that DHCP never changes it.
nano /etc/network/interfaces
Copy and paste the text bellow and edit the addresses according to your network settings notated earlier.
Note: The settings here apply to the primary network interface, other than the addresses (and "eth0" if it is not different from yours) everything should follow the format bellow.
auto eth0 iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
Use Ctrl-o to save and Ctrl-x to exit nano.
Restart the interface.
ifdown eth0
ifup eth0
Update system software.
apt-get update
apt-get dist-upgrade
reboot
Note: Multiple commands without an empty line in between can be copied and pasted together.
Install prerequisites from repositories (you can copy and paste all the text within the dashed area).
aptitude install build-essential linux-headers-`uname -r` automake perl libauthen-pam-perl \ libpam-runtime libio-pty-perl libmysqlclient-dev \ libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libjpeg62 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 yasm libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions git-core \ mysql-server mysql-client ant
Optimize GCC compiler.
export CFLAGS="-march=native -O2 -pipe" && \
export CXXFLAGS="${CFLAGS}" && \
export CPPFLAGS="${CFLAGS}"
Install Webmin
wget http://downloads.sourceforge.net/project/webadmin/webmin/1.550/webmin_1.550_all.deb?use_mirror=voxel
mv webmin_1.550_all.deb\?use_mirror\=voxel webmin_1.550_all.deb && \ dpkg -i webmin_1.550_all.deb
Install libjpeg-turbo (AMD64)
wget http://downloads.sourceforge.net/project/libjpeg-turbo/1.1.0/libjpeg-turbo_1.1.0_amd64.deb?use_mirror=voxel
mv libjpeg-turbo_1.1.0_amd64.deb?use_mirror=voxel libjpeg-turbo_1.1.0_amd64.deb && \ dpkg -i libjpeg-turbo_1.1.0_amd64.deb
ln -s /opt/libjpeg-turbo/lib/libjpeg.a /usr/lib/libjpeg.a && \ ln -s /opt/libjpeg-turbo/include/jconfig.h /usr/include/jconfig.h && \ ln -s /opt/libjpeg-turbo/include/jerror.h /usr/include/jerror.h && \ ln -s /opt/libjpeg-turbo/include/jmorecfg.h /usr/include/jmorecfg.h && \ ln -s /opt/libjpeg-turbo/include/jpeglib.h /usr/include/jpeglib.h
Configure Lib Paths
echo "/opt/libjpeg-turbo/lib" > /etc/ld.so.conf.d/libjpeg-turbo.conf && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/ffmpeg.conf && \ echo "LD_LIBRARY_PATH=/usr/local/lib:/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH" >> /etc/bash.bashrc && \ echo "export LD_LIBRARY_PATH" >> /etc/bash.bashrc
ldconfig
Install Perl Modules
perl -MCPAN -e shell
install CPAN
exit
perl -MCPAN -e shell
install YAML PHP::Serialization Module::Load X10::ActiveHome
install Sys::Mmap
install DBI
install DBD::mysql
exit
Install FFmpeg
cd /usr/src && git clone git://git.videolan.org/ffmpeg.git
cd /usr/src/ffmpeg/ && ./configure --enable-gpl --enable-shared --enable-pthreads
make
make install
make install-libs
cd /lib && ln -s /usr/local/lib/libswscale.so.0 && \ ln -s /usr/local/lib/libavformat.so.52 && \ ln -s /usr/local/lib/libavcodec.so.52 && \ ln -s /usr/local/lib/libavutil.so.50 && \ ln -s /usr/local/lib/libavdevice.so.52
ldconfig
Install Zoneminder
apt-get install zoneminder
Link Zoneminder to the apache configuration
sudo ln -s /etc/zm/apache.conf /etc/apache2/conf.d/zoneminder.conf
Configure Zoneminder mysql database access
mysql -u root -p < /usr/share/zoneminder/db/zm_create.sql
Note: The password that is requested here is the Mysql root password that was entered during install, not your ubuntu password.
mysql -u root -p
grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
quit
mysqladmin -p reload
Install Cambozola
cd /usr/src && wget http://www.charliemouse.com:8080/code/cambozola/cambozola-latest.tar.gz
tar -xzvf cambozola-latest.tar.gz
replace xx with cambozola version downloaded
cp cambozola-*/dist/cambozola.jar /usr/share/zoneminder
Add the video group to the www-data user (under which apache runs), so it can access the video devices
adduser www-data video
Configure capture card(s)
NOTE: As of the time of the writing, if your are using the bttv 878 card, it will only work with kernel 2.6.35-28-server, (the newer kernel 2.6.38-8-server did not load it) this may affect other cards as well. This applies to the 8 channel card that have the bttv 878 chipset (which is very popular) sold by Camsecure, et al.
(This is what I had to do get my cards working, it took me many hours of googling; this is beyond my level of expertise.)
Create /etc/modprobe.d/bttv-card.conf.
(Note: The "bttv-card" name is arbritrary but it does need to end in the .conf extention).
nano /etc/modprobe.d/bttv-card.conf
Copy and paste the following text:
options i2c-algo-bit bit_test=1 options bttv gbuffers=16 card=102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102 radio=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 tuner=4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 chroma_agc=1 combfilter=2 full_luma_range=1 coring=1 autoload=0
Use Ctrl-o to save and Ctrl-x to exit nano
Reboot the computer to apply changes.
reboot
Check that the cards are successfully loaded.
ls /dev
If you see video0, video1, video2, video3, etc, your cards are ready for use. (The numbers depend on the number of channels on the card(s)).
Final setps:
Check that the zoneminder service automatically starts (this assumes you didn’t manually started it via command line).
1. In firefox, go to https://YOUR_ZoneMinder.IP.ADDRESS.HERE:1000 to reach the Webmin interface.(Login with Ubuntu username and password).
2. In left menu, select System>Bootup and Shutdown. Look for a ‘yes’ next to the zoneminder service.
Note: The purpose of showing this is that you can control and see the services on the ubuntu server from a handy Web interface. For Zoneminder to work properly, apache and msql need to be running as well.
Getting started with Zoneminder
Go to http://YOUR_ZoneMinder.IP.ADDRESS.HERE/zm to reach the Zoneminder interface.
If everything went well, the Zoneminder console will load where you can configure your cameras.
To do:
- setup a script that will automatically delete old files in the zoneminder event folder (if this wasn't fixed in a later version, that folder will just get bigger and bigger until there is no more space in the hard drive and the system will become unresponsive until some space is freed up).
- create and configure cameras from the Zoneminder console
- setup user authentication to access the Zoneminder console
- Optimize Zoneminder (JPEG streaming, video generation, etc)
- get Zoneminder working with HTTPS
- make the Zoneminder machine accessible from the Internet
- use free service offered by DynDNS.org
- use ddclient from repository
- setup firewall (ufw)
Last edited May 5 2011