Centos 6.0 64-bit with ZM 1.25.0, FFmpeg, libjpeg-turbo,Camb

Forum for questions and support relating to the 1.25.x releases only.
Locked
letsharehowto
Posts: 10
Joined: Sun Oct 24, 2010 11:31 am
Location: Sai Gon - Viet Nam

Centos 6.0 64-bit with ZM 1.25.0, FFmpeg, libjpeg-turbo,Camb

Post by letsharehowto »

Centos 6.0 64-bit with ZoneMinder 1.25.0, FFmpeg, libjpeg-turbo, Cambozola.

Install fresh Centos 6.0 64-bit to box. REMEMBER config nic when you install.
Reboot box after install. Logon with root and then do everything with root too.
Install required packages, other useful packages, and their dependencies:

Code: Select all

yum -y update

Code: Select all

yum -y groupinstall core

Code: Select all

yum -y groupinstall base

Code: Select all

wget http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

Code: Select all

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

Code: Select all

rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm

Code: Select all

yum -y update

Code: Select all

yum install -y gcc gcc-c++ bison mysql-devel mysql-server php php-mysql php-pear php-pear-DB php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel subversion kernel-devel bison-devel zlib-devel openssl-devel gnutls-devel php-process perl-Time-HiRes pcre-devel gd mod_ssl ImageMagick libjpeg-devel perl-Archive-Tar perl-MIME-Lite perl-MIME-tools perl-Date-Manip perl-PHP-Serialization perl-Device-SerialPort perl-Archive-Zip perl-Sys-Mmap perl-Module-Load git yasm cpan mc htop
Install Perl Modules:

Code: Select all

cpan -i LWP::UserAgent
You have to say a lot of yes.
Install bttv driver- follow this step only if your card is not detected:
My card like this: http://www.zoneminder.com/wiki/index.php/Kodicom_8800

Code: Select all

nano /etc/modprobe.d/bttv.conf
Cut and paste this quote into file:
options i2c-algo-bit bit_test=1
options bttv gbuffers=16 card=102,102,102,102,102,102,102,102 radio=0,0,0,0,0,0,0,0 tuner=4,4,4,4,4,4,4,4 chroma_agc=1 combfilter=2 full_luma_range=1 coring=1 autoload=0
After editing in nano, hit ctrl-o to save, hit enter to use the given name, then hit ctrl-x to exit nano
Disabled firewall:

Code: Select all

setup
Go into the "Firewall Configuration" disable the Security Level click OK to save then click Quit to quit.
Disabled SELINUX:

Code: Select all

nano /etc/selinux/config
Change from SELINUX=enforcing to SELINUX=disabled
After editing in nano, hit ctrl-o to save, hit enter to use the given name, then hit ctrl-x to exit nano
Install ffmpeg:

Code: Select all

git clone git://git.videolan.org/ffmpeg.git

Code: Select all

cd ffmpeg && ./configure --enable-gpl --enable-shared --enable-pthreads

Code: Select all

make

Code: Select all

make install 

Code: Select all

make install-libs

Code: Select all

cd /lib && ln -s /usr/local/lib/libswscale.so.0 && ln -s /usr/local/lib/libswresample.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 && ln -s /usr/local/lib/libavdevice.so.53 && ln -s /usr/local/lib/libavfilter.so.2 && ln -s /usr/local/lib/libavformat.so.53 && ln -s /usr/local/lib/libavcodec.so.53 && ln -s /usr/local/lib/libpostproc.so.51 && ln -s /usr/local/lib/libswscale.so.2 && ln -s /usr/local/lib/libavutil.so.51

ldconfig
Install libjpeg-turbo (64)

Code: Select all

cd && wget http://sourceforge.net/projects/libjpeg-turbo/files/1.1.1/libjpeg-turbo-1.1.1.x86_64.rpm/download

Code: Select all

rpm -i libjpeg-turbo-1.1.1.x86_64.rpm && nano /etc/ld.so.conf.d/libjpeg-turbo.conf
Cut and paste this quote into file:
/opt/libjpeg-turbo/lib64
After editing in nano, hit ctrl-o to save, hit enter to use the given name, then hit ctrl-x to exit nano

Code: Select all

ldconfig
Enable services, turn everything on:

Code: Select all

chkconfig httpd on 
chkconfig mysqld on 
chkconfig ntpd on 
service httpd start 
service mysqld start 
service ntpd start
Install Zoneminder. Download ZoneMinder 1.25.0:

Code: Select all

cd && wget http://www2.zoneminder.com/downloads/ZoneMinder-1.25.0.tar.gz

Code: Select all

tar -zxvf ZoneMinder-1.25.0.tar.gz && cd ZoneMinder-1.25.0

Code: Select all

CFLAGS="-g -O3 -march=native -mtune=native" CXXFLAGS="-D__STDC_CONSTANT_MACROS -g -O3 -march=native -mtune=native" ./configure  --with-extralibs="-L/usr/lib64 -L/usr/lib64/mysql" --with-webdir=/var/www/html/zm --with-cgidir=/var/www/cgi-bin --with-webuser=apache --with-webgroup=apache ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser ZM_DB_PASS=zmpass ZM_SSL_LIB=openssl

Code: Select all

make

Code: Select all

make install
Configure MySQL
Need to add a password for the root user of MySQL (in my case password is: 111111)
Create the zm database
Create the zm database user with permissions and password

Code: Select all

mysql

Code: Select all

SET PASSWORD FOR root@localhost=PASSWORD('111111');
>Query OK, 0 rows affected (0.00 sec)

Code: Select all

create database zm;
>Query OK, 1 row affected (0.01 sec)

Code: Select all

CREATE USER 'zmuser'@'localhost' IDENTIFIED BY 'zmpass';
Query OK, 0 rows affected (0.01 sec)

Code: Select all

grant CREATE, INSERT, SELECT, DELETE, UPDATE on zm.* to zmuser@localhost;
>Query OK, 0 rows affected (0.02 sec)

Code: Select all

exit
>Bye
Import the tables into the zm database

Code: Select all

mysql -u root -p zm < db/zm_create.sql
Type 111111 then press Enter.
Make it so that ZoneMinder will startup automatically when the system is rebooted

Code: Select all

cp scripts/zm /etc/init.d/
chmod +x /etc/init.d/zm
chkconfig zm on
Install Cambozola:

Code: Select all

cd && wget http://www.zoneminder.com/sites/zoneminder.com/downloads/cambozola.jar

Code: Select all

cp cambozola.jar /var/www/html/zm/
Make sure you have permission to view it from apache:

Code: Select all

chown apache:apache /var/www/html/zm/cambozola.jar
Do something for Zoneminder be better:

Code: Select all

mcedit /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 );
Click F2 to save, click F10 to quit.
To be sure, add rights to the /tmp/zm directory

Code: Select all

chown apache:apache -R /tmp/zm
Do something with php:

Code: Select all

mcedit /etc/php.ini
change from:
;date.timezone =
to:
date.timezone = Asia/Ho_Chi_Minh
And change from:
short_open_tag = Off
to:
short_open_tag = On
Click F2 to save, click F10 to quit.
Reboot box:

Code: Select all

reboot
Tick the box for support for the Cambozola addon within your ZoneMinder installation: http://ip-address/zm (Options->Images tab->OPT_CAMBOZOLA)
If you want better quality video, cut -r 25 in Option->Images->FFMPEG_OUTPUT_OPTIONS ad replace with:
-f mp4 -r 25 -b 2048k -vcodec mpeg4
To check libjpeg-turbo works:

Code: Select all

lsof |grep libjpeg.so.62.0.0
If it works quote like this:
[root@dvr ~]# lsof |grep libjpeg.so.62.0.0
httpd 1672 root mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
httpd 1850 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
httpd 1851 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
httpd 1852 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
httpd 1853 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
httpd 1854 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
httpd 1855 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
httpd 1856 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
httpd 1857 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zmc 1888 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zma 1899 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zmc 1960 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zma 1971 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zmc 1996 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zma 2007 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zmc 2032 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zma 2043 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zmc 2070 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zma 2081 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zmc 2106 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zma 2117 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zmc 2142 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zma 2153 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zmc 2178 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
zma 2189 apache mem REG 8,1 258704 6160404 /opt/libjpeg-turbo/lib64/libjpeg.so.62.0.0
Have fun.
leyton01
Posts: 5
Joined: Mon Dec 26, 2011 11:53 am

Re: Centos 6.0 64-bit with ZM 1.25.0, FFmpeg, libjpeg-turbo,

Post by leyton01 »

Great walkthrough - I am going to try this with CentOS 6.2 and hopefully there will be not too many walls for a ZM/*nix noob.
Would you also recommend webmin for someone who knows very little about anything but windows? :)
caseystone
Posts: 98
Joined: Fri Feb 25, 2005 3:41 am
Location: England

Re: Centos 6.0 64-bit with ZM 1.25.0, FFmpeg, libjpeg-turbo,

Post by caseystone »

Wow! Thanks for the great how-to (assuming it works! :-)

I may try this, since my script-kiddie Ubuntu 10.04 doesn't manage to keep running more than about two months without running into a dead OS situation (unless I have a bad hard disk).
SB G620 on Asus P8H67-M LX, 4GB, WD10EURS 'DVR' drive. Ubuntu 10.04.3 server. System load <=1.

8-port 240fps BTTV capture card, 6 cams. Modect 1 zone blobs of mx area 3, mx blobs 1. Some on alarmed pixels mn5/mx80. Mons not linked.
johnh48726
Posts: 1
Joined: Mon Jan 30, 2012 5:02 am

Re: Centos 6.0 64-bit with ZM 1.25.0, FFmpeg, libjpeg-turbo,

Post by johnh48726 »

Good day,
This post caught my interest as I have been struggling installing ZM-1.25.0 on Centos6.2, 64bit, on a new platform for the entire weekend. I was successful in getting it installed and operational on a much smaller platform but not this.

Specifically I am getting a compile time error and, I am afraid, it is way beyond my abilities of debugging at this point. Any help greatly appreciated.

Here is the error after 'make'.
g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/include -I/usr/include -Wall -Wno-sign-compare -fno-inline -I/usr/include -D__STDC_CONSTANT_MACROS -g -O3 -march=native -mtune=native -MT zm_ffmpeg_camera.o -MD -MP -MF .deps/zm_ffmpeg_camera.Tpo -c -o zm_ffmpeg_camera.o zm_ffmpeg_camera.cpp
zm_ffmpeg_camera.cpp: In destructor âvirtual FfmpegCamera::~FfmpegCamera()â:
zm_ffmpeg_camera.cpp:62: warning: void av_close_input_file(AVFormatContext*) is deprecated (declared at /usr/local/include/libavformat/avformat.h:1402)
zm_ffmpeg_camera.cpp:62: warning: void av_close_input_file(AVFormatContext*) is deprecated (declared at /usr/local/include/libavformat/avformat.h:1402)
zm_ffmpeg_camera.cpp: In member function virtual int FfmpegCamera::PrimeCapture():
zm_ffmpeg_camera.cpp:95: error: av_open_input_file was not declared in this scope
zm_ffmpeg_camera.cpp:99: warning: int av_find_stream_info(AVFormatContext*) is deprecated (declared at /usr/local/include/libavformat/avformat.h:1232)
zm_ffmpeg_camera.cpp:99: warning: int av_find_stream_info(AVFormatContext*) is deprecated (declared at /usr/local/include/libavformat/avformat.h:1232)
zm_ffmpeg_camera.cpp:126: warning: int avcodec_open(AVCodecContext*, AVCodec*) is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3678)
zm_ffmpeg_camera.cpp:126: warning: int avcodec_open(AVCodecContext*, AVCodec*) is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3678)
make[2]: *** [zm_ffmpeg_camera.o] Error 1
make[2]: Leaving directory `/root/ZoneMinder-1.25.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/ZoneMinder-1.25.0'
make: *** [all] Error 2
Locked