]> granicus.if.org Git - icinga2/blob - INSTALL
Implement the ICINGA2_GIT_VERSION_INFO option.
[icinga2] / INSTALL
1 Installing Icinga 2
2 ===================
3
4 The recommended way of installing Icinga 2 is to use packages. The Icinga
5 project provides both release and development packages for a number
6 of operating systems.
7
8 Please check the documentation in the doc/ directory for a current list
9 of available packages and detailed installation instructions.
10
11 There are a number of known caveats when installing from source such as
12 incorrect directory and file permissions. So even if you're planning to
13 not use the official packages it is advisable to build your own Debian
14 or RPM packages.
15
16 Build Requirements
17 ------------------
18
19 The following requirements need to be fulfilled in order to build the
20 application using a dist tarball (package names for RHEL and Debian in
21 parentheses):
22
23 * cmake
24 * GNU make (make)
25 * C++ compiler (gcc-c++ on RHEL, build-essential on Debian)
26 * OpenSSL library and header files (openssl-devel on RHEL, libssl-dev
27                                     on Debian)
28 * Boost library and header files (boost-devel on RHEL, libboost-all-dev
29                                   on Debian)
30 * GNU bison (bison)
31 * GNU flex (flex) >= 2.5.35
32 * recommended: libexecinfo on FreeBSD
33 * optional: Doxygen (doxygen)
34 * optional: MySQL (mysql-devel on RHEL, libmysqlclient-dev on Debian)
35 * optional: Python (python-devel on RHEL, python-dev on Debian)
36
37 Note: RHEL5 ships an ancient flex version. Updated packages are available for
38 example from the repoforge buildtools repository.
39
40 http://mirror.hs-esslingen.de/repoforge/redhat/el5/en/{i386,x86_64}/buildtools/
41
42 User Requirements
43 -----------------
44
45 By default Icinga will run as user 'icinga' and group 'icinga'. Additionally the
46 external command pipe and livestatus features require a dedicated command group
47 'icingacmd'. You can choose your own user/group names and pass them to the
48 configure script using the --with-icinga-user, --with-icinga-group,
49 --with-icingacmd-user and --with-icingacmd-group options.
50
51 # groupadd icinga
52 # groupadd icingacmd
53 # useradd -c "icinga" -s /sbin/nologin -G icingacmd -g icinga icinga
54
55 Add the web server user to the icingacmd group in order to grant it write
56 permissions to the external command pipe and livestatus socket:
57
58 # usermod -a -G icingacmd www-data
59
60 Make sure to replace "www-data" with the name of the user your web server
61 is running as.
62
63 Building Release Tarballs
64 -------------------------
65
66 In order to build a release tarball you should first check out the Git repository
67 in a new directory. If you're using an existing check-out you should make sure
68 that there are no local modifications:
69
70 $ git status
71
72 Here's a short check-list for releases:
73
74 * Bump the version in icinga2.spec.
75 * Update the ChangeLog and doc/1-about.md files.
76 * Commit these changes to the "next" branch and create a signed tag (tags/v<VERSION>).
77 * Merge the "next" branch into the "master" branch (using --ff-only).
78 * Bump the version to "v<NEXT-VERSION>-dev" and commit this change to the "next" branch.
79
80 Note: CMake determines the Icinga 2 version number using "git describe" if the
81 source directory is contained in a Git repository. Otherwise the version number
82 is extracted from the icinga2.spec file. This behavior can be overridden by
83 creating a file called "icinga-version.h.force" in the source directory.
84 Alternatively the -DICINGA2_GIT_VERSION_INFO=ON option for CMake can be used to
85 disable the usage of "git describe".
86
87 Use "git archive" to build the release tarball:
88
89 $ git archive --format=tgz --prefix=icinga2-<VERSION>/ tags/v<VERSION>
90
91 Finally you should verify that the tarball only contains the files it should contain:
92
93 $ tar ztf icinga2-<VERSION>.tar.gz | less
94
95 Building Icinga 2
96 -----------------
97
98 Once you have installed all the necessary build requirements you can build
99 Icinga 2 using the following commands:
100
101 $ mkdir build && cd build
102 $ cmake ..
103 $ make
104 $ make install
105
106 You can specify an alternative installation prefix using -DCMAKE_INSTALL_PREFIX:
107
108 $ cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/icinga2
109
110 In addition to CMAKE_INSTALL_PREFIX the following Icinga-specific cmake
111 variables are supported:
112
113 - ICINGA2_USER: The user Icinga 2 should run as; defaults to "icinga"
114 - ICINGA2_GROUP: The group Icinga 2 should run as; defaults to "icinga"
115 - ICINGA2_COMMAND_USER: The command user Icinga 2 should use; defaults to "icinga"
116 - ICINGA2_COMMAND_GROUP: The command group Icinga 2 should use; default to "icingacmd"
117 - CMAKE_INSTALL_SYSCONFDIR: The configuration directory; defaults to CMAKE_INSTALL_PREFIX/etc
118 - CMAKE_INSTALL_LOCALSTATEDIR: The state directory; defaults to CMAKE_INSTALL_PREFIX/var
119
120 Running Icinga 2
121 ----------------
122
123 Icinga 2 comes with a single binary that takes care of loading all the relevant
124 components (e.g. for check execution, notifications, etc.):
125
126 # /usr/bin/icinga2
127 [2013-10-22 13:06:22 +0200] <Main Thread> information/icinga-app: Icinga application loader (version: 0.0.3, git branch master, commit 07d9a59f + changes)
128 [2013-10-22 13:06:22 +0200] <Main Thread> information/base: Adding library search dir: /usr/lib/icinga2
129 [2013-10-22 13:06:22 +0200] <Main Thread> information/base: Loading library 'libicinga.la'
130 [2013-10-22 13:06:22 +0200] <Main Thread> information/config: Adding include search dir: /usr/share/icinga2
131 [2013-10-22 13:06:22 +0200] <Main Thread> critical/icinga-app: You need to specify at least one config file (using the --config option).
132
133 Icinga 2 can be started as daemon using the provided init script:
134
135 # /etc/init.d/icinga2
136 Usage: /etc/init.d/icinga2 {start|stop|restart|reload|checkconfig|status}
137
138 Icinga 2 reads a single configuration file which is used to specify all
139 configuration settings (global settings, hosts, services, etc.). The
140 configuration format is explained in detail in the doc/ directory.
141
142 By default "make install" installs example configuration files in
143 /usr/local/etc/icinga2 unless you have specified a different prefix or
144 sysconfdir.
145
146
147 Package Builds
148 --------------
149
150 In order to create a snapshot tarball, create a new release directory outside
151 the source tree and run cmake and make. Replace <version> with the correct
152 string.
153
154 $ cd ..
155 $ mkdir icinga2-release && cd icinga2-release
156 $ cmake ../icinga2 -DCPACK_SOURCE_GENERATE=TGZ -DCPACK_SOURCE_PACKAGE_FILE_NAME=icinga2-<version>
157 $ make package_source