install.xml 22 KB

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