install.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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. When header-only Boost error code is not available or wanted, the
  104. Boost system library is required too.
  105. </para>
  106. </listitem>
  107. <listitem>
  108. <para>
  109. Botan (at least version 1.8) or OpenSSL.</para>
  110. </listitem>
  111. <listitem>
  112. <para>
  113. log4cplus (at least version 1.0.3)
  114. development include headers.
  115. </para>
  116. </listitem>
  117. <!--
  118. TODO
  119. Debian and Ubuntu:
  120. libgmp3-dev and libbz2-dev required for botan too
  121. -->
  122. <listitem>
  123. <para>
  124. A C++ compiler and
  125. standard development headers.
  126. Kea builds have been tested with GCC g++ 3.4.3, 4.1.2,
  127. 4.1.3, 4.2.1, 4.3.2, and 4.4.1; Clang++ 2.8; and Sun C++ 5.10.
  128. <!-- @todo update this list -->
  129. </para>
  130. </listitem>
  131. <listitem>
  132. <para>
  133. The development tools "make".
  134. </para>
  135. </listitem>
  136. </itemizedlist>
  137. <para>
  138. Visit the user-contributed wiki at <ulink
  139. url="http://kea.isc.org/wiki/SystemSpecificNotes" />
  140. for system-specific installation tips.
  141. </para>
  142. </section>
  143. <section id="install">
  144. <title>Installation from Source</title>
  145. <para>
  146. Kea is open source software written in C++.
  147. It is freely available in source code form from ISC as a
  148. downloadable tar file or via Kea Git code revision control
  149. service. (It may also be available in pre-compiled ready-to-use
  150. packages from operating system vendors.)
  151. </para>
  152. <section>
  153. <title>Download Tar File</title>
  154. <para>
  155. The Kea release tarballs may be downloaded from:
  156. <ulink url="http://ftp.isc.org/isc/kea/"/> (using FTP or HTTP).
  157. </para>
  158. </section>
  159. <section>
  160. <title>Retrieve from Git</title>
  161. <para>
  162. Downloading this "bleeding edge" code is recommended only for
  163. developers or advanced users. Using development code in a production
  164. environment is not recommended.
  165. </para>
  166. <note>
  167. <para>
  168. When building from source code retrieved via Git, additional
  169. software will be required: automake (v1.11 or later),
  170. libtoolize, and autoconf (2.59 or later).
  171. These may need to be installed.
  172. </para>
  173. </note>
  174. <para>
  175. The latest development code (together with temporary experiments
  176. and un-reviewed code) is available via the Kea code revision
  177. control system. This is powered by Git and all the Kea
  178. development is public.
  179. The leading development is done in the <quote>master</quote>
  180. branch.
  181. </para>
  182. <para>
  183. The code can be checked out from
  184. <filename>git://git.kea.isc.org/kea</filename>:
  185. <screen>$ <userinput>git clone git://git.kea.isc.org/kea</userinput></screen>
  186. </para>
  187. <para>
  188. The code checked out from the git repository doesn't include the
  189. generated configure script, Makefile.in files, nor their
  190. related build files.
  191. They can be created by running <command>autoreconf</command>
  192. with the <option>--install</option> switch.
  193. This will run <command>autoconf</command>,
  194. <command>aclocal</command>,
  195. <command>libtoolize</command>,
  196. <command>autoheader</command>,
  197. <command>automake</command>,
  198. and related commands.
  199. </para>
  200. </section>
  201. <section id="configure">
  202. <title>Configure before the build</title>
  203. <para>
  204. Kea uses the GNU Build System to discover build environment
  205. details.
  206. To generate the makefiles using the defaults, simply run:
  207. <screen>$ <userinput>./configure</userinput></screen>
  208. </para>
  209. <para>
  210. Run <command>./configure</command> with the <option>--help</option>
  211. switch to view the different options. Some commonly-used options are:
  212. <variablelist>
  213. <varlistentry>
  214. <term>--prefix</term>
  215. <listitem>
  216. <simpara>Define the installation location (the
  217. default is <filename>/usr/local</filename>).
  218. </simpara>
  219. </listitem>
  220. </varlistentry>
  221. <varlistentry>
  222. <term>--with-boost-include</term>
  223. <listitem>
  224. <simpara>Define the path to find the Boost headers.
  225. </simpara>
  226. </listitem>
  227. </varlistentry>
  228. <varlistentry>
  229. <term>--with-boost-libs</term>
  230. <listitem>
  231. <simpara>Specify Boost libraries to link with (this option
  232. exists only to provide a way to enforce such a list:
  233. usually this should not be used).
  234. </simpara>
  235. </listitem>
  236. </varlistentry>
  237. <varlistentry>
  238. <term>--with-boost-lib-dir</term>
  239. <listitem>
  240. <simpara>Specify the path to Boost libraries to link with
  241. (usually there should be no reason to specify this option).
  242. </simpara>
  243. </listitem>
  244. </varlistentry>
  245. <varlistentry>
  246. <term>--with-botan-config</term>
  247. <listitem>
  248. <simpara>Specify the path to the botan-config
  249. script to build with Botan for the crypto code.
  250. </simpara>
  251. </listitem>
  252. </varlistentry>
  253. <varlistentry>
  254. <term>--with-gtest</term>
  255. <listitem>
  256. <simpara>Enable the building of the C++ Unit Tests using the
  257. Google Test framework. Optionally this can define the
  258. path to the gtest header files and library. (If the framework
  259. is not already installed on your system, it can be downloaded
  260. from <ulink url="https://code.google.com/p/googletest"/>.)
  261. </simpara>
  262. </listitem>
  263. </varlistentry>
  264. <varlistentry>
  265. <term>--with-log4cplus</term>
  266. <listitem>
  267. <simpara>Define the path to find the Log4cplus headers
  268. and libraries.
  269. </simpara>
  270. </listitem>
  271. </varlistentry>
  272. <varlistentry>
  273. <term>--with-openssl</term>
  274. <listitem>
  275. <simpara>Replace Botan by OpenSSL for the crypto library.
  276. The default is to try to find a working Botan then
  277. OpenSSL only if Botan is not found.
  278. </simpara>
  279. </listitem>
  280. </varlistentry>
  281. <varlistentry>
  282. <term>--without-werror</term>
  283. <listitem>
  284. <simpara>Disable the default use of the
  285. <option>-Werror</option> compiler flag so that
  286. compiler warnings do not result in build failures.
  287. </simpara>
  288. </listitem>
  289. </varlistentry>
  290. </variablelist>
  291. <note>
  292. <para>
  293. For additional instructions concerning the building and installation of
  294. Kea for various databases, see <xref linkend="dhcp-install-configure"/>.
  295. For additional instructions concerning the configuration backends, see
  296. <xref linkend="dhcp-config-backend" />.
  297. </para>
  298. </note>
  299. </para>
  300. <!-- TODO: lcov -->
  301. <para>
  302. For example, the following command configures Kea to find the
  303. Boost headers in /usr/pkg/include, specifies that PostgreSQL
  304. support should be enabled, and sets the installation location
  305. to /opt/kea:
  306. <screen>$ <userinput>./configure \
  307. --with-boost-include=/usr/pkg/include \
  308. --with-dhcp-pgsql=/usr/local/bin/pg_config \
  309. --prefix=/opt/kea</userinput></screen>
  310. </para>
  311. <para>
  312. If you have some problems with building Kea using the header-only
  313. Boost error code or you'd like to use the Boost system library
  314. (e.g., located in /usr/pkg/lib):
  315. <screen>$ <userinput>./configure \
  316. --with-boost-libs=-lboost_system \
  317. --with-boost-lib-dir=/usr/pkg/lib</userinput></screen>
  318. </para>
  319. <para>
  320. If the configure fails, it may be due to missing or old
  321. dependencies.
  322. </para>
  323. <para>
  324. <userinput>./configure</userinput> when it succeeds displays a report
  325. with the building parameters. This report is saved into
  326. <filename>config.report</filename> and embedded into executable
  327. binaries, e.g., <userinput>kea-dhcp4</userinput>.
  328. </para>
  329. </section>
  330. <section>
  331. <title>Build</title>
  332. <para>
  333. After the configure step is complete, build the executables
  334. from the C++ code and prepare the Python scripts by running the command:
  335. <screen>$ <userinput>make</userinput></screen>
  336. </para>
  337. </section>
  338. <section>
  339. <title>Install</title>
  340. <para>
  341. To install the Kea executables, support files,
  342. and documentation, issue the command:
  343. <screen>$ <userinput>make install</userinput></screen>
  344. </para>
  345. <para>
  346. Do not use any form of parallel or job server options
  347. (such as GNU make's <command>-j</command> option) when
  348. performing this step: doing so may cause errors.
  349. </para>
  350. <note>
  351. <para>The install step may require superuser privileges.</para>
  352. </note>
  353. <para>
  354. If required, run <command>ldconfig</command> as root with
  355. <filename>/usr/local/lib</filename> (or with ${prefix}/lib if
  356. configured with --prefix) in
  357. <filename>/etc/ld.so.conf</filename> (or the relevant linker
  358. cache configuration file for your OS):
  359. <screen>$ <userinput>ldconfig</userinput></screen>
  360. </para>
  361. <note>
  362. <para>
  363. If you do not run <command>ldconfig</command> where it is
  364. required, you may see errors like the following:
  365. <screen>
  366. program: error while loading shared libraries: libkea-something.so.1:
  367. cannot open shared object file: No such file or directory
  368. </screen>
  369. </para>
  370. </note>
  371. </section>
  372. <!-- @todo: tests -->
  373. </section>
  374. <section id="dhcp-config-backend">
  375. <title>Selecting the Configuration Backend</title>
  376. <para>Kea 0.9 has introduced configuration backends that are
  377. switchable during the compilation phase. Only one backend, JSON,
  378. is currently supported.
  379. </para>
  380. <variablelist>
  381. <varlistentry>
  382. <term>JSON</term>
  383. <listitem>
  384. <simpara>JSON is the new default configuration backend
  385. that causes Kea to read JSON configuration files from
  386. disk. It does not require any framework and thus is
  387. considered more lightweight. It will allow dynamic
  388. on-line reconfiguration, but will lack remote capabilities
  389. (i.e. no RESTful API).</simpara>
  390. </listitem>
  391. </varlistentry>
  392. </variablelist>
  393. </section>
  394. <section id="dhcp-install-configure">
  395. <title>DHCP Database Installation and Configuration</title>
  396. <para>
  397. Kea stores its leases in a lease database. The software has been written in
  398. a way that makes it possible to choose which database product should be used to
  399. store the lease information. At present, Kea supports three database backends: MySQL,
  400. PostgreSQL and Memfile. To limit external dependencies, both MySQL and PostgreSQL
  401. support are disabled by default and only Memfile
  402. is available. Support for the optional external database backend must be explicitly included when
  403. Kea is built. This section covers the building of Kea with MySQL and/or PostgreSQL
  404. and the creation of the lease database.
  405. </para>
  406. <section>
  407. <title>Building with MySQL Support</title>
  408. <para>
  409. Install MySQL according to the instructions for your system. The client development
  410. libraries must be installed.
  411. </para>
  412. <para>
  413. Build and install Kea as described in <xref linkend="installation"/>, with
  414. the following modification. To enable the MySQL database code, at the
  415. "configure" step (see <xref linkend="configure"/>), do:
  416. <screen><userinput>./configure [other-options] --with-dhcp-mysql</userinput></screen>
  417. Or specify the location of the MySQL configuration program
  418. "mysql_config" if MySQL was not installed in the default location:
  419. <screen><userinput>./configure [other-options] --with-dhcp-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen>
  420. </para>
  421. <para>
  422. See <xref linkend="mysql-database-create"/> for details regarding
  423. MySQL database configuration.
  424. </para>
  425. </section>
  426. <section>
  427. <title>Building with PostgreSQL support</title>
  428. <para>
  429. Install PostgreSQL according to the instructions for your system. The client development
  430. libraries must be installed. Client development libraries are often packaged as &quot;libpq&quot;.
  431. </para>
  432. <para>
  433. Build and install Kea as described in <xref linkend="installation"/>, with
  434. the following modification. To enable the PostgreSQL database code, at the
  435. "configure" step (see <xref linkend="configure"/>), do:
  436. <screen><userinput>./configure [other-options] --with-dhcp-pgsql</userinput></screen>
  437. Or specify the location of the PostgreSQL configuration
  438. program "pg_config" if PostgreSQL was not installed in
  439. the default location:
  440. <screen><userinput>./configure [other-options] --with-dhcp-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen>
  441. </para>
  442. <para>
  443. See <xref linkend="pgsql-database-create"/> for details regarding
  444. PostgreSQL database configuration.
  445. </para>
  446. </section>
  447. <section>
  448. <title>Building with CQL (Cassandra) support</title>
  449. <para>
  450. Install Cassandra according to the instructions for your system. The
  451. Cassandra project webpage contains useful pointers: <ulink
  452. url="http://cassandra.apache.org/download/" />.
  453. </para>
  454. <para>
  455. Download and compile cpp-driver from DataStax. For details regarding
  456. dependencies for building cpp-driver, see the project homepage
  457. <ulink url="https://github.com/datastax/cpp-driver" />. As of June
  458. 2016, the following commands were used:
  459. <screen>
  460. $ <userinput>git clone https://github.com/datastax/cpp-driver</userinput>
  461. $ <userinput>cd cpp-driver</userinput>
  462. $ <userinput>mkdir build</userinput>
  463. $ <userinput>cmake ..</userinput>
  464. $ <userinput>make</userinput>
  465. </screen>
  466. </para>
  467. <para>
  468. As of June 2016, cpp-driver does not include cql_config script
  469. yet. There is a work in progress to contribute such a script to
  470. cpp-driver project. Until such contribution is accepted, there are
  471. intermediate steps that need to be conducted. The cql_config
  472. script and cql_config_defines.sh are temporarily stored in
  473. tools/ directory of the Kea sources. Before using it, please
  474. edit cql_config_defines.sh: change CPP_DRIVER_PATH to the directory,
  475. where cpp-driver sources are located. If cpp-driver sources already
  476. provide cql_config script please use that rather than the version
  477. from Kea sources.
  478. </para>
  479. <para>
  480. Build and install Kea as described in <xref linkend="installation"/>, with
  481. the following modification. To enable the Cassandra (CQL) database code, at the
  482. "configure" step (see <xref linkend="configure"/>), do:
  483. <screen><userinput>./configure [other-options] --with-cql=<replaceable>path-to-cql_config</replaceable></userinput></screen>
  484. </para>
  485. </section>
  486. </section>
  487. </chapter>