install.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  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 the software
  14. required only to build Kea and do not need to <emphasis>make</emphasis>
  15. the software.
  16. </para>
  17. <para>
  18. FreeBSD ports, NetBSD pkgsrc, and Debian
  19. <emphasis>testing</emphasis> package collections provide all the
  20. prerequisite packages.
  21. </para>
  22. </section>
  23. <section id="install-hierarchy">
  24. <title>Installation Hierarchy</title>
  25. <para>
  26. The following is the directory layout of the complete Kea installation.
  27. (All directory paths are relative to the installation directory):
  28. <itemizedlist>
  29. <listitem>
  30. <simpara>
  31. <filename>bin/</filename> &mdash;
  32. utility programs.
  33. </simpara>
  34. </listitem>
  35. <listitem>
  36. <simpara>
  37. <filename>etc/kea/</filename> &mdash;
  38. configuration files.
  39. </simpara>
  40. </listitem>
  41. <listitem>
  42. <simpara>
  43. <filename>include/</filename> &mdash;
  44. C++ development header files.
  45. </simpara>
  46. </listitem>
  47. <listitem>
  48. <simpara>
  49. <filename>lib/</filename> &mdash;
  50. libraries.
  51. </simpara>
  52. </listitem>
  53. <listitem>
  54. <simpara>
  55. <filename>sbin/</filename> &mdash;
  56. server software and commands used by the system administrator.
  57. </simpara>
  58. </listitem>
  59. <listitem>
  60. <simpara>
  61. <filename>share/kea/</filename> &mdash;
  62. configuration specifications and examples.
  63. </simpara>
  64. </listitem>
  65. <listitem>
  66. <simpara>
  67. <filename>share/doc/kea/</filename> &mdash;
  68. this guide, other supplementary documentation, and examples.
  69. </simpara>
  70. </listitem>
  71. <listitem>
  72. <simpara>
  73. <filename>share/man/</filename> &mdash;
  74. manual pages (online documentation).
  75. </simpara>
  76. </listitem>
  77. <listitem>
  78. <simpara>
  79. <filename>var/kea/</filename> &mdash;
  80. server identification, lease databases, and log files.
  81. </simpara>
  82. </listitem>
  83. </itemizedlist>
  84. </para>
  85. </section>
  86. <section id="build-requirements">
  87. <title>Building Requirements</title>
  88. <para>
  89. In addition to the run-time requirements (listed in <xref
  90. linkend="required-software"/>), building Kea from source code requires
  91. various development include headers and program development tools.
  92. </para>
  93. <note>
  94. <simpara>
  95. Some operating systems have split their distribution packages into
  96. a run-time and a development package. You will need to install
  97. the development package versions, which include header files and
  98. libraries, to build Kea from the source code.
  99. </simpara>
  100. </note>
  101. <para>
  102. Building from source code requires the following software installed
  103. on the system:</para>
  104. <itemizedlist>
  105. <listitem>
  106. <para>Boost C++ Libraries
  107. (<ulink url="http://www.boost.org/"/>).
  108. The oldest Boost version used for testing is 1.57 (it may work with
  109. older versions). Boost system library is required. Building boost
  110. header only is no longer recommended.
  111. </para>
  112. </listitem>
  113. <listitem>
  114. <para>
  115. Botan (at least version 1.8) or OpenSSL (at least version 1.0.1).
  116. </para>
  117. </listitem>
  118. <listitem>
  119. <para>
  120. log4cplus (at least version 1.0.3)
  121. development include headers.
  122. </para>
  123. </listitem>
  124. <!--
  125. TODO
  126. Debian and Ubuntu:
  127. libgmp3-dev and libbz2-dev required for botan too
  128. -->
  129. <listitem>
  130. <para>
  131. A C++ compiler (with C++11 support) and standard development
  132. headers. Kea builds have been tested with GCC g++ 4.7.2 4.7.3
  133. 4.8.2 4.8.4 4.8.5 4.9.3 4.9.4 5.3.1 5.4.0 6.3.0 6.3.1
  134. clang-800.0.38 clang-802.0.42 clang-900.0.37
  135. </para>
  136. </listitem>
  137. <listitem>
  138. <para>
  139. The development tools automake, libtool, pkg-config.
  140. </para>
  141. </listitem>
  142. <listitem>
  143. <para>
  144. The MySQL client and the client development libraries, when using
  145. the --with-dhcp-mysql configuration flag to build the Kea MySQL
  146. database backend. In this case an instance of the MySQL server
  147. running locally or on a machine reachable over a network
  148. is required. Note that
  149. running the unit tests requires a local MySQL server.
  150. </para>
  151. </listitem>
  152. <listitem>
  153. <para>
  154. The PostgreSQL client and the client development libraries, when
  155. using the --with-dhcp-pgsql configuration flag to build the Kea
  156. PostgreSQL database backend. In this case an instance of the
  157. PostgreSQL server running locally or on some other machine,
  158. reachable over the network from the machine running Kea, is
  159. required. Note that running the unit tests requires a local
  160. PostgreSQL server.
  161. </para>
  162. </listitem>
  163. <listitem>
  164. <para>
  165. googletest (version 1.8 or later), when using the --with-gtest configuration
  166. option to build the unit tests.
  167. </para>
  168. </listitem>
  169. <listitem>
  170. <para>
  171. The documentation generation tools elinks, docbook-xsl, libxslt and Doxygen,
  172. if using the --enable-generate-docs configuration option
  173. to create the documentation.
  174. </para>
  175. </listitem>
  176. </itemizedlist>
  177. </section>
  178. <section id="install">
  179. <title>Installation from Source</title>
  180. <para>
  181. Kea is open source software written in C++. It is freely available in
  182. source code form from ISC as a downloadable tar file. A copy of the Kea
  183. source code repository is accessible from Github (<ulink
  184. url="https://github.com/isc-projects/kea"/>). Kea may also be available
  185. in pre-compiled ready-to-use packages from operating system vendors.
  186. </para>
  187. <section>
  188. <title>Download Tar File</title>
  189. <para>
  190. The Kea release tarballs may be downloaded from:
  191. <ulink url="http://ftp.isc.org/isc/kea/"/> (using FTP or HTTP).
  192. </para>
  193. </section>
  194. <section>
  195. <title>Retrieve from Git</title>
  196. <para>
  197. Downloading this "bleeding edge" code is recommended only for
  198. developers or advanced users. Using development code in a production
  199. environment is not recommended.
  200. </para>
  201. <note>
  202. <para>
  203. When building from source code retrieved via Git, additional
  204. software will be required: automake (v1.11 or later),
  205. libtoolize, and autoconf (v2.69 or later).
  206. These may need to be installed.
  207. </para>
  208. </note>
  209. <para>
  210. The latest development code is available on Github (see
  211. <ulink url="https://github.com/isc-projects/kea"/>). The Kea source
  212. is public and development is done in the <quote>master</quote>
  213. branch.
  214. </para>
  215. <para>
  216. The code can be checked out from
  217. <filename>https://github.com/isc-projects/kea.git</filename>:
  218. <screen>$ <userinput>git clone https://github.com/isc-projects/kea.git</userinput></screen>
  219. </para>
  220. <para>
  221. The code checked out from the git repository does not include the
  222. generated configure script, Makefile.in files, nor their
  223. related build files.
  224. They can be created by running <command>autoreconf</command>
  225. with the <option>--install</option> switch.
  226. This will run <command>autoconf</command>,
  227. <command>aclocal</command>,
  228. <command>libtoolize</command>,
  229. <command>autoheader</command>,
  230. <command>automake</command>,
  231. and related commands.
  232. </para>
  233. <para>
  234. Write access to the Kea repository is only granted to ISC staff. If you
  235. are a developer planning to contribute to Kea, please fork our Github
  236. repository and use the "pull request" mechanism to request integration of
  237. your code. Please consult
  238. <ulink url="https://help.github.com/articles/fork-a-repo/"/> for help on
  239. how to fork a Github repository.
  240. The <ulink url="http://git.kea.isc.org/~tester/kea/doxygen/">Kea
  241. Developer's Guide</ulink> contains more information about the process, as
  242. well as describing the requirements for contributed code to be accepted by ISC.
  243. </para>
  244. </section>
  245. <section id="configure">
  246. <title>Configure Before the Build</title>
  247. <para>
  248. Kea uses the GNU Build System to discover build environment
  249. details.
  250. To generate the makefiles using the defaults, simply run:
  251. <screen>$ <userinput>./configure</userinput></screen>
  252. </para>
  253. <para>
  254. Run <command>./configure</command> with the <option>--help</option>
  255. switch to view the different options. Some commonly-used options are:
  256. <variablelist>
  257. <varlistentry>
  258. <term>--prefix</term>
  259. <listitem>
  260. <simpara>Define the installation location (the
  261. default is <filename>/usr/local</filename>).
  262. </simpara>
  263. </listitem>
  264. </varlistentry>
  265. <varlistentry>
  266. <term>--with-boost-include</term>
  267. <listitem>
  268. <simpara>Define the path to find the Boost headers.
  269. </simpara>
  270. </listitem>
  271. </varlistentry>
  272. <varlistentry>
  273. <term>--with-botan-config</term>
  274. <listitem>
  275. <simpara>Specify the path to the botan-config
  276. script to build with Botan for cryptographic functions.
  277. </simpara>
  278. </listitem>
  279. </varlistentry>
  280. <varlistentry>
  281. <term>--with-dhcp-mysql</term>
  282. <listitem>
  283. <simpara>
  284. Build Kea with code to allow it to store leases (and access
  285. host reservations) in a MySQL database.
  286. </simpara>
  287. </listitem>
  288. </varlistentry>
  289. <varlistentry>
  290. <term>--with-dhcp-pgsql</term>
  291. <listitem>
  292. <simpara>
  293. Build Kea with code to allow it to store leases (and access
  294. host reservations) in a PostgreSQL database.
  295. </simpara>
  296. </listitem>
  297. </varlistentry>
  298. <varlistentry>
  299. <term>--with-gtest-source</term>
  300. <listitem>
  301. <simpara>Enable the building of the C++ Unit Tests using the
  302. Google Test framework. This option specifies the path to the
  303. gtest source. (If the framework
  304. is not installed on your system, it can be downloaded
  305. from <ulink url="https://code.google.com/p/googletest"/>.)
  306. </simpara>
  307. </listitem>
  308. </varlistentry>
  309. <varlistentry>
  310. <term>--with-log4cplus</term>
  311. <listitem>
  312. <simpara>Define the path to find the Log4cplus headers
  313. and libraries.
  314. </simpara>
  315. </listitem>
  316. </varlistentry>
  317. <varlistentry>
  318. <term>--with-openssl</term>
  319. <listitem>
  320. <simpara>Replace Botan by the OpenSSL the cryptographic library.
  321. By default <command>configure</command> searches for a valid
  322. Botan installation:
  323. if one is not found, it searches for OpenSSL.
  324. </simpara>
  325. </listitem>
  326. </varlistentry>
  327. </variablelist>
  328. <note>
  329. <para>
  330. For instructions concerning the installation and configuration
  331. of database backends for Kea, see <xref linkend="dhcp-install-configure"/>.
  332. For information concerning the configuration backends, see
  333. <xref linkend="dhcp-config-backend" />.
  334. </para>
  335. </note>
  336. </para>
  337. <!-- TODO: lcov -->
  338. <para>
  339. For example, the following command configures Kea to find the
  340. Boost headers in /usr/pkg/include, specifies that PostgreSQL
  341. support should be enabled, and sets the installation location
  342. to /opt/kea:
  343. <screen>$ <userinput>./configure \
  344. --with-boost-include=/usr/pkg/include \
  345. --with-dhcp-pgsql=/usr/local/bin/pg_config \
  346. --prefix=/opt/kea</userinput></screen>
  347. </para>
  348. <para>
  349. If you have some problems with building Kea using the header-only
  350. Boost code or you'd like to use the Boost system library
  351. (assumed for the sake of this example to be located in /usr/pkg/lib):
  352. <screen>$ <userinput>./configure \
  353. --with-boost-libs=-lboost_system \
  354. --with-boost-lib-dir=/usr/pkg/lib</userinput></screen>
  355. </para>
  356. <para>
  357. If <command>configure</command> fails, it may be due to missing or old
  358. dependencies.
  359. </para>
  360. <para>
  361. If <command>configure</command> succeeds, it displays a report
  362. with the parameters used to build the code. This report is saved into
  363. the file <filename>config.report</filename> and is also embedded into
  364. the executable binaries, e.g., <userinput>kea-dhcp4</userinput>.
  365. </para>
  366. </section>
  367. <section>
  368. <title>Build</title>
  369. <para>
  370. After the configure step is complete, build the executables
  371. from the C++ code and prepare the Python scripts by running the command:
  372. <screen>$ <userinput>make</userinput></screen>
  373. </para>
  374. </section>
  375. <section>
  376. <title>Install</title>
  377. <para>
  378. To install the Kea executables, support files,
  379. and documentation, issue the command:
  380. <screen>$ <userinput>make install</userinput></screen>
  381. </para>
  382. <para>
  383. Do not use any form of parallel or job server options
  384. (such as GNU make's <command>-j</command> option) when
  385. performing this step: doing so may cause errors.
  386. </para>
  387. <note>
  388. <para>The install step may require superuser privileges.</para>
  389. </note>
  390. <para>
  391. If required, run <command>ldconfig</command> as root with
  392. <filename>/usr/local/lib</filename> (or with <replaceable>prefix</replaceable>/lib if
  393. configured with --prefix) in
  394. <filename>/etc/ld.so.conf</filename> (or the relevant linker
  395. cache configuration file for your OS):
  396. <screen>$ <userinput>ldconfig</userinput></screen>
  397. </para>
  398. <note>
  399. <para>
  400. If you do not run <command>ldconfig</command> where it is
  401. required, you may see errors like the following:
  402. <screen>
  403. program: error while loading shared libraries: libkea-something.so.1:
  404. cannot open shared object file: No such file or directory
  405. </screen>
  406. </para>
  407. </note>
  408. </section>
  409. <!-- @todo: tests -->
  410. </section>
  411. <section id="dhcp-config-backend">
  412. <title>Selecting the Configuration Backend</title>
  413. <para>Kea 0.9 introduced configuration backends that are
  414. switchable during the compilation phase. Only one backend, JSON,
  415. is currently supported.
  416. </para>
  417. <variablelist>
  418. <varlistentry>
  419. <term>JSON</term>
  420. <listitem>
  421. <simpara>JSON is the default configuration backend
  422. that allows Kea to read JSON configuration files from
  423. disk. It does not require any framework and thus is
  424. considered more lightweight. It allows dynamic on-line
  425. reconfiguration using Kea API.</simpara>
  426. </listitem>
  427. </varlistentry>
  428. </variablelist>
  429. </section>
  430. <section id="dhcp-install-configure">
  431. <title>DHCP Database Installation and Configuration</title>
  432. <para>
  433. Kea stores its leases in a lease database. The software has been
  434. written in a way that makes it possible to choose which database product
  435. should be used to store the lease information. At present, Kea supports
  436. four database backends: MySQL, PostgreSQL, Cassandra and Memfile. To
  437. limit external dependencies, MySQL, PostgreSQL and Cassandra support are
  438. disabled by default and only Memfile is available. Support for the
  439. optional external database backend must be explicitly included when Kea
  440. is built. This section covers the building of Kea with one of the
  441. optional backends and the creation of the lease database.
  442. </para>
  443. <note>
  444. <simpara>
  445. When unit tests are built with Kea (the --with-gtest configuration option is specified),
  446. the databases must be manually pre-configured for the unit tests to run.
  447. The details of this configuration can be found in the
  448. <ulink url="http://git.kea.isc.org/~tester/kea/doxygen">Kea Developer's
  449. Guide</ulink>.
  450. </simpara>
  451. </note>
  452. <section>
  453. <title>Building with MySQL Support</title>
  454. <para>
  455. Install MySQL according to the instructions for your system. The client development
  456. libraries must be installed.
  457. </para>
  458. <para>
  459. Build and install Kea as described in <xref linkend="installation"/>, with
  460. the following modification. To enable the MySQL database code, at the
  461. "configure" step (see <xref linkend="configure"/>), the --with-dhcp-mysql switch
  462. should be specified:
  463. <screen><userinput>./configure [other-options] --with-dhcp-mysql</userinput></screen>
  464. If MySQL was not installed in the default location, the location of the MySQL
  465. configuration program "mysql_config" should be included with the switch, i.e.
  466. <screen><userinput>./configure [other-options] --with-dhcp-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen>
  467. </para>
  468. <para>
  469. See <xref linkend="mysql-database-create"/> for details regarding
  470. MySQL database configuration.
  471. </para>
  472. </section>
  473. <section>
  474. <title>Building with PostgreSQL support</title>
  475. <para>
  476. Install PostgreSQL according to the instructions for your system. The client development
  477. libraries must be installed. Client development libraries are often packaged as &quot;libpq&quot;.
  478. </para>
  479. <para>
  480. Build and install Kea as described in <xref linkend="installation"/>, with
  481. the following modification. To enable the PostgreSQL database code, at the
  482. "configure" step (see <xref linkend="configure"/>), the --with-dhcp-pgsql switch
  483. should be specified:
  484. <screen><userinput>./configure [other-options] --with-dhcp-pgsql</userinput></screen>
  485. If PostgreSQL was not installed in the default location, the location of the PostgreSQL
  486. configuration program "pg_config" should be included with the switch, i.e.
  487. <screen><userinput>./configure [other-options] --with-dhcp-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen>
  488. </para>
  489. <para>
  490. See <xref linkend="pgsql-database-create"/> for details regarding
  491. PostgreSQL database configuration.
  492. </para>
  493. </section>
  494. <section>
  495. <title>Building with CQL (Cassandra) support</title>
  496. <para>
  497. Install Cassandra according to the instructions for your system. The
  498. Cassandra project website contains useful pointers: <ulink
  499. url="http://cassandra.apache.org" />.
  500. </para>
  501. <para>
  502. Download and compile cpp-driver from DataStax. For details regarding
  503. dependencies for building cpp-driver, see the project homepage
  504. <ulink url="https://github.com/datastax/cpp-driver" />. In June
  505. 2016, the following commands were used:
  506. <screen>
  507. $ <userinput>git clone https://github.com/datastax/cpp-driver</userinput>
  508. $ <userinput>cd cpp-driver</userinput>
  509. $ <userinput>mkdir build</userinput>
  510. $ <userinput>cmake ..</userinput>
  511. $ <userinput>make</userinput>
  512. </screen>
  513. </para>
  514. <para>
  515. As of June 2016, cpp-driver does not include cql_config script
  516. yet. Work is in progress to contribute such a script to the
  517. cpp-driver project but, until that is complete,
  518. intermediate steps that need to be conducted. A cql_config script is present in the
  519. tools/ directory of the Kea sources. Before using it, please
  520. edit cql_config_defines.sh in the same directory and change the
  521. environment variable CPP_DRIVER_PATH to point to the directory,
  522. where cpp-driver sources are located. (If the cpp-driver sources already
  523. provide cql_config script please use that rather than the version
  524. from Kea sources.)
  525. </para>
  526. <para>
  527. Build and install Kea as described in <xref linkend="installation"/>, with
  528. the following modification. To enable the Cassandra (CQL) database code, at the
  529. "configure" step (see <xref linkend="configure"/>), do:
  530. <screen><userinput>./configure [other-options] --with-cql=<replaceable>path-to-cql_config</replaceable></userinput></screen>
  531. </para>
  532. </section>
  533. </section>
  534. </chapter>