1 # Getting Started <a id="getting-started"></a>
3 This tutorial is a step-by-step introduction to installing [Icinga 2](02-getting-started.md#setting-up-icinga2)
4 and [Icinga Web 2](02-getting-started.md#setting-up-icingaweb2).
5 It assumes that you are familiar with the operating system you're using to install Icinga 2.
7 In case you are upgrading an existing setup, please ensure to
8 follow the [upgrade documentation](16-upgrading-icinga-2.md#upgrading-icinga-2).
10 ## Setting up Icinga 2 <a id="setting-up-icinga2"></a>
12 First off you have to install Icinga 2. The preferred way of doing this
13 is to use the official package repositories depending on which operating system
14 and distribution you are running.
16 Distribution | Repository
17 ------------------------|---------------------------
18 Debian | [Icinga Repository](https://packages.icinga.com/debian/)
19 Ubuntu | [Icinga Repository](https://packages.icinga.com/ubuntu/)
20 RHEL/CentOS | [Icinga Repository](https://packages.icinga.com/epel/)
21 openSUSE | [Icinga Repository](https://packages.icinga.com/openSUSE/)
22 SLES | [Icinga Repository](https://packages.icinga.com/SUSE/)
23 Gentoo | [Upstream](https://packages.gentoo.org/package/net-analyzer/icinga2)
24 FreeBSD | [Upstream](https://www.freshports.org/net-mgmt/icinga2)
25 OpenBSD | [Upstream](http://ports.su/net/icinga/core2,-main)
26 ArchLinux | [Upstream](https://aur.archlinux.org/packages/icinga2)
27 Alpine Linux | [Upstream](https://pkgs.alpinelinux.org/package/edge/community/x86_64/icinga2)
29 Packages for distributions other than the ones listed above may also be
30 available. Please contact your distribution packagers.
32 ### Package Repositories <a id="package-repositories"></a>
34 You need to add the Icinga repository to your package management configuration.
35 The following commands must be executed with `root` permissions unless noted otherwise.
40 apt-get -y install apt-transport-https
42 wget -O - https://packages.icinga.com/icinga.key | apt-key add -
43 echo 'deb https://packages.icinga.com/debian icinga-stretch main' >/etc/apt/sources.list.d/icinga.list
50 apt-get -y install apt-transport-https
52 wget -O - https://packages.icinga.com/icinga.key | apt-key add -
53 echo 'deb https://packages.icinga.com/ubuntu icinga-xenial main' >/etc/apt/sources.list.d/icinga.list
60 yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm
66 yum install https://packages.icinga.com/epel/icinga-rpm-release-6-latest.noarch.rpm
72 dnf install https://packages.icinga.com/fedora/icinga-rpm-release-27-latest.noarch.rpm
78 dnf install https://packages.icinga.com/fedora/icinga-rpm-release-26-latest.noarch.rpm
84 zypper ar https://packages.icinga.com/SUSE/ICINGA-release.repo
91 zypper ar https://packages.icinga.com/SUSE/ICINGA-release-11.repo
98 zypper ar https://packages.icinga.com/openSUSE/ICINGA-release.repo
105 echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
106 echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
110 #### RHEL/CentOS EPEL Repository <a id="package-repositories-rhel-epel"></a>
112 The packages for RHEL/CentOS depend on other packages which are distributed
113 as part of the [EPEL repository](https://fedoraproject.org/wiki/EPEL).
118 yum install epel-release
121 If you are using RHEL you need to enable the `optional` repository and then install
122 the [EPEL rpm package](https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F).
125 subscription-manager repos --enable rhel-7-server-optional-rpms
127 subscription-manager repos --enable rhel-6-server-optional-rpms
130 #### SLES Security Repository <a id="package-repositories-sles-security"></a>
132 The packages for SLES 11 depend on the `openssl1` package which is distributed
133 as part of the [SLES 11 Security Module](https://www.suse.com/communities/conversations/introducing-the-suse-linux-enterprise-11-security-module/).
135 #### SLES 12 SDK <a id="package-sles-sdk"></a>
137 Icinga 2 requires the `libboost_chrono1_54_0` package from the `SLES 12 SDK` repository. Refer to the SUSE Enterprise
138 Linux documentation for further information.
140 #### Alpine Linux Notes <a id="package-repositories-alpine-notes"></a>
142 The example provided assumes that you are running Alpine edge, which is the -dev branch and is a rolling release.
143 If you are using a stable version please "pin" the edge repository on the latest Icinga 2 package version.
144 In order to correctly manage your repository, please follow
145 [these instructions](https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management)
147 ### Installing Icinga 2 <a id="installing-icinga2"></a>
149 You can install Icinga 2 by using your distribution's package manager
150 to install the `icinga2` package. The following commands must be executed
151 with `root` permissions unless noted otherwise.
156 apt-get install icinga2
164 service icinga2 start
167 RHEL/CentOS 7 and Fedora:
171 systemctl enable icinga2
172 systemctl start icinga2
178 zypper install icinga2
193 ### Enabled Features during Installation <a id="installation-enabled-features"></a>
195 The default installation will enable three features required for a basic
196 Icinga 2 installation:
198 * `checker` for executing checks
199 * `notification` for sending notifications
200 * `mainlog` for writing the `icinga2.log` file
202 You can verify that by calling `icinga2 feature list`
203 [CLI command](11-cli-commands.md#cli-command-feature) to see which features are
204 enabled and disabled.
207 # icinga2 feature list
208 Disabled features: api command compatlog debuglog gelf graphite icingastatus ido-mysql ido-pgsql influxdb livestatus opentsdb perfdata statusdata syslog
209 Enabled features: checker mainlog notification
212 ### Installation Paths <a id="installation-paths"></a>
214 By default Icinga 2 uses the following files and directories:
217 ----------------------------------------------|------------------------------------
218 /etc/icinga2 | Contains Icinga 2 configuration files.
219 /usr/lib/systemd/system/icinga2.service | The Icinga 2 systemd service file on systems using systemd.
220 /etc/systemd/system/icinga2.service.d/limits.conf | On distributions with systemd >227, additional service limits are required.
221 /etc/init.d/icinga2 | The Icinga 2 init script on systems using SysVinit or OpenRC.
222 /usr/sbin/icinga2 | Shell wrapper for the Icinga 2 binary.
223 /usr/lib\*/icinga2 | Libraries and the Icinga 2 binary (use `find /usr -type f -name icinga2` to locate the binary path).
224 /usr/share/doc/icinga2 | Documentation files that come with Icinga 2.
225 /usr/share/icinga2/include | The Icinga Template Library and plugin command configuration.
226 /var/lib/icinga2 | Icinga 2 state file, cluster log, master CA, node certificates and configuration files (cluster, api).
227 /var/run/icinga2 | PID file.
228 /var/run/icinga2/cmd | Command pipe and Livestatus socket.
229 /var/cache/icinga2 | status.dat/objects.cache, icinga2.debug files.
230 /var/spool/icinga2 | Used for performance data spool files.
231 /var/log/icinga2 | Log file location and compat/ directory for the CompatLogger feature.
233 FreeBSD uses slightly different paths:
235 By default Icinga 2 uses the following files and directories:
238 ------------------------------------|------------------------------------
239 /usr/local/etc/icinga2 | Contains Icinga 2 configuration files.
240 /usr/local/etc/rc.d/icinga2 | The Icinga 2 init script.
241 /usr/local/sbin/icinga2 | Shell wrapper for the Icinga 2 binary.
242 /usr/local/lib/icinga2 | Libraries and the Icinga 2 binary.
243 /usr/local/share/doc/icinga2 | Documentation files that come with Icinga 2.
244 /usr/local/share/icinga2/include | The Icinga Template Library and plugin command configuration.
245 /var/lib/icinga2 | Icinga 2 state file, cluster log, master CA, node certificates and configuration files (cluster, api).
246 /var/run/icinga2 | PID file.
247 /var/run/icinga2/cmd | Command pipe and Livestatus socket.
248 /var/cache/icinga2 | status.dat/objects.cache, icinga2.debug files.
249 /var/spool/icinga2 | Used for performance data spool files.
250 /var/log/icinga2 | Log file location and compat/ directory for the CompatLogger feature.
252 ## Setting up Check Plugins <a id="setting-up-check-plugins"></a>
254 Without plugins Icinga 2 does not know how to check external services. The
255 [Monitoring Plugins Project](https://www.monitoring-plugins.org/) provides
256 an extensive set of plugins which can be used with Icinga 2 to check whether
257 services are working properly.
259 These plugins are required to make the [example configuration](04-configuring-icinga-2.md#configuring-icinga2-overview)
262 For your convenience here is a list of package names for some of the more
263 popular operating systems/distributions:
265 OS/Distribution | Package Name | Repository | Installation Path
266 -----------------------|--------------------|---------------------------|----------------------------
267 RHEL/CentOS | nagios-plugins-all | [EPEL](https://fedoraproject.org/wiki/EPEL) |Â /usr/lib/nagios/plugins or /usr/lib64/nagios/plugins
268 SLES/OpenSUSE | monitoring-plugins | [server:monitoring](https://build.opensuse.org/project/repositories/server:monitoring) | /usr/lib/nagios/plugins
269 Debian/Ubuntu | monitoring-plugins | - |Â /usr/lib/nagios/plugins
270 FreeBSD | monitoring-plugins | - |Â /usr/local/libexec/nagios
271 Alpine Linux | monitoring-plugins | - |Â /usr/lib/monitoring-plugins
272 OS X | nagios-plugins | [MacPorts](https://www.macports.org), [Homebrew](https://brew.sh) | /opt/local/libexec or /usr/local/sbin
274 The recommended way of installing these standard plugins is to use your
275 distribution's package manager.
280 apt-get install monitoring-plugins
286 yum install nagios-plugins-all
289 The packages for RHEL/CentOS depend on other packages which are distributed
290 as part of the [EPEL repository](https://fedoraproject.org/wiki/EPEL). Please
291 make sure to enable this repository by following
292 [these instructions](https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F).
297 dnf install nagios-plugins-all
303 zypper install monitoring-plugins
306 The packages for SLES/OpenSUSE depend on other packages which are distributed
307 as part of the [server:monitoring repository](https://build.opensuse.org/project/repositories/server:monitoring).
308 Please make sure to enable this repository beforehand.
313 pkg install monitoring-plugins
319 apk add monitoring-plugins
322 Note: For Alpine you don't need to explicitly add the `monitoring-plugins` package since it is a dependency of
323 `icinga2` and is pulled automatically.
325 Depending on which directory your plugins are installed into you may need to
326 update the global `PluginDir` constant in your [Icinga 2 configuration](04-configuring-icinga-2.md#constants-conf).
327 This constant is used by the check command definitions contained in the Icinga Template Library
328 to determine where to find the plugin binaries.
332 > Please refer to the [service monitoring](05-service-monitoring.md#service-monitoring-plugins) chapter for details about how to integrate
333 > additional check plugins into your Icinga 2 setup.
335 ## Running Icinga 2 <a id="running-icinga2"></a>
337 ### Systemd Service <a id="systemd-service"></a>
339 Some distributions (e.g. Fedora, openSUSE and RHEL/CentOS 7) use systemd. The
340 Icinga 2 packages automatically install the necessary systemd unit files.
342 The Icinga 2 systemd service can be (re-)started, reloaded, stopped and also
343 queried for its current status.
346 # systemctl status icinga2
347 icinga2.service - Icinga host/service/network monitoring system
348 Loaded: loaded (/usr/lib/systemd/system/icinga2.service; disabled)
349 Active: active (running) since Mi 2014-07-23 13:39:38 CEST; 15s ago
350 Process: 21692 ExecStart=/usr/sbin/icinga2 -c ${ICINGA2_CONFIG_FILE} -d -e ${ICINGA2_ERROR_LOG} -u ${ICINGA2_USER} -g ${ICINGA2_GROUP} (code=exited, status=0/SUCCESS)
351 Process: 21674 ExecStartPre=/usr/sbin/icinga2-prepare-dirs /etc/sysconfig/icinga2 (code=exited, status=0/SUCCESS)
352 Main PID: 21727 (icinga2)
353 CGroup: /system.slice/icinga2.service
354 21727 /usr/sbin/icinga2 -c /etc/icinga2/icinga2.conf -d -e /var/log/icinga2/error.log -u icinga -g icinga --no-stack-rlimit
356 Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 309 Service(s).
357 Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 User(s).
358 Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 15 Notification(s).
359 Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 4 ScheduledDowntime(s).
360 Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 UserGroup(s).
361 Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 1 IcingaApplication(s).
362 Jul 23 13:39:38 nbmif icinga2[21692]: [2014-07-23 13:39:38 +0200] information/ConfigItem: Checked 8 Dependency(s).
363 Jul 23 13:39:38 nbmif systemd[1]: Started Icinga host/service/network monitoring system.
366 The `systemctl` command supports the following actions:
368 Command | Description
369 --------------------|------------------------
370 start | The `start` action starts the Icinga 2 daemon.
371 stop | The `stop` action stops the Icinga 2 daemon.
372 restart | The `restart` action is a shortcut for running the `stop` action followed by `start`.
373 reload | The `reload` action sends the `HUP` signal to Icinga 2 which causes it to restart. Unlike the `restart` action `reload` does not wait until Icinga 2 has restarted.
374 status | The `status` action checks if Icinga 2 is running.
375 enable | The `enable` action enables the service being started at system boot time (similar to `chkconfig`)
380 # systemctl enable icinga2
382 # systemctl restart icinga2
383 Job for icinga2.service failed. See 'systemctl status icinga2.service' and 'journalctl -xn' for details.
386 If you're stuck with configuration errors, you can manually invoke the
387 [configuration validation](11-cli-commands.md#config-validation).
391 > If you are running into fork errors with systemd enabled distributions,
392 > please check the [troubleshooting chapter](15-troubleshooting.md#check-fork-errors).
394 ### Init Script <a id="init-script"></a>
396 Icinga 2's init script is installed in `/etc/init.d/icinga2` (`/usr/local/etc/rc.d/icinga2` on FreeBSD) by default:
399 # /etc/init.d/icinga2
400 Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status}
403 The init script supports the following actions:
405 Command | Description
406 --------------------|------------------------
407 start | The `start` action starts the Icinga 2 daemon.
408 stop | The `stop` action stops the Icinga 2 daemon.
409 restart | The `restart` action is a shortcut for running the `stop` action followed by `start`.
410 reload | The `reload` action sends the `HUP` signal to Icinga 2 which causes it to restart. Unlike the `restart` action `reload` does not wait until Icinga 2 has restarted.
411 checkconfig | The `checkconfig` action checks if the `/etc/icinga2/icinga2.conf` configuration file contains any errors.
412 status | The `status` action checks if Icinga 2 is running.
414 By default, the Icinga 2 daemon is running as `icinga` user and group
415 using the init script. Using Debian packages the user and group are set to
416 `nagios` for historical reasons.
419 ### FreeBSD <a id="running-icinga2-freebsd"></a>
421 On FreeBSD you need to enable icinga2 in your rc.conf
424 # sysrc icinga2_enable=yes
426 # service icinga2 restart
429 ### SELinux <a id="running-icinga2-selinux"></a>
431 SELinux is a mandatory access control (MAC) system on Linux which adds
432 a fine-grained permission system for access to all system resources such
433 as files, devices, networks and inter-process communication.
435 Icinga 2 provides its own SELinux policy. `icinga2-selinux` is a policy package
436 for Red Hat Enterprise Linux 7 and derivatives. The package runs the targeted policy
437 which confines Icinga 2 including enabled features and running commands.
442 yum install icinga2-selinux
448 dnf install icinga2-selinux
451 Read more about SELinux in [this chapter](22-selinux.md#selinux).
453 ## Configuration Syntax Highlighting <a id="configuration-syntax-highlighting"></a>
455 Icinga 2 provides configuration examples for syntax highlighting using the `vim` and `nano` editors.
456 The RHEL and SUSE package `icinga2-common` installs these files into `/usr/share/doc/icinga2-common-[x.x.x]/syntax`
457 (where `[x.x.x]` is the version number, e.g. `2.4.3` or `2.4.4`). Sources provide these files in `tools/syntax`.
458 On Debian systems the `icinga2-common` package provides only the Nano configuration file (`/usr/share/nano/icinga2.nanorc`);
459 to obtain the Vim configuration, please install the extra package `vim-icinga2`. The files are located in `/usr/share/vim/addons`.
461 ### Configuration Syntax Highlighting using Vim <a id="configuration-syntax-highlighting-vim"></a>
463 Install the package `vim-icinga2` with your distribution's package manager.
468 apt-get install vim-icinga2 vim-addon-manager
469 vim-addon-manager -w install icinga2
470 Info: installing removed addon 'icinga2' to /var/lib/vim/addons
476 yum install vim-icinga2
482 zypper install vim-icinga2
490 Ensure that syntax highlighting is enabled e.g. by editing the user's `vimrc`
501 # vim /etc/icinga2/conf.d/templates.conf
504 ![Vim with syntax highlighting](images/getting-started/vim-syntax.png "Vim with Icinga 2 syntax highlighting")
507 ### Configuration Syntax Highlighting using Nano <a id="configuration-syntax-highlighting-nano"></a>
509 Install the package `nano-icinga2` with your distribution's package manager.
513 **Note:** The syntax files are installed with the `icinga2-common` package already.
518 yum install nano-icinga2
524 zypper install nano-icinga2
527 Copy the `/etc/nanorc` sample file to your home directory.
530 $ cp /etc/nanorc ~/.nanorc
533 Include the `icinga2.nanorc` file.
539 include "/usr/share/nano/icinga2.nanorc"
545 $ nano /etc/icinga2/conf.d/templates.conf
548 ![Nano with syntax highlighting](images/getting-started/nano-syntax.png "Nano with Icinga 2 syntax highlighting")
550 ## Setting up Icinga Web 2 <a id="setting-up-icingaweb2"></a>
552 Icinga 2 can be used with Icinga Web 2 and a variety of modules.
553 This chapter explains how to set up Icinga Web 2.
555 The DB IDO (Database Icinga Data Output) feature for Icinga 2 take care of
556 exporting all configuration and status information into a database.
558 Please choose whether to install [MySQL](02-getting-started.md#configuring-db-ido-mysql) or
559 [PostgreSQL](02-getting-started.md#configuring-db-ido-postgresql).
561 ### Configuring DB IDO MySQL <a id="configuring-db-ido-mysql"></a>
563 #### Installing MySQL database server <a id="installing-database-mysql-server"></a>
568 apt-get install mysql-server mysql-client
570 mysql_secure_installation
573 RHEL/CentOS 7 and Fedora:
576 yum install mariadb-server mariadb
577 systemctl enable mariadb
578 systemctl start mariadb
579 mysql_secure_installation
585 yum install mysql-server mysql
589 mysql_secure_installation
595 zypper install mysql mysql-client
603 pkg install mysql56-server
604 sysrc mysql_enable=yes
605 service mysql-server restart
606 mysql_secure_installation
613 rc-service mariadb setup
614 rc-update add mariadb default
615 rc-service mariadb start
618 #### Installing the IDO modules for MySQL <a id="installing-database-mysql-modules"></a>
620 The next step is to install the `icinga2-ido-mysql` package using your
621 distribution's package manager.
626 apt-get install icinga2-ido-mysql
632 yum install icinga2-ido-mysql
638 zypper install icinga2-ido-mysql
643 On FreeBSD the IDO modules for MySQL are included with the icinga2 package
644 and located at `/usr/local/share/icinga2-ido-mysql/schema/mysql.sql`.
648 On Alpine Linux the IDO modules for MySQL are included with the `icinga2` package
649 and located at `/usr/share/icinga2-ido-mysql/schema/mysql.sql`.
653 > The Debian/Ubuntu packages provide a database configuration wizard by
654 > default. You can skip the automated setup and install/upgrade the
655 > database manually if you prefer.
657 #### Setting up the MySQL database <a id="setting-up-mysql-db"></a>
659 Set up a MySQL database for Icinga 2:
664 CREATE DATABASE icinga;
665 GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
669 ![setting up the database on CentOS 7](images/getting-started/mariadb-centos7.png "Setting up the database on CentOS 7")
671 After creating the database you can import the Icinga 2 IDO schema using the
672 following command. Enter the root password into the prompt when asked.
675 mysql -u root -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql
678 #### Enabling the IDO MySQL module <a id="enabling-ido-mysql"></a>
680 The package provides a new configuration file that is installed in
681 `/etc/icinga2/features-available/ido-mysql.conf`. You can update
682 the database credentials in this file.
684 All available attributes are explained in the
685 [IdoMysqlConnection object](09-object-types.md#objecttype-idomysqlconnection)
688 You can enable the `ido-mysql` feature configuration file using
689 `icinga2 feature enable`:
692 # icinga2 feature enable ido-mysql
693 Module 'ido-mysql' was enabled.
694 Make sure to restart Icinga 2 for these changes to take effect.
700 systemctl restart icinga2
706 rc-service icinga2 restart
709 Continue with the [webserver setup](02-getting-started.md#icinga2-user-interface-webserver).
711 ### Configuring DB IDO PostgreSQL <a id="configuring-db-ido-postgresql"></a>
713 #### Installing PostgreSQL database server <a id="installing-database-postgresql-server"></a>
718 apt-get install postgresql
724 yum install postgresql-server postgresql
725 chkconfig postgresql on
726 service postgresql initdb
727 service postgresql start
733 yum install postgresql-server postgresql
734 postgresql-setup initdb
735 systemctl enable postgresql
736 systemctl start postgresql
742 zypper install postgresql postgresql-server
743 chkconfig postgresql on
744 service postgresql initdb
745 service postgresql start
751 pkg install postgresql93-server
752 sysrc postgresql_enable=yes
753 service postgresql initdb
754 service postgresql start
761 rc-update add postgresql default
762 rc-service postgresql setup
763 rc-service postgresql start
766 #### Installing the IDO modules for PostgreSQL <a id="installing-database-postgresql-modules"></a>
768 The next step is to install the `icinga2-ido-pgsql` package using your
769 distribution's package manager.
774 apt-get install icinga2-ido-pgsql
780 yum install icinga2-ido-pgsql
786 zypper install icinga2-ido-pgsql
791 On FreeBSD the IDO modules for PostgreSQL are included with the icinga2 package
792 and located at `/usr/local/share/icinga2-ido-pgsql/schema/pgsql.sql`.
796 On Alpine Linux the IDO modules for PostgreSQL are included with the `icinga2` package
797 and located at `/usr/share/icinga2-ido-pgsql/schema/pgsql.sql`.
801 > Upstream Debian packages provide a database configuration wizard by default.
802 > You can skip the automated setup and install/upgrade the database manually
803 > if you prefer that.
805 #### Setting up the PostgreSQL database
807 Set up a PostgreSQL database for Icinga 2:
811 sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD 'icinga'"
812 sudo -u postgres createdb -O icinga -E UTF8 icinga
817 > It is assumed here that your locale is set to utf-8, you may run into problems otherwise.
819 Locate your `pg_hba.conf` configuration file (Debian: `/etc/postgresql/*/main/pg_hba.conf`,
820 RHEL/SUSE: `/var/lib/pgsql/data/pg_hba.conf`), add the icinga user with `md5`
821 as authentication method and restart the postgresql server.
825 local icinga icinga md5
826 host icinga icinga 127.0.0.1/32 md5
827 host icinga icinga ::1/128 md5
829 # "local" is for Unix domain socket connections only
831 # IPv4 local connections:
832 host all all 127.0.0.1/32 ident
833 # IPv6 local connections:
834 host all all ::1/128 ident
838 systemctl restart postgresql
842 After creating the database and permissions you need to import the IDO database
843 schema using the following command:
846 export PGPASSWORD=icinga
847 psql -U icinga -d icinga < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql
850 ![importing the Icinga 2 IDO schema](images/getting-started/postgr-import-ido.png "Importing the Icinga 2 IDO schema on Debian Jessie")
853 #### Enabling the IDO PostgreSQL module <a id="enabling-ido-postgresql"></a>
855 The package provides a new configuration file that is installed in
856 `/etc/icinga2/features-available/ido-pgsql.conf`. You can update
857 the database credentials in this file.
859 All available attributes are explained in the
860 [IdoPgsqlConnection object](09-object-types.md#objecttype-idopgsqlconnection)
863 You can enable the `ido-pgsql` feature configuration file using
864 `icinga2 feature enable`:
867 # icinga2 feature enable ido-pgsql
868 Module 'ido-pgsql' was enabled.
869 Make sure to restart Icinga 2 for these changes to take effect.
875 systemctl restart icinga2
881 rc-service icinga2 restart
884 Continue with the [webserver setup](02-getting-started.md#icinga2-user-interface-webserver).
886 ### Webserver <a id="icinga2-user-interface-webserver"></a>
888 The preferred way of installing Icinga Web 2 is to use Apache as webserver
889 in combination with PHP-FPM. If you prefer Nginx, please refer to the Icinga Web 2
895 apt-get install apache2
898 RHEL/CentOS 7, Fedora:
902 systemctl enable httpd
903 systemctl start httpd
917 zypper install apache2
919 service apache2 start
922 FreeBSD (Nginx, but you could also use the `apache24` package):
925 pkg install nginx php56-gettext php56-ldap php56-openssl php56-mysql php56-pdo_mysql php56-pgsql php56-pdo_pgsql php56-sockets php56-gd pecl-imagick pecl-intl
926 sysrc php_fpm_enable=yes
927 sysrc nginx_enable=yes
928 sed -i '' "s/listen\ =\ 127.0.0.1:9000/listen\ =\ \/var\/run\/php5-fpm.sock/" /usr/local/etc/php-fpm.conf
929 sed -i '' "s/;listen.owner/listen.owner/" /usr/local/etc/php-fpm.conf
930 sed -i '' "s/;listen.group/listen.group/" /usr/local/etc/php-fpm.conf
931 sed -i '' "s/;listen.mode/listen.mode/" /usr/local/etc/php-fpm.conf
932 service php-fpm start
939 apk add apache2 php7-apache2
940 sed -i -e "s/^#LoadModule rewrite_module/LoadModule rewrite_module/" /etc/apache2/httpd.conf
941 rc-update add apache2 default
942 rc-service apache2 start
945 ### Firewall Rules <a id="icinga2-user-interface-firewall-rules"></a>
947 Enable port 80 (http). Best practice is to only enable port 443 (https) and use TLS certificates.
952 firewall-cmd --add-service=http
953 firewall-cmd --permanent --add-service=http
959 iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
960 service iptables save
964 Please consult the [FreeBSD Handbook](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls.html) how to configure one of FreeBSD's firewalls.
967 ### Setting Up Icinga 2 REST API <a id="setting-up-rest-api"></a>
969 Icinga Web 2 and other web interfaces require the [REST API](12-icinga2-api.md#icinga2-api-setup)
970 to send actions (reschedule check, etc.) and query object details.
972 You can run the CLI command `icinga2 api setup` to enable the
973 `api` [feature](11-cli-commands.md#enable-features) and set up
974 certificates as well as a new API user `root` with an auto-generated password in the
975 `/etc/icinga2/conf.d/api-users.conf` configuration file:
981 Edit the `api-users.conf` file and add a new ApiUser object. Specify the [permissions](12-icinga2-api.md#icinga2-api-permissions)
982 attribute with minimal permissions required by Icinga Web 2.
985 vim /etc/icinga2/conf.d/api-users.conf
987 object ApiUser "icingaweb2" {
988 password = "Wijsn8Z9eRs5E25d"
989 permissions = [ "status/query", "actions/*", "objects/modify/*", "objects/query/*" ]
993 Restart Icinga 2 to activate the configuration.
996 systemctl restart icinga2
1002 rc-service icinga2 restart
1005 ### Installing Icinga Web 2 <a id="installing-icingaweb2"></a>
1007 Please consult the [installation documentation](https://icinga.com/docs/icingaweb2/latest/doc/02-Installation/)
1008 for further instructions on how to install Icinga Web 2.
1010 The Icinga 2 API can be defined as [command transport](https://icinga.com/docs/icingaweb2/latest/modules/monitoring/doc/05-Command-Transports/)
1011 in Icinga Web 2 >= 2.4.
1013 ## Addons <a id="install-addons"></a>
1015 A number of additional features are available in the form of addons. A list of
1016 popular addons is available in the
1017 [Addons and Plugins](13-addons.md#addons) chapter.
1019 ## Backup <a id="install-backup"></a>
1021 Ensure to include the following in your backups:
1023 * Configuration files in `/etc/icinga2`
1024 * Certificate files in `/var/lib/icinga2/ca` (Master CA key pair) and `/var/lib/icinga2/certs` (node certificates)
1025 * Runtime files in `/var/lib/icinga2`
1026 * Optional: IDO database backup
1028 ## Backup: Database <a id="install-backup-database"></a>
1032 * [Documentation](https://mariadb.com/kb/en/library/backup-and-restore-overview/)
1036 * [Documentation](https://www.postgresql.org/docs/9.3/static/backup.html)