diff --git a/INSTALL.md b/INSTALL.md index 310c262ba..dfe7c9ea7 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -27,23 +27,23 @@ parentheses): * cmake >= 2.6 * GNU make (make) -* C++ compiler which supports C++11 (gcc-c++ >= 4.7 on RHEL/SUSE, build-essential on Debian, alternatively clang++) +* C++ compiler which supports C++11 (gcc-c++ >= 4.7 on RHEL/SUSE, build-essential on Debian, alternatively clang++, build-base on Alpine) * RedHat Developer Tools on RHEL5/6 (details on building below) * pkg-config * OpenSSL library and header files >= 0.9.8 (openssl-devel on RHEL, libopenssl1-devel on SLES11, -libopenssl-devel on SLES12, libssl-dev on Debian) -* Boost library and header files >= 1.48.0 (boost148-devel on EPEL for RHEL / CentOS, libboost-all-dev on Debian) +libopenssl-devel on SLES12, libssl-dev on Debian, libressl-dev on Alpine) +* Boost library and header files >= 1.48.0 (boost148-devel on EPEL for RHEL / CentOS, libboost-all-dev on Debian, boost-dev on Alpine) * GNU bison (bison) * GNU flex (flex) >= 2.5.35 * recommended: libexecinfo on FreeBSD (automatically used when Icinga 2 is installed via port or package) -* optional: MySQL (mysql-devel on RHEL, libmysqlclient-devel on SUSE, libmysqlclient-dev on Debian); +* optional: MySQL (mysql-devel on RHEL, libmysqlclient-devel on SUSE, libmysqlclient-dev on Debian, mariadb-dev on Alpine); set CMake variable `ICINGA2_WITH_MYSQL` to `OFF` to disable this module -* optional: PostgreSQL (postgresql-devel on RHEL, libpq-dev on Debian); set CMake +* optional: PostgreSQL (postgresql-devel on RHEL, libpq-dev on Debian, postgresql-dev on Alpine); set CMake variable `ICINGA2_WITH_PGSQL` to `OFF` to disable this module -* optional: YAJL (yajl-devel on RHEL, libyajl-dev on Debian) +* optional: YAJL (yajl-devel on RHEL, libyajl-dev on Debian, yajl-dev on Alpine) * optional: libedit (libedit-devel on CentOS (RHEL requires rhel-7-server-optional-rpms - repository for el7 e.g.), libedit-dev on Debian) + repository for el7 e.g.), libedit-dev on Debian and Alpine) * optional: Termcap (libtermcap-devel on RHEL, not necessary on Debian) - only required if libedit doesn't already link against termcap/ncurses * optional: libwxgtk2.8-dev or newer (wxGTK-devel and wxBase) - only required when building the Icinga 2 Studio @@ -65,6 +65,13 @@ using the `ICINGA2_USER`, `ICINGA2_GROUP` and `ICINGA2_COMMAND_GROUP` variables. # groupadd icingacmd # useradd -c "icinga" -s /sbin/nologin -G icingacmd -g icinga icinga +On Alpine (which uses ash busybox) you can run: + + # addgroup -S icinga + # addgroup -S icingacmd + # adduser -S -D -H -h /var/spool/icinga2 -s /sbin/nologin -G icinga -g icinga icinga + # adduser icinga icingacmd + Add the web server user to the icingacmd group in order to grant it write permissions to the external command pipe and livestatus socket: @@ -234,6 +241,18 @@ into your source tree and run the following command: $ dpkg-buildpackage -uc -us + +## Build Alpine Linux packages + +A simple way to setup a build environment is installing Alpine in a chroot. +In this way, you can set up an Alpine build environment in a chroot under a +different Linux distro. +There is a script that simplifies these steps with just two commands, and +can be found [here](https://github.com/alpinelinux/alpine-chroot-install). + +Once the build environment is installed, you can setup the system to build +the packages by following [this document](https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package). + ## Build Post Install Tasks After building Icinga 2 yourself, your package build system should at least run the following post @@ -258,10 +277,23 @@ Icinga 2 can be started as a daemon using the provided init script: # /etc/init.d/icinga2 Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status} -Or if your distribution uses systemd: +If your distribution uses systemd: # systemctl {start|stop|reload|status|enable|disable} icinga2 +Or if your distribution uses openrc (like Alpine): + + # rc-service icinga2 + Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status} + +Note: the openrc's init.d is not shipped by default. +A working init.d with openrc can be found here: (https://git.alpinelinux.org/cgit/aports/plain/community/icinga2/icinga2.initd). If you have customized some path, edit the file and adjust it according with your setup. +Those few steps can be followed: + + # wget https://git.alpinelinux.org/cgit/aports/plain/community/icinga2/icinga2.initd + # mv icinga2.initd /etc/init.d/icinga2 + # chmod +x /etc/init.d/icinga2 + Icinga 2 reads a single configuration file which is used to specify all configuration settings (global settings, hosts, services, etc.). The configuration format is explained in detail in the [doc/](doc/) directory. diff --git a/doc/02-getting-started.md b/doc/02-getting-started.md index 7b98683ba..2529726c3 100644 --- a/doc/02-getting-started.md +++ b/doc/02-getting-started.md @@ -21,7 +21,7 @@ and distribution you are running. FreeBSD | [Upstream](https://www.freshports.org/net-mgmt/icinga2) OpenBSD | [Upstream](http://ports.su/net/icinga/core2,-main) ArchLinux | [Upstream](https://aur.archlinux.org/packages/icinga2) - AlpineLinux | [Upstream](https://pkgs.alpinelinux.org/package/edge/community/x86_64/icinga2) + Alpine Linux | [Upstream](https://pkgs.alpinelinux.org/package/edge/community/x86_64/icinga2) Packages for distributions other than the ones listed above may also be available. Please contact your distribution packagers. @@ -75,6 +75,11 @@ openSUSE: # zypper ref +Alpine Linux: + + # echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories + # apk update + #### RHEL/CentOS EPEL Repository The packages for RHEL/CentOS depend on other packages which are distributed @@ -97,6 +102,13 @@ as part of the [SLES 11 Security Module](https://www.suse.com/communities/conver Icinga 2 requires the `libboost_chrono1_54_0` package from the `SLES 12 SDK` repository. Refer to the SUSE Enterprise Linux documentation for further information. +#### Alpine Linux Notes + +The example provided suppose that you are running Alpine edge, which is the -dev branch and is a rolling release. +If you are using a stable version please "pin" the edge repository on the latest Icinga 2 package version. +In order to correctly manage your repository, please follow +[these instructions](https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management) + ### Installing Icinga 2 You can install Icinga 2 by using your distribution's package manager @@ -126,6 +138,11 @@ FreeBSD: # pkg install icinga2 + +Alpine Linux: + + # apk add icinga2 + ### Enabled Features during Installation The default installation will enable three features required for a basic @@ -152,7 +169,7 @@ By default Icinga 2 uses the following files and directories: ----------------------------------------------|------------------------------------ /etc/icinga2 | Contains Icinga 2 configuration files. /usr/lib/systemd/system/icinga2.service | The Icinga 2 Systemd service file on systems using Systemd. - /etc/init.d/icinga2 | The Icinga 2 init script on systems using SysVinit. + /etc/init.d/icinga2 | The Icinga 2 init script on systems using SysVinit or OpenRC /usr/sbin/icinga2 | Shell wrapper for the Icinga 2 binary. /usr/lib\*/icinga2 | Libraries and the Icinga 2 binary (use `find /usr -type f -name icinga2` to locate the binary path). /usr/share/doc/icinga2 | Documentation files that come with Icinga 2. @@ -202,6 +219,7 @@ RHEL/CentOS | nagios-plugins-all | [EPEL](https://fedoraproject.org/w SLES/OpenSUSE | monitoring-plugins | [server:monitoring](https://build.opensuse.org/project/repositories/server:monitoring) | /usr/lib/nagios/plugins Debian/Ubuntu | monitoring-plugins | - | /usr/lib/nagios/plugins FreeBSD | monitoring-plugins | - | /usr/local/libexec/nagios +Alpine Linux | monitoring-plugins | - | /usr/lib/monitoring-plugins OS X | nagios-plugins | [MacPorts](https://www.macports.org), [Homebrew](https://brew.sh) | /opt/local/libexec or /usr/local/sbin The recommended way of installing these standard plugins is to use your @@ -236,6 +254,13 @@ FreeBSD: # pkg install monitoring-plugins +Alpine Linux: + + # apk add monitoring-plugins + +Note: For Alpine you don't need to explicitly add the `monitoring-plugins` package since it is a dependency of +`icinga2` and is pulled automatically. + Depending on which directory your plugins are installed into you may need to update the global `PluginDir` constant in your [Icinga 2 configuration](04-configuring-icinga-2.md#constants-conf). This constant is used by the check command definitions contained in the Icinga Template Library @@ -352,6 +377,10 @@ SLES/openSUSE: $ zypper install vim-icinga2 +Alpine Linux: + + # apk add icinga2-vim + Ensure that syntax highlighting is enabled e.g. by editing the user's `vimrc` configuration file: @@ -451,6 +480,13 @@ FreeBSD: # service mysql-server restart # mysql_secure_installation +Alpine Linux: + + # apk add mariadb + # rc-service mariadb setup + # rc-update add mariadb default + # rc-service mariadb start + #### Installing the IDO modules for MySQL The next step is to install the `icinga2-ido-mysql` package using your @@ -473,6 +509,11 @@ FreeBSD: On FreeBSD the IDO modules for MySQL are included with the icinga2 package and located at /usr/local/share/icinga2-ido-mysql/schema/mysql.sql +Alpine Linux: + +On Alpine Linux the IDO modules for MySQL are included with the `icinga2` package +and located at /usr/share/icinga2-ido-mysql/schema/mysql.sql + > **Note** > > The Debian/Ubuntu packages provide a database configuration wizard by @@ -528,6 +569,9 @@ FreeBSD: # service icinga2 restart +Alpine Linux: + + # rc-service icinga2 restart Continue with the [webserver setup](02-getting-started.md#icinga2-user-interface-webserver). @@ -564,6 +608,13 @@ FreeBSD: # sysrc postgresql_enable=yes # service postgresql start +Alpine Linux: + + # apk add postgresql + # rc-update add postgresql default + # rc-service postgresql setup + # rc-service postgresql start + #### Installing the IDO modules for PostgreSQL The next step is to install the `icinga2-ido-pgsql` package using your @@ -586,6 +637,11 @@ FreeBSD: On FreeBSD the IDO modules for PostgreSQL are included with the icinga2 package and located at /usr/local/share/icinga2-ido-pgsql/schema/pgsql.sql +Alpine Linux: + +On Alpine Linux the IDO modules for PostgreSQL are included with the `icinga2` package +and located at /usr/share/icinga2-ido-pgsql/schema/pgsql.sql + > **Note** > > Upstream Debian packages provide a database configuration wizard by default. @@ -666,6 +722,10 @@ FreeBSD: # service icinga2 restart +Alpine Linux: + + # rc-service icinga2 restart + Continue with the [webserver setup](02-getting-started.md#icinga2-user-interface-webserver). ### Webserver @@ -704,6 +764,13 @@ FreeBSD (nginx, but you could also use the apache24 package): # service php-fpm start # service nginx start +Alpine Linux: + + # apk add apache2 php7-apache2 + # sed -i -e "s/^#LoadModule rewrite_module/LoadModule rewrite_module/" /etc/apache2/httpd.conf + # rc-update add apache2 default + # rc-service apache2 start + ### Firewall Rules Example: @@ -756,6 +823,10 @@ FreeBSD: # service icinga2 restart +Alpine Linux: + + # rc-service icinga2 restart + ### Installing Icinga Web 2 Please consult the [installation documentation](https://github.com/Icinga/icingaweb2/blob/master/doc/02-Installation.md)