install.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY mdash "&#x2014;" >
  5. ]>
  6. <chapter id="installation">
  7. <title>Installation</title>
  8. <section id="packages">
  9. <title>Packages</title>
  10. <para>
  11. Some operating systems or software package vendors may provide
  12. ready-to-use, pre-built software packages for Kea. Installing a
  13. pre-built package means you do not need to install build-only
  14. prerequisites and do not need to <emphasis>make</emphasis> the software.
  15. </para>
  16. <para>
  17. FreeBSD ports, NetBSD pkgsrc, and Debian <emphasis>testing</emphasis>
  18. package collections provide all the prerequisite packages.
  19. </para>
  20. </section>
  21. <section id="install-hierarchy">
  22. <title>Install Hierarchy</title>
  23. <para>
  24. The following is the directory layout of the complete Kea installation
  25. (all directories paths are relative to the installation directory):
  26. <itemizedlist>
  27. <listitem>
  28. <simpara>
  29. <filename>etc/kea/</filename> &mdash;
  30. configuration files.
  31. </simpara>
  32. </listitem>
  33. <listitem>
  34. <simpara>
  35. <filename>include/</filename> &mdash;
  36. C++ development header files.
  37. </simpara>
  38. </listitem>
  39. <listitem>
  40. <simpara>
  41. <filename>lib/</filename> &mdash;
  42. libraries.
  43. </simpara>
  44. </listitem>
  45. <listitem>
  46. <simpara>
  47. <filename>sbin/</filename> &mdash;
  48. server software and commands used by the system administrator.
  49. </simpara>
  50. </listitem>
  51. <listitem>
  52. <simpara>
  53. <filename>share/kea/</filename> &mdash;
  54. configuration specifications and examples.
  55. </simpara>
  56. </listitem>
  57. <listitem>
  58. <simpara>
  59. <filename>share/doc/kea/</filename> &mdash;
  60. this guide, other supplementary documentation, and examples.
  61. </simpara>
  62. </listitem>
  63. <listitem>
  64. <simpara>
  65. <filename>share/man/</filename> &mdash;
  66. manual pages (online documentation).
  67. </simpara>
  68. </listitem>
  69. <listitem>
  70. <simpara>
  71. <filename>var/kea/</filename> &mdash;
  72. server identification, lease databases, and log files.
  73. </simpara>
  74. </listitem>
  75. </itemizedlist>
  76. </para>
  77. </section>
  78. <section id="build-requirements">
  79. <title>Building Requirements</title>
  80. <para>
  81. In addition to the run-time requirements (listed in <xref
  82. linkend="required-software"/>), building Kea from source code requires
  83. various development include headers and program development tools.
  84. </para>
  85. <note>
  86. <simpara>
  87. Some operating systems have split their distribution packages into
  88. a run-time and a development package. You will need to install
  89. the development package versions, which include header files and
  90. libraries, to build Kea from the source code.
  91. </simpara>
  92. </note>
  93. <para>
  94. Building from source code requires the following software installed
  95. on the system:</para>
  96. <itemizedlist>
  97. <listitem>
  98. <para>Boost build-time headers
  99. (<ulink url="http://www.boost.org/"/>).
  100. At least Boost version 1.35 is required.
  101. <!-- TODO: we don't check for this version -->
  102. <!-- NOTE: jreed has tested with 1.34, 1.38, and 1.41. -->
  103. </para>
  104. </listitem>
  105. <listitem>
  106. <para>
  107. Botan (at least version 1.8) or OpenSSL.</para>
  108. </listitem>
  109. <listitem>
  110. <para>
  111. log4cplus (at least version 1.0.3)
  112. development include headers.
  113. </para>
  114. </listitem>
  115. <!--
  116. TODO
  117. Debian and Ubuntu:
  118. libgmp3-dev and libbz2-dev required for botan too
  119. -->
  120. <listitem>
  121. <para>
  122. A C++ compiler and
  123. standard development headers.
  124. Kea builds have been tested with GCC g++ 3.4.3, 4.1.2,
  125. 4.1.3, 4.2.1, 4.3.2, and 4.4.1; Clang++ 2.8; and Sun C++ 5.10.
  126. <!-- @todo update this list -->
  127. </para>
  128. </listitem>
  129. <listitem>
  130. <para>
  131. The development tools "make".
  132. </para>
  133. </listitem>
  134. </itemizedlist>
  135. <para>
  136. Visit the user-contributed wiki at <ulink
  137. url="http://kea.isc.org/wiki/SystemSpecificNotes" />
  138. for system-specific installation tips.
  139. </para>
  140. </section>
  141. <section id="install">
  142. <title>Installation from Source</title>
  143. <para>
  144. Kea is open source software written in C++.
  145. It is freely available in source code form from ISC as a
  146. downloadable tar file or via Kea Git code revision control
  147. service. (It may also be available in pre-compiled ready-to-use
  148. packages from operating system vendors.)
  149. </para>
  150. <section>
  151. <title>Download Tar File</title>
  152. <para>
  153. The Kea release tarballs may be downloaded from:
  154. <ulink url="http://ftp.isc.org/isc/kea/"/> (using FTP or HTTP).
  155. </para>
  156. </section>
  157. <section>
  158. <title>Retrieve from Git</title>
  159. <para>
  160. Downloading this "bleeding edge" code is recommended only for
  161. developers or advanced users. Using development code in a production
  162. environment is not recommended.
  163. </para>
  164. <note>
  165. <para>
  166. When building from source code retrieved via Git, additional
  167. software will be required: automake (v1.11 or later),
  168. libtoolize, and autoconf (2.59 or later).
  169. These may need to be installed.
  170. </para>
  171. </note>
  172. <para>
  173. The latest development code (together with temporary experiments
  174. and un-reviewed code) is available via the Kea code revision
  175. control system. This is powered by Git and all the Kea
  176. development is public.
  177. The leading development is done in the <quote>master</quote>
  178. branch.
  179. </para>
  180. <para>
  181. The code can be checked out from
  182. <filename>git://git.kea.isc.org/kea</filename>:
  183. <screen>$ <userinput>git clone git://git.kea.isc.org/kea</userinput></screen>
  184. </para>
  185. <para>
  186. The code checked out from the git repository doesn't include the
  187. generated configure script, Makefile.in files, nor their
  188. related build files.
  189. They can be created by running <command>autoreconf</command>
  190. with the <option>--install</option> switch.
  191. This will run <command>autoconf</command>,
  192. <command>aclocal</command>,
  193. <command>libtoolize</command>,
  194. <command>autoheader</command>,
  195. <command>automake</command>,
  196. and related commands.
  197. </para>
  198. </section>
  199. <section id="configure">
  200. <title>Configure before the build</title>
  201. <para>
  202. Kea uses the GNU Build System to discover build environment
  203. details.
  204. To generate the makefiles using the defaults, simply run:
  205. <screen>$ <userinput>./configure</userinput></screen>
  206. </para>
  207. <para>
  208. Run <command>./configure</command> with the <option>--help</option>
  209. switch to view the different options. Some commonly-used options are:
  210. <variablelist>
  211. <varlistentry>
  212. <term>--prefix</term>
  213. <listitem>
  214. <simpara>Define the installation location (the
  215. default is <filename>/usr/local</filename>).
  216. </simpara>
  217. </listitem>
  218. </varlistentry>
  219. <varlistentry>
  220. <term>--with-boost-include</term>
  221. <listitem>
  222. <simpara>Define the path to find the Boost headers.
  223. </simpara>
  224. </listitem>
  225. </varlistentry>
  226. <varlistentry>
  227. <term>--with-botan-config</term>
  228. <listitem>
  229. <simpara>To specific the path to the botan-config
  230. script to build with Botan for the crypto code.
  231. </simpara>
  232. </listitem>
  233. </varlistentry>
  234. <varlistentry>
  235. <term>--with-gtest</term>
  236. <listitem>
  237. <simpara>Enable the building of the C++ Unit Tests using the
  238. Google Test framework. Optionally this can define the
  239. path to the gtest header files and library. (If the framework
  240. is not already installed on your system, it can be downloaded
  241. from <ulink url="https://code.google.com/p/googletest"/>.)
  242. </simpara>
  243. </listitem>
  244. </varlistentry>
  245. <varlistentry>
  246. <term>--with-log4cplus</term>
  247. <listitem>
  248. <simpara>Define the path to find the Log4cplus headers
  249. and libraries.
  250. </simpara>
  251. </listitem>
  252. </varlistentry>
  253. <varlistentry>
  254. <term>--with-openssl</term>
  255. <listitem>
  256. <simpara>Replace Botan by OpenSSL for the crypto library.
  257. The default is to try to find a working Botan then
  258. OpenSSL only if Botan is not found.
  259. </simpara>
  260. </listitem>
  261. </varlistentry>
  262. <varlistentry>
  263. <term>--without-werror</term>
  264. <listitem>
  265. <simpara>Disable the default use of the
  266. <option>-Werror</option> compiler flag so that
  267. compiler warnings do not result in build failures.
  268. </simpara>
  269. </listitem>
  270. </varlistentry>
  271. </variablelist>
  272. <note>
  273. <para>
  274. For additional instructions concerning the building and installation of
  275. Kea for various databases, see <xref linkend="dhcp-install-configure"/>.
  276. For additional instructions concerning the configuration backends, see
  277. <xref linkend="dhcp-config-backend" />.
  278. </para>
  279. </note>
  280. </para>
  281. <!-- TODO: lcov -->
  282. <para>
  283. For example, the following command configures Kea to find the
  284. Boost headers in /usr/pkg/include, specifies that PostgreSQL
  285. support should be enabled, and sets the installation location
  286. to /opt/kea:
  287. <screen>$ <userinput>./configure \
  288. --with-boost-include=/usr/pkg/include \
  289. --with-dhcp-pgsql=/usr/local/bin/pg_config \
  290. --prefix=/opt/kea</userinput></screen>
  291. </para>
  292. <para>
  293. If the configure fails, it may be due to missing or old
  294. dependencies.
  295. </para>
  296. <para>
  297. <userinput>./configure</userinput> when it succeeds displays a report
  298. with the building parameters. This report is saved into
  299. <filename>config.report</filename> and embedded into executable
  300. binaries, e.g., <userinput>kea-dhcp4</userinput>.
  301. </para>
  302. </section>
  303. <section>
  304. <title>Build</title>
  305. <para>
  306. After the configure step is complete, build the executables
  307. from the C++ code and prepare the Python scripts by running the command:
  308. <screen>$ <userinput>make</userinput></screen>
  309. </para>
  310. </section>
  311. <section>
  312. <title>Install</title>
  313. <para>
  314. To install the Kea executables, support files,
  315. and documentation, issue the command:
  316. <screen>$ <userinput>make install</userinput></screen>
  317. </para>
  318. <para>
  319. Do not use any form of parallel or job server options
  320. (such as GNU make's <command>-j</command> option) when
  321. performing this step: doing so may cause errors.
  322. </para>
  323. <note>
  324. <para>The install step may require superuser privileges.</para>
  325. </note>
  326. <para>
  327. If required, run <command>ldconfig</command> as root with
  328. <filename>/usr/local/lib</filename> (or with ${prefix}/lib if
  329. configured with --prefix) in
  330. <filename>/etc/ld.so.conf</filename> (or the relevant linker
  331. cache configuration file for your OS):
  332. <screen>$ <userinput>ldconfig</userinput></screen>
  333. </para>
  334. <note>
  335. <para>
  336. If you do not run <command>ldconfig</command> where it is
  337. required, you may see errors like the following:
  338. <screen>
  339. program: error while loading shared libraries: libkea-something.so.1:
  340. cannot open shared object file: No such file or directory
  341. </screen>
  342. </para>
  343. </note>
  344. </section>
  345. <!-- @todo: tests -->
  346. </section>
  347. <section id="dhcp-config-backend">
  348. <title>Selecting the Configuration Backend</title>
  349. <para>Kea 0.9 has introduced configuration backends that are
  350. switchable during the compilation phase. Only one backend, JSON,
  351. is currently supported.
  352. </para>
  353. <variablelist>
  354. <varlistentry>
  355. <term>JSON</term>
  356. <listitem>
  357. <simpara>JSON is the new default configuration backend
  358. that causes Kea to read JSON configuration files from
  359. disk. It does not require any framework and thus is
  360. considered more lightweight. It will allow dynamic
  361. on-line reconfiguration, but will lack remote capabilities
  362. (i.e. no RESTful API).</simpara>
  363. </listitem>
  364. </varlistentry>
  365. </variablelist>
  366. </section>
  367. <section id="dhcp-install-configure">
  368. <title>DHCP Database Installation and Configuration</title>
  369. <para>
  370. Kea stores its leases in a lease database. The software has been written in
  371. a way that makes it possible to choose which database product should be used to
  372. store the lease information. At present, Kea supports three database backends: MySQL,
  373. PostgreSQL and Memfile. To limit external dependencies, both MySQL and PostgreSQL
  374. support are disabled by default and only Memfile
  375. is available. Support for the optional external database backend must be explicitly included when
  376. Kea is built. This section covers the building of Kea with MySQL and/or PostgreSQL
  377. and the creation of the lease database.
  378. </para>
  379. <section>
  380. <title>Building with MySQL Support</title>
  381. <para>
  382. Install MySQL according to the instructions for your system. The client development
  383. libraries must be installed.
  384. </para>
  385. <para>
  386. Build and install Kea as described in <xref linkend="installation"/>, with
  387. the following modification. To enable the MySQL database code, at the
  388. "configure" step (see <xref linkend="configure"/>), do:
  389. <screen><userinput>./configure [other-options] --with-dhcp-mysql</userinput></screen>
  390. Or specify the location of the MySQL configuration program
  391. "mysql_config" if MySQL was not installed in the default location:
  392. <screen><userinput>./configure [other-options] --with-dhcp-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen>
  393. </para>
  394. <para>
  395. See <xref linkend="mysql-database-create"/> for details regarding
  396. MySQL database configuration.
  397. </para>
  398. </section>
  399. <section>
  400. <title>Building with PostgreSQL support</title>
  401. <para>
  402. Install PostgreSQL according to the instructions for your system. The client development
  403. libraries must be installed. Client development libraries are often packaged as &quot;libpq&quot;.
  404. </para>
  405. <para>
  406. Build and install Kea as described in <xref linkend="installation"/>, with
  407. the following modification. To enable the PostgreSQL database code, at the
  408. "configure" step (see <xref linkend="configure"/>), do:
  409. <screen><userinput>./configure [other-options] --with-dhcp-pgsql</userinput></screen>
  410. Or specify the location of the PostgreSQL configuration
  411. program "pg_config" if PostgreSQL was not installed in
  412. the default location:
  413. <screen><userinput>./configure [other-options] --with-dhcp-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen>
  414. </para>
  415. <para>
  416. See <xref linkend="pgsql-database-create"/> for details regarding
  417. PostgreSQL database configuration.
  418. </para>
  419. </section>
  420. </section>
  421. </chapter>