|
|
(14 intermediate revisions by 3 users not shown) |
Line 8: |
Line 8: |
| * Gentoo's portage package system in conjunction with the emerge command makes it much easier to obtain the needed packages for ZoneMinder and whatever else you might need. | | * Gentoo's portage package system in conjunction with the emerge command makes it much easier to obtain the needed packages for ZoneMinder and whatever else you might need. |
|
| |
|
| == What You Will Need == | | == Installation of Gentoo Linux == |
| * A [http://www.gentoo.org/main/en/where.xml Gentoo LiveCD]
| | Gentoo has its own comprehensive install guide which is regularly updated, this can be found in the [https://wiki.gentoo.org/wiki/Handbook:Main_Page Gentoo Handbook]. |
| * An internet connection, to download and install the necessary packages
| |
|
| |
|
| == About ZoneMinder for Gentoo == | | == Installing ZoneMinder for Gentoo == |
| There are some ZoneMinder packages (called 'ebuilds') available for Gentoo in the 'portage' tree. However, they are not readily available in the mainstream portage tree ''and'' are a few releases behind. In addition, these ebuids have questionable configurability. It is best to compile from source. | | There are some ZoneMinder packages (called 'ebuilds') available for Gentoo in the 'portage' tree. https://packages.gentoo.org/packages/www-misc/zoneminder |
|
| |
|
| The Zoneminder ebuilds are currently (Feb 2007) masked. | | The ZoneMinder ebuilds are currently (April 2017) masked. |
| You will need to unmask the package | | You will need to unmask the package |
| <pre> # cat /etc/portage/package.keywords |grep zone | | <pre># nano /etc/portage/package.keywords |
| www-misc/zoneminder ~x86 </pre> | | www-misc/zoneminder ~amd64 |
| | </pre> |
|
| |
|
| you may also want to add the version to /etc/portage/package/unmask | | you may also want to add the version to /etc/portage/package.unmask |
| <pre># cat /etc/portage/package.unmask | | <pre># nano /etc/portage/package.unmask |
| =www-misc/zoneminder-1.22.3 | | =www-misc/zoneminder-1.30.2 |
| # </pre>
| | </pre> |
|
| |
|
| the current ebuild doesnt bring in (or start apache), so you will need apache,php, and mysql | | After unmasking you can now install via the emerge command. |
|
| |
|
| === config file ===
| |
|
| |
| configure the included config file . Heres my working version. It includes the database username/password
| |
| <pre> | | <pre> |
| chickcam ~ # grep ^[A-Za-z] /etc/zm.conf
| | emerge --ask zoneminder |
| ZM_VERSION=1.22.3
| | </pre> |
| ZM_PATH_BUILD=>/usr/share/zoneminder
| |
| ZM_TIME_BUILD=1170184168
| |
| ZM_PATH_BIN=/usr/bin
| |
| ZM_PATH_LIB=/usr/lib
| |
| ZM_PATH_CONF=/etc
| |
| ZM_PATH_WEB =/
| |
| ZM_PATH_CGI =/var/www/localhost/cgi-bin
| |
| ZM_WEB_USER=apache
| |
| ZM_WEB_GROUP=apache
| |
| ZM_DB_HOST=localhost
| |
| ZM_DB_NAME=zm
| |
| ZM_DB_USER=zm
| |
| ZM_DB_PASS=xxxxx
| |
| chickcam ~ # </pre>
| |
|
| |
|
| ==== configuring the camera ====
| | ZoneMinder currently depends on mysql. Gentoo will install [https://packages.gentoo.org/packages/dev-db/mariadb dev-db/maria] by default unless you configure otherwise. This will need to be configured prior to running ZoneMinder and adding its database. |
| I started with 1 camera plugged into localhost.
| |
|
| |
|
| It may need modules (spca5xx, gspca,etc ) which you will have to emerge or recompile in your kernel
| | <pre> |
| | emerge --config mariadb |
| | </pre> |
|
| |
|
| Initially i had a broken image. I checked /dev/video0 had appeared once the camera was configured and changed the permissions to 777
| | Once configured, you will need to add the zm database and install the default tables. |
|
| |
|
| <pre>~ # ls -la /dev/video0 | | <pre> |
| lrwxrwxrwx 1 root root 10 Feb 14 18:05 /dev/video0 -> v4l/video0
| | mysql -uroot -p -e "create database zm;" |
| </pre>~ #
| | mysql -uroot -p zm < /usr/share/zoneminder/db/zm_create.sql |
| | mysql -uroot -p |
|
| |
|
| In spite of this I had to add the webserver user ( apache ) to the video ''Italic text'' group to get the images to display
| | mysql> use zm; grant select,insert,update,lock tables,delete on zm.* to 'zmuser'@localhost identified by 'zmpass'; |
| | mysql> flush privileges; |
| | mysql> exit; |
| | </pre> |
|
| |
|
| == Installation of Gentoo Linux ==
| |
| === Overview of a Gentoo Installation ===
| |
| * Booting the LiveCD
| |
| * Prepare filesystems
| |
| * Mount filesystems
| |
| * Copy over base system from CD
| |
| * Retrieve latest portage tree from the internet
| |
| * Build a kernel
| |
| * Install necessary system packages
| |
| ** grub
| |
| ** dhcpcd
| |
| * Set Up Init Scripts
| |
|
| |
|
| The quickest way to install Gentoo is to use the bootable [http://www.gentoo.org/main/en/where.xml Gentoo LiveCD]. I've found that the automatic installer does not work well and randomly fails over CDROM read "errors". Instead, use the commands from the Gentoo Install Guide to manually copy over the system to your hard drive.
| |
|
| |
|
| ====Booting the LiveCD==== | | === Config File === |
| Insert, the LiveCD will configure most devices and will also grab a DHCP IP address if you have a live internet connection.
| |
|
| |
|
| ====Preparing Filesystems ====
| | ZoneMinder's config file is located at /etc/zm.conf |
| For the purposes of ZoneMinder, I recommend the following
| |
| /boot | |
| /root | |
| swap
| |
| /var
| |
|
| |
|
| ====Mounting Filesystems====
| | A default install will only require your database details to be updated. |
| | |
| ====Copying System Over from CD====
| |
| | |
| ==== Chrooting Your New System ====
| |
| That's it! You're ready to change your context into the actual running of your new system environment. That's where chrooting comes in.
| |
| | |
| ==== Setting USE Flags to Determine Compile Behavior ====
| |
| Gentoo has a neat concept of system management called USE flags. The USE variable is set by the file /etc/make.conf. In the USE variable, you specify what kinds of features you want included in packages. For example, if you set the 'apache2' use flag, any software that can take advantage of the apache webserver will be compiled to do just that. In addition, if you do not have apache installed and you try to install that same software, Apache will be automatically installed. There are many, many USE flags available. Many of them, along with their descriptions can be found [http://www.gentoo.org/dyn/use-index.xml here].
| |
| | |
| Here are the flags I use on my Gentoo system that's meant to be a media/ZM/camera server.
| |
| USE="-3dfx -arts -berkdb -cups -doc -esd -flac -fortran -gnome -gps -gtk -gtk2 -hardened -imap -ipv6 -kde -nls -opengl -oss -recode -qt -X -xv apache2 mpm-prefork bzip2 mysql php encode exif ffmpeg fbcon gd java javascript jpeg jpeg2k matroska mime mmx sse mp3 mpeg ogg oggvorbis vorbis pcre perl quicktime readline samba ssl symlink theora usb v4l vcd wifi xml xml2 xvid"
| |
| | |
| As you can see, this says a lot about how my system behaves. I do not use an X Server, so I disabled X, gtk, gtk2, gnome, kde, qt, xv (everything having to do with a graphical desktop). I enabled things like apache2, php, jpeg, mpeg, v4l, xvid (anything media related).
| |
| | |
| | |
| ==== Building a Kernel ====
| |
| Before Building a kernel, you may want to get some details about the hardware on your computer. You can do this using the tools on your LiveCD. Switch to another virtual console (Ctrl+Alt+F2-F6). These consoles are still running in the CD environment, NOT chrooted in the system you are building. From here you can do a dmesg|less and lspci to see what devices you have installed.
| |
| Follow the standard procedure in compiling a kernel. The process usually proceeds as:
| |
| # make menuconfig, to configure the kernel
| |
| # make, to comile the kernel
| |
| # make install,
| |
| # make modules
| |
| # make modules_install
| |
| Be sure to included the drivers for your capture cards/cameras in the kernel if applicable.
| |
| | |
| ==== Necessary Packages ====
| |
| ZoneMinder mentions a few packages that are required; namely php, mysql and apache. But in my experience ZM requires many more.
| |
| | |
| You'll need:
| |
| * apache
| |
| * php
| |
| * mysql
| |
| * ffmpeg
| |
| * libperl
| |
| * openssl
| |
| * jpeg
| |
| * libpcre
| |
| | |
| Luckily, many of these packages are installed automatically as a result of dependencies. Gentoo will let you know what packages will also be installed with a selected package.
| |
| | |
| You may also want:
| |
| * pciutils, to get information about PCI devices to assist in troubleshooting.
| |
| * usbutils, to get information about USB devices to assist in troubleshooting.
| |
| * syslog-ng, to manage system logs. ZoneMinder will need to be configured to use it. (/etc/syslog-ng/syslog-ng.conf)
| |
| * vixie-cron, for ZoneMinder to complete scheduled cron jobs.
| |
| * samba, to exchange files with Windows clients/servers.
| |
| * camsource, lets you serve up web images from your capture card. Can be useful for diagnosis.
| |
| | |
| These packages are easily installed by typing emerge <package_name>
| |
| | |
| ====Setting Up Init Sripts====
| |
| Gentoo, like most distributions, has its own unique way of starting and stopping services upon boot.
| |
| | |
| == ZoneMinder Installation ==
| |
| | |
| '''* Note : the 3 following parts are now deprecated, since you can install zoneminder simply by emerging it. Once emerged, you can jump to the configuration part.'''
| |
| | |
| === Overview of ZoneMinder Installation ===
| |
| * Downloading Source
| |
| * Extracting the Source
| |
| * Building ZoneMinder
| |
| * Configuration
| |
| * Initializing the Database
| |
| * Defining Monitors
| |
| * Defining Zones
| |
| | |
| ====Downloading Source====
| |
| You can retreive the ZoneMinder source by using the Links web browser and navigating to http://www2.zoneminder.com/downloads. If anyone has a better way, could you please amend the Wiki?
| |
|
| |
|
| | <pre> |
| | ZM_DB_USER=zmuser |
| | ZM_DB_PASS=zmpass |
| | </pre> |
|
| |
|
| | ==== Additional Packages ==== |
|
| |
|
| *See the ZoneMinder Manual for further instructions | | You may also want to install: |
| | * pciutils - this is useful if you have pci based capture cards, probably not required if you intend to use IP cameras. |
| | * usbutils - same as pciutils for usb cameras, may not be required. |
| | * samba - to exchange files with Windows clients/servers. |
|
| |
|
| ==== Extracting the Source ====
| | These packages are easily installed by typing emerge --ask <package_name> |
| *Extract the source of the tarball to the /usr/src directory
| |
| <code>tar -xjvf ZoneMinder-src.tar.bz2 /usr/src</code>
| |
| ====Building ZoneMinder====
| |
| *Change to the source directory
| |
| <code>cd /usr/src/ZoneMinder-src</code>
| |
| <code>./configure</code>
| |
| <code>make</code>
| |
| <code>make install</code>
| |
| ====Configuration====
| |
| Configuration files
| |
| ====Initializing the Database====
| |
| <code>database command here</code>
| |
| ====Defining Monitors====
| |
| You will need another computer with a webbrowser connected to the ZoneMinder box by a network.
| |
| #Open a web browser and type in the IP address of the Zoneminder box (Obtain the IP by issuing a <tt>ifconfig</tt> command on the ZoneMinder box.
| |
| ====Defining Zones====
| |
|
| |
|
| ==Maintaining the System== | | ==Maintaining the System== |
Line 183: |
Line 76: |
| ====Automatic FTP of Events==== | | ====Automatic FTP of Events==== |
| ====Purge When Full Script==== | | ====Purge When Full Script==== |
| | The default install includes a purge script that will clear frames at 95% disk capacity. This can be modifed under "Filters". |
About Gentoo
Gentoo is a distribution that prides itself on being extra-configurable, processor native, and easy to update. Gentoo users usually compile their installation from srouce, but while it's great to nitpick on the details, Gentoo also has the option of installing a precompiled system quickly from a LiveCD.
Why Gentoo?
- Other distros have a one-size-fits-all approach, including full GUI environments unnecessary for a ZoneMinder CCTV DVR box.
- Binary distributions make it difficult to locate the appropriate libraries for ZoneMinder to build properly. Packages for these distrubutions often do not include development libraries and headers necessary for building software from source.
- A Gentoo system is highly configurable, and is easy to update and maintain.
- Gentoo's portage package system in conjunction with the emerge command makes it much easier to obtain the needed packages for ZoneMinder and whatever else you might need.
Installation of Gentoo Linux
Gentoo has its own comprehensive install guide which is regularly updated, this can be found in the Gentoo Handbook.
Installing ZoneMinder for Gentoo
There are some ZoneMinder packages (called 'ebuilds') available for Gentoo in the 'portage' tree. https://packages.gentoo.org/packages/www-misc/zoneminder
The ZoneMinder ebuilds are currently (April 2017) masked.
You will need to unmask the package
# nano /etc/portage/package.keywords
www-misc/zoneminder ~amd64
you may also want to add the version to /etc/portage/package.unmask
# nano /etc/portage/package.unmask
=www-misc/zoneminder-1.30.2
After unmasking you can now install via the emerge command.
emerge --ask zoneminder
ZoneMinder currently depends on mysql. Gentoo will install dev-db/maria by default unless you configure otherwise. This will need to be configured prior to running ZoneMinder and adding its database.
emerge --config mariadb
Once configured, you will need to add the zm database and install the default tables.
mysql -uroot -p -e "create database zm;"
mysql -uroot -p zm < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -p
mysql> use zm; grant select,insert,update,lock tables,delete on zm.* to 'zmuser'@localhost identified by 'zmpass';
mysql> flush privileges;
mysql> exit;
Config File
ZoneMinder's config file is located at /etc/zm.conf
A default install will only require your database details to be updated.
ZM_DB_USER=zmuser
ZM_DB_PASS=zmpass
Additional Packages
You may also want to install:
- pciutils - this is useful if you have pci based capture cards, probably not required if you intend to use IP cameras.
- usbutils - same as pciutils for usb cameras, may not be required.
- samba - to exchange files with Windows clients/servers.
These packages are easily installed by typing emerge --ask <package_name>
Maintaining the System
Watchdogs
Avoiding a Full Disk
Automatic FTP of Events
Purge When Full Script
The default install includes a purge script that will clear frames at 95% disk capacity. This can be modifed under "Filters".