THIS INSTALLATION DOCUMENT IS STILL EXPERIMENTAL,

please report bugs and typos to dev.icinga.org

0) Introduction

More information about the overall architecture can be found on our website:

http://www.icinga.org/architecture/

If you want know more about Icinga web development and the module architecture,
please check out the development wiki of Icinga Web:

https://dev.icinga.org/projects/icinga-web/wiki


1) Prerequisites

You need a running dbms and php (with PEAR and CLI) environment w/ icinga and ido (ido2db).
The Icinga API is mandatory being installed too.

If there's something missing on your system, please refer to docs.icinga.org.

2) The beautiful GNU-install conglomerate

The installation is based on 'autoconf' and 'make', now. If the existing configure script fails, try to recreate one
with autoconf. On Debian/Ubuntu systems you'll need some packages like 'make' and 'autoconf'.

	2.1) Creating a configure file
		
		Quite simple. If you have autoconf installed, type autoconf to invoke the GNU tool.
		
	2.2) Executing configure
	
		The configure tool helps you to set some important parameters for the software. It also creates
		config and build files for you.
		
		To determine which options are provided try 'sh configure --help' to see what's available.
		
		After you have created your own build command you can fire up the whole thing just as in the
		following example:
		
		$ sh configure \
			--prefix=/usr/local/icinga-web \
			--with-web-user=www-data \
			--with-web-group=www-data \
			--with-db-type=mysql \
			--with-db-host=localhost \
			--with-db-port=3306
			--with-db-name=icinga_web
			--with-db-user=icinga_web \
			--with-db-pass=icinga_web \
			--with-icinga-api=/usr/local/icinga/share/icinga-api
		
		If the command runs without errors you will have a ready configured icinga-web.
		
		Keep in mind that you configure the icinga-web database not the icinga idoutils database!

		
	2.3) The make command and its targets
	
		After the configuration step you can install icinga-web by invoking make.
		
		Type 'make' to see a list of available options.
		
		To install to the desired location type 'sudo make install' at the prompt. Be sure to use root
		privileges to to this.
		
		Install also overwrites your existing directory and any old configuration in there. To avoid 
		data loss make backups or write down your configure command to match you needs.

		'make testdeps' checks if you meet all the required (php) dependencies for icinga-web
		
		'make' can also install and upgrade new or existing databases by using the following targets:
		
		make db-initialize	- creates a spick-and-span database
		make db-drop 		- drops your database with a security query to avoid casualties
		make db-upgrade		- upgrades old tables to a newer version (Just the same as db-initialize
					  with a better name ;-))
		make db-doc2sql		- if you require plain SQL scripts, use this option to generate SQL from
					  Doctrine. This can be useful for packaging or manual db install
							  
		To use the database creation commands you have to grant privileges to the user who will execute
		the commands on your dbms. If the user defined via configure is a low-privileged one, 'make' asks
		about a more privileged one e.g. a root user. If this does not work for you, alter
		'etc/build.properties' to match the requirements of a root user.
		
		You can also read install-fromscratch.txt to get deeper involved in how to use the phing-build
		system for icinga-web

3) Database

	Create a db user for your likings. The user must have default data privileges like SELECT, UPDATE, INSERT, DELETE.

		SQL> GRANT USAGE ON *.* TO 'icinga_web'@'localhost' IDENTIFIED BY 'icinga_web';
		SQL> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX ON icinga_web.* TO 'icinga_web'@'localhost';
		SQL> FLUSH PRIVILEGES;

	After configure, use make db-initialize for creating the database and applying the schema with prefilled data.

	Section 2.3, http://docs.icinga.org the install-fromscratch.txt file should give you more detailed information how it works.

4) Webserver configuration

	Three things have to be available on the system: you have to set up apache, with mod_rewrite and php5.
	
	After that you should include the pub (htdocs) directory of icinga-web with an alias directive in global scope
	(like apache.conf or where your icinga configuration lives):
	
		Alias /icinga-web /path/to/pub
		<directory /path/to/pub>
			AllowOverride All
		</directory>
		
	The 'AllowOverride All' setting allows to use a .htaccess configuration in the pub directory.
	
	Furthermore you should take a look to '/path/to/pub/.htaccess'. Apache's mod_rewrite needs a correct
	definition of 'RewriteBase' to operate in subdirectories. Please change this to your webpath (NOT THE PHYSICAL ONE) .

5) Web configuration

	Keep a look into app/modules/Web/config/module.xml for the IcingaApi factories: IcingaData and IcingaCommand.
	In IcingaData you can set the credentials for the Icinga API e.g. using the Icinga IDOUtils database.
	In IcingaCommand you can specify the credentials for sending commands via Icinga Core command pipe - local or
	remote via SSH.
	
		<!-- icinga-api data interface -->
		<parameter name="IcingaData">
			<parameter name="class">IcingaData</parameter>
			<parameter name="file">%core.root_dir%/app/lib/icinga/factory/IcingaData.class.php</parameter>
			
			<parameter name="requiredClasses">
				<!-- NONE -->
			</parameter>
			
			<parameter name="api_file">%core.root_dir%/lib/icinga-api/IcingaApi.php</parameter>
			
			<!--
				API connection type
			-->
			<parameter name="api_type">IcingaApi::CONNECTION_IDO</parameter>
			
			<parameter name="config_type">mysql</parameter>
			<parameter name="config_host">127.0.0.1</parameter>

			
			<parameter name="config_port">3306</parameter>
			<parameter name="config_database">icinga</parameter>
			
			<parameter name="config_user">icinga</parameter>
			<parameter name="config_password">icinga</parameter>
			
			<parameter name="config_table_prefix">icinga_</parameter>
		</parameter>
		
		<parameter name="IcingaCommand">
			<parameter name="class">IcingaCommand</parameter>
			<parameter name="file">%core.root_dir%/app/lib/icinga/factory/IcingaCommand.class.php</parameter>
			
			<parameter name="requiredClasses">
				<!-- NONE -->
			</parameter>
			
			<parameter name="api_file">%core.root_dir%/lib/icinga-api/IcingaApi.php</parameter>
			
			<parameter name="interfaces">
			
				<parameter name="pipe1">
					<parameter name="enabled">true</parameter>
					<parameter name="type">IcingaApi::COMMAND_PIPE</parameter>
					
					<parameter name="pipe">/usr/local/icinga/var/rw/icinga.cmd</parameter>
				</parameter>
			
				<parameter name="ssh1">
					<parameter name="enabled">false</parameter>
					<parameter name="type">IcingaApi::COMMAND_SSH</parameter>
					
					<parameter name="ssh_bin">/usr/bin/ssh</parameter>
					<parameter name="ssh_user">icinga</parameter>
					<parameter name="ssh_host">127.0.0.15</parameter>
					<parameter name="ssh_port">22</parameter>
					<parameter name="ssh_timeout">20</parameter>
					<parameter name="ssh_pipe">/usr/local/icinga/var/rw/icinga.cmd</parameter>
				</parameter>
			</parameter>
			
			
		</parameter>
		
	After change the files in the config directory, clear the cache: 'rm -rf app/cache/config/*.php'

6) Running the interface and being glad

	After a restart of apache you will be able to visit the interface in your browser by using the
	URL of the recently set up web interface like http://localhost/icinga-web.
	
	You can login with the following credentials:
	
		User: root
		Pass: password
		
	Have fun!
