#
# phpipam install instructions
#

phpipam has the following requirements to run:

    - Apache2 web server with php and mod_rewrite support
    - "AllowOverride all" set in vhost config for mod_rewrite to work
    - Mysql server (5.1+)
    - PHP version 5.2+ with following modules (on Windows php 5.3 is required!)
        + + mysqli              : Adds support for the improved mySQL libraries
        + + session             : Adds persistent session support
        + + gmp                 : Adds support for dev-libs/gmp (GNU MP library) -> to calculate IPv6 networks
        + + ldap                : Adds LDAP support (Lightweight Directory Access Protocol)
        + + json				: Adds supports for JSON data-interexchange format
        + + SimpleXML			: Adds SimpleXML support for parsin XML files
        + + Geetext				: Adds support for translation files
	- PHP PEAR support (dev-php/pear)
    

The above requirements should be met to continue with installation.
Please also note that clients must have javascript enabled in browser for app to work, also browser with HTML5 support is *highly* recommended!

#
# Install procedure:
#
----------------------------------
1.) Configure the config.php file
----------------------------------
config.php file is where site configuration and database details are configured. Please edit it according to your needs and installation.
	vi config.php


-----------------------------------
2.) installation of database files
-----------------------------------

a.) Automatic installation
--------------------------
	phpipam can automatically install database files for you.
	Point browser to phpipam directory and set MySQL login details (root username and password).


	Finished! Launch browser, go to website and if something is missing / not configured properly the error will appear.

b.) manual installation of database files
------------------------------------------
Optional method to be used instead of automatic configuration.

	MySQL schema file is available under db folder.
	First you must create new database, and then import SCHEMA file into database. Instructions below are for command-line import with local mysql installation.
	------
	mysql -u root -p 
	create database phpipam;
	exit
	------
	
	Import database SCHEME.sql file:
	------
	mysql -u root -p phpipam < db/SCHEMA.sql
	------
	
	Create user for database interaction from website and grant permissions to ipam tables. Please change the username and password (ipv6, ipv6admin) according to your needs - you must also replace default ones in config file, which will be covered in step 2.
	------
	mysql -u root -p
	grant ALL on phpipam.* to ipv6@localhost identified by "ipv6admin";
	exit
	------



---------------------------------------------------
3.) (optional) First installation of database files
---------------------------------------------------

After installation is completed you can enable pretty links in administration. Before you do that make sure mod_rewrite is working properly and set BASE correctly.

if you have placed phpipam in web subdirectory, you need to modify the following (example for /phpipam/):
	- Set BASE in config.php to /phpipam/
	- RewriteBase /phpipam/ in .htaccess



----------------------------------
4.) (optional) Database backups
----------------------------------
It is *strongly* advised to backup database at least on weekly basis -> put following command to your crontab:
------
# Backup IP address table
@daily /usr/bin/mysqldump -u ipv6 -pipv6admin phpipam > <ipam_dir>/db/bkp/phpipam_bkp_$(date +"\%y\%m\%d").db
@daily /usr/bin/find  <ipam_dir>/db/bkp/ -ctime +10 -exec rm {} \;
------
It will backup ipam table each monday at 1AM. Change directories accordingly.


----------------------------------
4.) Misc stuff
----------------------------------
- Chrome frame
	For older, non HTML5 capable browsers install Chrome frame, which adds support from HTML5 and significantyl sppeds up javascript rendering
	http://code.google.com/chrome/chromeframe/

-FreeBSD: Required PHP modules can be installed through following ports:
	databases/php5-mysqli
	math/php5-gmp
	devel/pear

-Gentoo 
	php with mysqli, session and gmp use flags
	dev-php/pear
	
- Debian / ubuntu
	apt-get install php5-gmp
	apt-get install php-pear