Ubuntu Server 11.10 64-bit with ZoneMinder 1.25.0 from source
From ZoneMinder
I just tested it in a freshly installed server, so I am pretty sure it works 100%.
This configuration installs ZoneMinder on /opt, and the web files are installed to /var/www, this way ZoneMinder is at the root of the Web server.
The ffmpeg package and libraries comes from the Ubuntu repositories.
Contents |
Ubuntu initial setup
1. Install Ubuntu Server 11.10 x86_64
When installing do not configure the network, this will make the installation process a lot faster. Once the machine boots with the new operating system you'll configure the network as the first step.
2. Configure network interface
sudo vi /etc/network/interfaces
And make changes similar to this
auto eth0 iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1
3. Configure the DNS client:
sudo vi /etc/resolv.conf
Adjust the domain name and DNS server
domain local nameserver 192.168.1.1
4. Update the system:
sudo apt-get update sudo apt-get upgrade
Prerequisites for running ZoneMinder
5. This is required for running ZoneMinder:
sudo apt-get install apache2 sudo apt-get install mysql-server sudo apt-get install php5 php5-mysql sudo apt-get install perl sudo apt-get install ffmpeg
Prerequisites for building ZoneMinder
This is required only for building (in case you are using a different machine for this purpose):
sudo apt-get install build-essential sudo apt-get install libmysqlclient-dev sudo apt-get install libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev \ libavutil-dev libpostproc-dev libswscale-dev libjpeg-dev sudo apt-get install libssl-dev libbz2-dev libpcre3-dev
6. Configure Perl (Method 1: using APT): (somebody please check if this is complete)
apt-get install libdbi-perl libarchive-tar-perl libarchive-zip-perl libdate-manip-perl \ libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl \ libsys-mmap-perl
Configure Perl (Method 2: manually with CPAN):
sudo su - root perl -MCPAN -e shell install CPAN install Date::Manip install LWP::UserAgent install Sys::Mmap install Device::SerialPort install Net::FTP install Net::SFTP::Foreign install Archive::Tar install Archive::Zip install Net::SMTP install MIME::Lite install MIME::Entity install X10::ActiveHome exit exit
Building ZoneMinder from source
7. Set GCC environment variables:
export CFLAGS="-march=native -O2 -pipe" && \
export CXXFLAGS="${CFLAGS}" && \
export CPPFLAGS="${CFLAGS} -D__STDC_CONSTANT_MACROS"
8. Get ZoneMinder source code and install it
wget http://www2.zoneminder.com/downloads/ZoneMinder-1.25.0.tar.gz tar -zxvf ZoneMinder-1.25.0.tar.gz
9. Compile ZoneMinder
cd ZoneMinder-1.25.0 ./configure --prefix=/opt/zm --with-libarch=lib64 --with-mysql=/usr --with-ffmpeg=/usr \ --with-webuser=www-data --with-webgroup=www-data --disable-debug --disable-crashtrace \ --enable-mmap=yes --with-webdir=/var/www --with-cgidir=/usr/lib/cgi-bin \ ZM_SSL_LIB=openssl make
10. Install ZoneMinder binaries and configure MySQL database
sudo make install 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
11. Install Cambazola
cd wget http://www.charliemouse.com:8080/code/cambozola/cambozola-latest.tar.gz tar -zxvf cambozola-latest.tar.gz sudo mkdir /var/www/zm sudo cp cambozola-0.xx/dist/cambozola.jar /var/www/zm sudo chown www-data:www-data /var/www/zm/cambozola.jar
12. Create the init file for ZoneMinder (/etc/init.d/zm):
sudo vi /etc/init.d/zm
And copy 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="/opt/zm/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
13. Set permissions to it:
sudo chown root:root /etc/init.d/zm sudo chmod 755 /etc/init.d/zm
14. Create links for rc2.d and rc3.d
cd /etc/rc2.d sudo ln -s ../init.d/zm S92zm cd /etc/rc1.d sudo ln -s ../init.d/zm K10zm
15. Start ZoneMinder:
sudo /etc/init.d/zm start
16. Open your browser and point it to http://hostname/
NOTE: For me, installing on a freshly installed copy of Ubuntu Desktop 11.10 64-bit, following all of the instructions above worked EXCEPT I needed to edit /etc/apache2/httpd.conf to add the following lines:
DirectoryIndex index.html index.php
AddType text/html php
then do:
apachectl -k graceful
Otherwise, Apache kept trying to force the browser to download index.php as a file and not service it as a webpage.
Default install of ubuntu server and apache, had to remove /var/www/index.html for http://hostname/ to work. Otherwise had to access http://hostname/index.php