Debian 6 Squeeze 64-bit with ZoneMinder 1.25.0 Preview, FFmpeg, libjpeg-turbo, Webmin, Cambozola(Spanish Diciembre 2011)
Basado en la guia para Ubuntu 11.04 con Zoneminder 1.25.0 ACTUALIZADO: 6 de Diciembre 2011
#Descargar e instalar Debian Squeeze (estable) NetInstall 64-bits (http://www.debian.org/CD/netinst/) No es necesario descargar la imagen de CD completa. Netinst pesa un poco mas de 100 MB
#En la seleccion de software, solo instalar OpenSSH, y el Servidor de Correo (Postfix).
#Para el servidor de correo, puedes usar "Internet Site".
#Luego de instalar, iniciar sesion y establecer una IP estatica en /etc/network/interfaces. Edita la IP de acuerdo a tu red:
###############
#Volverse root#
###############
su
Ingresar la contraseña ingresada en la instalación.
############################
#Establecer una IP estatica#
############################
nano /etc/network/interfaces
####################################
####################################
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
####################################
####################################
# Presionar Ctrl + O para guardar y Ctrl + X para salir de nano y reiniciamos la red
/etc/init.d/networking restart
#Con la IP estatica y conexion a Internet ya puedes usar SSH desde otra computadora con Linux de tu red y conectarte a tu nuevo sistema Debian.
#Puedes copiar/pegar los siguientes comandos en una consola o si lo prefieres escribelos. Los comandos multiples sin lineas vacias en medio se pueden #copiar y pegar juntas. No pegar lineas que inician con #
####################################
#Guardamos logs del arranque Debian#
####################################
#Es util si por alguna razon al reiniciar el sistema, Zoneminder no se inicia bien.
nano /etc/default/bootlogd
#Cambiamos el valor del archivo a Yes quedando asi:
BOOTLOGD_ENABLE=Yes
# Presionar Ctrl + O para guardar y Ctrl + X para salir de nano
# La proxima vez que se reinicie el sistema podemos buscar en /var/log/boot para conocer los detalles del arranque del sistema.
#########################
#Agregar un repositorio#
#########################
# Esto será util para no tener errores en las futuras compilaciones que realizaremos.
# El siguiente paquete sirve para el manejo de las llaves de los repositorios
apt-get install debian-multimedia-keyring
# Ahora editamos el archivo sources.list para agregar el repositorio
nano /etc/apt/sources.list
# Agregamos el repositorio en la ultima linea del archivo sources.list
deb http://www.debian-multimedia.org lenny main
# Presionar Ctrl + O para guardar y Ctrl + X para salir de nano
########################
#Actualizar el sistema#
########################
apt-get update
apt-get upgrade
##############################
#Instalar paquetes multimedia#
#############################
# El paquete necesario es libfaac-dev pero podemos instalar los demas para asegurar un funcionamiento perfecto.
# Indicamos si al instalador escribiendo una S
apt-get install libfaac-dev
apt-get install libmp3lame-dev
apt-get install libogg-dev
apt-get install libtheora-dev
apt-get install libvorbis-dev
apt-get install libx264-dev
apt-get install libxvidcore4-dev
##############################
#Minimo/Maximo Memoria Kernel#
##############################
# Editar el archivo sysctl.conf
nano /etc/sysctl.conf
#Agregar lo siguiente al final del archivo dejando una linea en blanco de ultimo:
kernel.shmall = 167772160
kernel.shmmax = 167772160
# Reiniciamos el sistema
reboot
##############################
#Instalar paquetes necesarios#
##############################
# No olvidar volverse root de nuevo con: su
aptitude install acpid build-essential linux-headers-`uname -r` automake perl libauthen-pam-perl \
apache2 libpam-runtime libio-pty-perl libmysqlclient-dev php5 php5-cli libapache2-mod-php5 php5-mysql \
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
#############################
#Descargar e Instalar Webmin#
#############################
wget http://downloads.sourceforge.net/project/webadmin/webmin/1.570/webmin_1.570_all.deb?use_mirror=voxel
mv webmin_1.570_all.deb\?use_mirror=voxel webmin_1.570_all.deb && \
dpkg -i webmin_1.570_all.deb
############################################
#Descargar e instalar libjpeg-turbo# (AMD64)
############################################
wget http://downloads.sourceforge.net/project/libjpeg-turbo/1.1.1/libjpeg-turbo_1.1.1_amd64.deb?use_mirror=voxel
mv libjpeg-turbo_1.1.1_amd64.deb?use_mirror=voxel libjpeg-turbo_1.1.1_amd64.deb && \
dpkg -i libjpeg-turbo_1.1.1_amd64.deb
# Crear enlaces
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
#############################
#Configurar las rutas de Lib#
############################
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
##########################
#Instalar modulos de Perl#
##########################
perl -MCPAN -e shell
install CPAN
exit
perl -MCPAN -e shell
install YAML PHP::Serialization Module::Load X10::ActiveHome
exit
LC_ALL=C perl -MCPAN -e shell
install Sys::Mmap
install DBI
install DBD::mysql
exit
#################
#Instalar FFmpeg#
#################
#FFMPEG 0.8.7#
cd /usr/src && wget http://ffmpeg.org/releases/ffmpeg-0.8.7.tar.gz
tar -xzvf ffmpeg-0.8.7.tar.gz
mv ffmpeg-0.8.7 ffmpeg
# Preparando y compilando FFmpeg
cd /usr/src/ffmpeg/ && ./configure --enable-gpl --enable-shared --enable-pthreads --enable-libx264 --enable-libfaac --enable-nonfree --enable-x11grab --enable-version3
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
#####################
##Instalar Zoneminder#
#####################
cd /usr/src
wget http://www.zoneminder.com/downloads/ZoneMinder-1.25.0.tar.gz
tar -xzvf ZoneMinder-1.25.0.tar.gz
mv ZoneMinder-1.25.0 zm
# Con las siguientes lineas damos los parametros para el archivo de configuracion de Zoneminder
# Cuidado con los datos en: ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass
# Podemos ingresar lo que se quiera pero se le deben indicar los mismos datos mas adelante a Msyql
cd /usr/src/zm && \
./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin \
ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser \
ZM_DB_PASS=zmpass ZM_SSL_LIB=openssl --enable-debug=no \
--with-webgroup=www-data --with-webuser=www-data --enable-mmap=yes CPPFLAGS="-D__STDC_CONSTANT_MACROS ${CPPFLAGS}"
autoconf
aclocal
automake
make
# Nos conectamos a Mysql para crear la BD necesaria para Zoneminder.
mysql -u root -p < db/zm_create.sql
# La contraseña que pide es para root de Mysql ingresada en la instalacion. No es la contraseña del sistema.
mysql -u root -p
# Aqui se usan los datos ingresados para el archivo de configuracion de Zoneminder.
grant select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
quit
mysqladmin -p reload
make install
####################
#Instalar Cambozola#
####################
cd /usr/src && wget http://www.charliemouse.com:8080/code/cambozola/cambozola-latest.tar.gz
tar -xzvf cambozola-latest.tar.gz
#cambiar las xx con la de la version descargada de cambozola
cp cambozola-0.xx/dist/cambozola.jar /var/www/zm
###################################
##Create Zoneminder startup script#
###################################
nano -w /etc/init.d/zm
#Paste everything BETWEEN the lines below.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ctrl-o to save, ctrl-x to exit nano
chmod 755 /etc/init.d/zm
#Because Ubuntu clears /tmp for some kind of reason at reboot,
#the /tmp/zm directory will also be deleted after a reboot. Creation in script/zmdc.in.pl
#will resolve this.
nano /usr/local/bin/zmdc.pl
#Add following lines (marked with a '+'-sign between the lines given (do not include '+').
foreach my $arg ( @ARGV )
}
}
+# Create the directory first if it doesn't exist
+mkdir(ZM_PATH_SOCKS);
+
socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" );
my $saddr = sockaddr_un( SOCK_FILE );
#To be sure, add rights to the /tmp/zm directory
chown www-data:www-data -R /tmp/zm
####################
#Zoneminder Startup#
####################
#In firefox, go to https://YOUR_ZoneMinder.IP.ADDRESS.HERE:10000 to reach the Webmin interface.(Login with Ubuntu username and password)
#In left menu, select System>Bootup and Shutdown. Tick the box next to zm and click StartNow and On Boot.
#In left menu, select Servers>Apache Webserver. Click virtual server under Existing virtual hosts tab. Under Virtual Server Details, change Document Root to /var/www/zm and then save.
#Click apply changes at top right of page.
#Go to http://YOUR_ZoneMinder.IP.ADDRESS.HERE to reach the Zoneminder interface.
To configure Postfix so Zoneminder can send out e-mails, you may have to configure it to work with your specific ISP. This may not be the most secure method.
sudo su nano /etc/postfix/main.cf
In the file that opens, remove the line that says “relayhost = ” (next to the end of the file) and add the following lines to the end (where ###CHANGETHIS### is the SMTP address given to you by your ISP):
#### ADDED BY HAND TO USE MY ISP SMTP ACCOUNT WHEN SENDING EMAILS #### relayhost = [smtp.###CHANGETHIS###.com] smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/sasl-passwords # smtp_sasl_mechanism_filter = digest-md5 # enable if your isp supports this
Save the file and close it. Now type in:
nano /etc/postfix/sasl-passwords
You will get a blank document window. Type in where ###CHANGETHIS### is your SMTP address given to you by your ISP, and “yourusername” is the user name you use to login to your ISP's e-mail, and obviously “yourpassword” is the password you use. Make sure the “:” stays between the two.
[smtp.###CHANGETHIS###.com] yourusername:yourpassword
Save and close the file. Type in the following to enable the password with your e-mail service:
postmap hash:/etc/postfix/sasl-passwords
Then restart the e-mail service with:
postfix reload