Install Mysql server and icinga2.

# pkg ins mysql56-server icinga2

Enable services and start mysql.

# echo 'mysql_enable="YES"' >> /etc/rc.conf # echo 'icinga2_enable="YES"' >> /etc/rc.conf # service mysql-server start

Create database icinga and user, and grant privileges to this database.

# mysql -p -u root


mysql> create database icinga2 character set utf8; mysql> grant all on icinga2.* to icuser@localhost identified by 'Password'; mysql> connect icinga2; mysql> source /usr/local/share/icinga2-ido-mysql/schema/mysql.sql;

Enable modules and start icinga2.

# icinga2 feature enable command ido-mysql livestatus perfdata statusdata # service icinga2 start

Install and configure apache with php.

Also, in httpd.conf, uncomment rewrite module:

LoadModule rewrite_module

Configure php.

# cd /usr/local/etc/ # cp php.ini-production php.ini # vi php.ini

date.timezone = Europe/Moscow

Install icingaweb2.

# pkg ins icingaweb2

Configure icingaweb2 with Apache.

# cp /usr/local/share/examples/icingaweb2/apache/icingaweb2.conf /usr/local/etc/apache24/Includes/

Generate token and save it for next setup in web browser.

# cd /usr/local/www/icingaweb2/ # ./bin/icingacli setup token create --config=/usr/local/etc/icingaweb2

Configure mysql with icingaweb2.
Add user, database and pasword for connect to mysql database.

# vi /usr/local/etc/icinga2/features-enabled/ido-mysql.conf


Start Apache.

# chown -R www:www /usr/local/etc/ # service apache24 start


Next, go to web browser http://ip-address/icngaweb2 and finish setup.