Install Icinga Web 2 from Source¶
Although the preferred way of installing Icinga Web 2 is to use packages, it is also possible to install Icinga Web 2 directly from source.
Getting the Source ¶
First of all, you need to download the sources.
Git clone:
cd /usr/share/
git clone https://github.com/Icinga/icingaweb2.git icingaweb2
Tarball download (latest release):
cd /usr/share
wget https://github.com/Icinga/icingaweb2/archive/v2.9.5.zip
unzip v2.9.5.zip
mv icingaweb2-2.9.5 icingaweb2
Installing Requirements from Source ¶
You will need to install certain dependencies depending on your setup:
- Icinga 2 and Icinga DB to monitor your infrastructure
- A web server, e.g. Apache or Nginx
- PHP version ≥ 7.2
- Icinga PHP Library (ipl) (≥ 0.9)
- Icinga PHP Thirdparty (≥ 0.11)
- The following PHP modules must be installed: cURL, json, gettext, fileinfo, intl, dom, OpenSSL and xml
- The pdfexport module (≥0.10) is required for the export to PDF
- LDAP PHP library when using Active Directory or LDAP for authentication
- MySQL or PostgreSQL PHP libraries
The following example installs Apache2 as web server, MySQL as RDBMS and uses the PHP adapter for MySQL. Adopt the package requirements to your needs (e.g. adding ldap for authentication) and distribution.
Example for RHEL/CentOS/Fedora:
yum install httpd mysql-server
yum install php php-gd php-intl
The setup wizard will check the pre-requisites later on.
Installing Icinga Web 2 ¶
Choose a target directory and move Icinga Web 2 there.
mv icingaweb2 /usr/share/icingaweb2
Configuring the Web Server ¶
Use icingacli
to generate web server configuration for either Apache or nginx.
Apache:
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public
nginx:
./bin/icingacli setup config webserver nginx --document-root /usr/share/icingaweb2/public
Save the output as new file in your webserver’s configuration directory.
Example for Apache on RHEL or CentOS:
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public > /etc/httpd/conf.d/icingaweb2.conf
Example for Apache on SUSE:
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public > /etc/apache2/conf.d/icingaweb2.conf
Example for Apache on Debian Jessie:
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb2/public > /etc/apache2/conf-available/icingaweb2.conf
a2enconf icingaweb2
Example for Apache on Alpine Linux:
icingacli setup config webserver apache --document-root /usr/share/webapps/icingaweb2/public > /etc/apache2/conf.d/icingaweb2.conf
Preparing Icinga Web 2 Setup ¶
You can set up Icinga Web 2 quickly and easily with the Icinga Web 2 setup wizard which is available the first time you visit Icinga Web 2 in your browser. Please follow the steps listed below for preparing the web setup.
Because both web and CLI must have access to configuration and logs, permissions will be managed using a special system group. The web server user and CLI user have to be added to this system group.
Add the system group icingaweb2
in the first place.
Fedora, RHEL, CentOS, SLES and OpenSUSE:
groupadd -r icingaweb2
Debian and Ubuntu:
addgroup --system icingaweb2
Add your web server’s user to the system group icingaweb2
and restart the web server:
Fedora, RHEL and CentOS:
usermod -a -G icingaweb2 apache
service httpd restart
SLES and OpenSUSE:
usermod -A icingaweb2 wwwrun
service apache2 restart
Debian and Ubuntu:
usermod -a -G icingaweb2 www-data
service apache2 restart
Alpine Linux:
gpasswd -a apache icingaweb2
rc-service apache2 restart
Use icingacli
to create the configuration directory which defaults to /etc/icingaweb2:
./bin/icingacli setup config directory
When using the web setup you are required to authenticate using a token. In order to generate a token use the
icingacli
:
./bin/icingacli setup token create
In case you do not remember the token you can show it using the icingacli
:
./bin/icingacli setup token show
Icinga Web 2 Setup Wizard ¶
Finally visit Icinga Web 2 in your browser to access the setup wizard and complete the installation:
/icingaweb2/setup
.
Paste the previously generated token and follow the steps on-screen. Then you are done here.
If you prefer to set up the configuration manually, follow the Icinga Web 2 Manual Configuration instructions