Toms Online Notebook Sharing my stuff.

New Zoneminder install on Fedora20 (from Source)

by tgutwin


Posted on Monday Jan 25, 2016 at 06:22PM in Technology


WHY?


I updated my Zoneminder installation to the latest version (1.27 master branch) from source at GitHub.
My intention is to get the latest version that has an updated FFMPEG
library and the libVLC. My original intention was to also building x264
and ffmpeg from source to ensure I have all codecs compiled in from the
start.I did not have to do that because the Fedora20 Packages from RPMFusion already have what I needed (that makes life easier). I have done this before (see http://tom.webarts.ca) for by past experiences.


I am also re-installing the OS - Fedora20 to get the latest security updates.


The Zoneminder wiki has pretty good instructions. http://www.zoneminder.com/wiki/index.php/Documentation#Installation_from_Source
The forum also has a very good summary of installing from RPMs http://www.zoneminder.com/forums/viewtopic.php?f=9&t=19119


Here are my steps:


Prepare



  1. Backup my existing install (just in case)

  2. Took snapshots of all the existing ZM settings screens for my cameras and the ZM options dialogue.


Install Fedora 20



  1. Download F20 Live install CD

  2. Re-booted and installed

  3. re-formatting all drives.


    • I am keeping my drive layout simple:

    • /boot

    • swap

    • and a root dir /



  4. re-boot to newly install F20


Setup fedora 20



  1. disable selinux

  2. turn on screen sharing using the standard Fedora settings interface under settings / Sharing


    • disable the encryption (since I am on a local network) so Windoze TightVNC works

    • in a gnome-terminal type


      • gsettings set org.gnome.Vino require-encryption false



    • Thanks to: http://hex.ro/wp/blog/fedora-20-remote-desktop-with-tightvnc-viewer-from-windows-7



  3. disable firewall

  4. install yumex

  5. Save some disk space by uninstalling libreoffice, and un-needed font files and help docs.

  6. add zm user (Mws*****Zn)

  7. enabled auto-login for my user using the standard Fedora settings interface under settings / Users

  8. do a yum update

  9. reboot.

  10. setup my network shares by adding entries in the /etc/fstab

  11. copy my user bin over to get all my handy-dandy scripts and helper apps

  12. copy over Oracle Java JDK

  13. setup my paths and .bashrc


Get the build environment setup



  1. install Oracle JDK into opt

  2. add yum-plugin priorities


    • configure yum priorities



  3. Add yum repo RPMFusion (note: the GitHub wiki dos say to add 2 others... I didn't have to)


    • Prepare build dirs and get library files

    • create a dev dir in my user dir to hold all the development work

    • yum install rpmFusion repos (both free and non-free)


      • install the required packages


      • sudo yum install automake gcc libgcc gcc-c++ libgcrypt libgcrypt-devel bzip2-devel ffmpeg ffmpeg-devel gnutls-devel httpd libjpeg-turbo libjpeg-turbo-devel mariadb-devel pcre-devel mariadb-server perl-Archive-Tar perl-Archive-Zip perl-Convert-BinHex perl-Date-Manip perl-DBD-MySQL perl-DBI perl-Device-SerialPort perl-Email-Date-Format perl-IO-stringy perl-IO-Zlib perl-MailTools perl-MIME-Lite perl-MIME-tools perl-MIME-Types perl-Module-Load perl-Package-Constants perl-Sys-Mmap perl-Time-HiRes perl-TimeDate perl-YAML-Syck php php-cli php-mysql x264 vlc-devel vlc-core libcurl libcurl-devel perl-Sys-Syslog openssl-libs openssl-devel openssl-perl perl-Net-SSLeay perl-Crypt-SSLeay gnutls-utils gnutls gnutls-devel gnutls-c++ mod_gnutls perl-LWP-Protocol-https php-pear-Net-UserAgent-Detect perl-LWP-UserAgent-Determined perl-ExtUtils-MakeMaker perl-ExtUtils-MakeMaker-Coverage expect perl-Net-SFTP-Foreign expect-devel perl-Test-Expect perl-Expect perl-Expect-Simple perl-Net-SSH-Expect







Get MySQL Prepared


 I installed MariaDB - a fork of MySQL and the default in F20




    • Start DB by running the following:

    • systemctl start mariadb.service

    • systemctl enable mariadb.service

    • mysql_secure_installation

    • systemctl restart mariadb.service




    • create a DB user - zm

    • Type the 'mysql' command in the terminal. By default password for root is blank, BUT you set it above using the mysql_secure_installation command


    • mysql -u root -p
      Enter password:
      Welcome to the MariaDB monitor. Commands end with ; or \g.
      Your MariaDB connection id is 2
      Server version: 5.5.37-MariaDB MariaDB Server
      Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

      MariaDB [(none)]> CREATE USER 'zmSecurity'@'localhost' IDENTIFIED BY '*****************';
      Query OK, 0 rows affected (0.00 sec)

      MariaDB [(none)]> CREATE USER 'tgutwin'@'10.0.0.%' IDENTIFIED BY '********************';
      Query OK, 0 rows affected (0.00 sec)

      MariaDB [(none)]> create database zm;
      Query OK, 1 row affected (0.01 sec)

      MariaDB [(none)]> flush privileges;
      Query OK, 0 rows affected (0.01 sec)

      MariaDB [(none)]> exit
      Bye

      After the zm build the zm tables db will get created with
      mysql zm < db/zm_create.sql
      then

      mysql -u root -p
      Enter password:
      Welcome to the MariaDB monitor. Commands end with ; or \g.
      Your MariaDB connection id is 2
      Server version: 5.5.37-MariaDB MariaDB Server

      Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

      MariaDB [(none)]> grant select,insert,update,delete,lock tables,alter on zm.* to 'zmSecurity'@localhost identified by '';
      MariaDB [(none)]> flush privileges;
      Query OK, 0 rows affected (0.01 sec)

      MariaDB [(none)]> exit
      Bye





  1. setup its permissions


Get httpd setup



  1. Edit the httpd.conf


    • Comment OUT the ScriptAlias Line

    • It confuses ZM

    • It will be set in the zoneminder.conf file



  2. set the correct timezone in the php.in file


    • see https://bugzilla.redhat.com/show_bug.cgi?id=973067

    • vi /etc/php.ini


      • date.timezone = "America/Vancouver"






Build & Install ZoneMinder



  1. clone the Zoneminder Git

  2. cd into ZoneMinder

  3. ./bootstrap.sh

  4. ./configure --help to see what you can set


  5. export ZM_DB_USER=whateverYouUsed
    export ZM_DB_PASS=thePasswdYouUsed
    export CFLAGS="-I/usr/include/ffmpeg"
    export CPPFLAGS="-I/usr/include/ffmpeg"
    cd /home/tgutwin/dev/lib/ZoneMinder
    ./configure --prefix=/usr --with-extralibs=-L/usr/lib --with-libarch=lib64 --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/usr/share/zoneminder/www --with-webhost=zm.webarts.bc.ca --with-cgidir=/usr/libexec/zoneminder/cgi-bin


  6. make

  7. sudo make install

  8. cp distros/fedora/zoneminder.conf /etc/httpd/conf.d/.

  9. cp distros/fedora/zoneminder.service /etc/systemd/system

  10. create the zm database tables


    • mysql -u root -p zm < db/zm_create.sql

    • mysql -u root -p


      • grant ALL ON zm.* to 'zmSecurity'@'localhost' identified by 'yourPass';

      • flush privileges;

      • quit;





  11. Edit the /etc/zm/conf


    • see http://forums.fedoraforum.org/showthread.php?t=288585

    • make sure the cgi-bin is correct


      • # Path to ZoneMinder cgi files
        ZM_PATH_CGI=/usr/libexec/zoneminder/cgi-bin





  12. Edit the /etc/httpd/conf.d/zoneminder.conf


    • DO NOT comment out the scriptAlias line

    • it should look like:
      ScriptAlias /cgi-bin "/usr/libexec/zoneminder/cgi-bin"

    • NOTE: there is no 'zm' after the cgi-bin alias

    • this is the source of ERROR in the logs: "ERR [socket_sendto( /tmp/zm/....."
      OR no streaming camera view



  13. sudo systemctl restart httpd.service

  14. visit the Zoneminder Web Page -- http://localhost/zm



No one has commented yet.
Comments are closed for this entry.