Gentoo ZioPRoTo

From ZoneMinder Wiki
Jump to: navigation, search

I wrote a little bit of documentation, I guess this might be good for the Community.

ZioPRoTo (Saverio Proto)

This document tells you how to make a ZoneMinder Server on Gentoo Linux I spent a couple of days reading the ZoneMinder Forum to have a nice ZoneMinder installation on Gentoo, so in this thread I'm trying to write down the complete guide Smile Few easy steps to install ZoneMinder on Gentoo Smile First of all install Gentoo I used version 2006.1 to write the HowTo Grab the Live CD and make a networkless installation, installing no extra packages. Just the base system. Once installed modify the file /etc/make.conf You must set ACCEPT_KEYWORDS="~x86" because ZoneMinder is still not stable in the Portage. This will change in the future, keep in mind this document is dated October 2006 SYNC and GENTOO_MIRRORS are just to have faster download sources. Here is my Make.conf example:

  1. These settings were set by the catalyst build script that

automatically built this stage

  1. Please consult /etc/make.conf.example for a more detailed


  1. CFLAGS="-O2 -march=i686 -pipe"

CFLAGS="-march=i686 -O2 -pipe" CHOST="i686-pc-linux-gnu" CXXFLAGS="${CFLAGS}" MAKEOPTS="" ACCEPT_KEYWORDS="~x86" USE="-cups mpeg apache2 php mysql -X java samba -gtk swat png tiff gif jpeg -opengl alsa -firefox -kde dvdr encode mp3 vorbis -gnome -new-login xml graphviz bzip2 bash-completion" FEATURES="" SYNC="rsync://" GENTOO_MIRRORS="" LINGUAS="it"

Now you can go ahead and use emerge to install what you need: emerge --sync update list of packets emerge portage update portage emerge --update world update all system etc-update update config files emerge libpcre If you dont install this manually now, later on zoneminder will complain about this in the syslog. emerge zoneminder zoneminder, automatically this will also install apache2 mysql and php When emerge is done, last few lines on the console will show how to modify /etc/zm.conf and how to prepare the mysql database. Let’s see now these two steps: I used apache2, with apache2 may be a little different /etc/zm.conf

ZM_PATH_BUILD = /usr/share/zoneminder ZM_PATH_WEB = /var/www/localhost/htdocs/zoneminder ZM_PATH_CGI = /var/www/localhost/cgi-bin

  1. ZoneMinder database hostname or ip address


  1. ZoneMinder database name


  1. ZoneMinder database user


  1. ZoneMinder database password


Now run mysql_install_db if this is your first mysql startup. And then mysql /etc/init.d/mysql start Now we create the database tables needed by zoneminder: mysql -u root < /usr/share/zoneminder/db/zm_create.sql Into /etc/zm.conf just use root as your DB user so you dont have to create a user. Of course it is better to create a user, but I’m not explaining this here now. Now let’s start apache2 /etc/init.d/apache2 start. Point your browser at http://IP/zoneminder and we should see the ZoneMinder console. We are almost done, just a few things to fix: to make everything start automatically when the machine boots: rc-update add apache2 default rc-update add mysql default rc-update add zoneminder default Now modify /etc/sysctl.conf inserting these two lines: kernel.shmall = 134217728 kernel.shmmax = 134217728 If you dont do this, ZoneMinder won’t have enough shared memory and will not work with images bigger than 320x240. The Start/Stop script provided with the package is not working, so on the ZoneMinder forum I found information about how to fix the problem: Modify /etc/passwd Replace: apache:x:81:81:added by portage for apache:/var/www:/usr/sbin/nologin with: apache:x:81:81:added by portage for apache:/var/www:/bin/bash We let the apache user execute commando (warning this is a securty threat!) We put this brand new file /etc/init.d/zoneminder:

  1. !/sbin/runscript
  2. Start and stop zoneminder (for Gentoo)

opts="start stop status" depend() { use mysql apache2 } prog=ZoneMinder ZM_PATH_BIN="/usr/bin" command="$ZM_PATH_BIN/" start() { ebegin "Starting $prog" $command start eend $? "Failed to start $prog" } stop() { ebegin "Stopping $prog" $command stop eend $? "Failed to stop $prog" } status() { result=`$command status` if [ "$result" = "running" ]; then echo "ZoneMinder is running" RETVAL=0 else echo "ZoneMinder is stopped" RETVAL=1 fi exit ${RETVAL} }

Start/stop script is fixed. Last patches: cd /var/www/localhost/htdocs/zoneminder chmod 777 events/ mkdir temp/ chmod 777 temp/ I hope this will be useful to someone until ZoneMinder becames a stable package for Gentoo  ZioPRoTo (Saverio Proto)