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 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 build-time headers
  107. (<ulink url="http://www.boost.org/"/>).
  108. At least Boost version 1.41 is required.
  109. When header-only Boost error code is not available or wanted, the
  110. Boost system library is required too.
  111. </para>
  112. </listitem>
  113. <listitem>
  114. <para>
  115. Botan (version 1.8, 1.9 or 1.10) or OpenSSL (versions 1.0.*).</para>
  116. </listitem>
  117. <listitem>
  118. <para>
  119. log4cplus (at least version 1.0.3)
  120. development include headers.
  121. </para>
  122. </listitem>
  123. <!--
  124. TODO
  125. Debian and Ubuntu:
  126. libgmp3-dev and libbz2-dev required for botan too
  127. -->
  128. <listitem>
  129. <para>
  130. A C++ compiler and standard development headers.
  131. Kea 1.1.0 builds have been tested with GCC g++ 4.2.1,
  132. 4.4.7, 4.6.3, 4.8.3, 4.8.4, 4.8.5, 5.4.0; Clang++ 3.4.1;
  133. and Apple Clang++ 703.0.31.
  134. <!-- @todo update this list -->
  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.6 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. <para>
  178. Visit the user-contributed wiki at
  179. <ulink url="http://kea.isc.org/wiki/SystemSpecificNotes" />
  180. for system-specific installation tips.
  181. </para>
  182. </section>
  183. <section id="install">
  184. <title>Installation from Source</title>
  185. <para>
  186. Kea is open source software written in C++. It is freely available in
  187. source code form from ISC as a downloadable tar file. A copy of the Kea
  188. source code repository is accessible from Github (<ulink
  189. url="https://github.com/isc-projects/kea"/>). Kea may also be available
  190. in pre-compiled ready-to-use packages from operating system vendors.
  191. </para>
  192. <section>
  193. <title>Download Tar File</title>
  194. <para>
  195. The Kea release tarballs may be downloaded from:
  196. <ulink url="http://ftp.isc.org/isc/kea/"/> (using FTP or HTTP).
  197. </para>
  198. </section>
  199. <section>
  200. <title>Retrieve from Git</title>
  201. <para>
  202. Downloading this "bleeding edge" code is recommended only for
  203. developers or advanced users. Using development code in a production
  204. environment is not recommended.
  205. </para>
  206. <note>
  207. <para>
  208. When building from source code retrieved via Git, additional
  209. software will be required: automake (v1.11 or later),
  210. libtoolize, and autoconf (v2.59 or later).
  211. These may need to be installed.
  212. </para>
  213. </note>
  214. <para>
  215. The latest development code is available on Github (see
  216. <ulink url="https://github.com/isc-projects/kea"/>). The Kea source
  217. is public and development is done in the <quote>master</quote>
  218. branch.
  219. </para>
  220. <para>
  221. The code can be checked out from
  222. <filename>https://github.com/isc-projects/kea.git</filename>:
  223. <screen>$ <userinput>git clone https://github.com/isc-projects/kea.git</userinput></screen>
  224. </para>
  225. <para>
  226. The code checked out from the git repository does not include the
  227. generated configure script, Makefile.in files, nor their
  228. related build files.
  229. They can be created by running <command>autoreconf</command>
  230. with the <option>--install</option> switch.
  231. This will run <command>autoconf</command>,
  232. <command>aclocal</command>,
  233. <command>libtoolize</command>,
  234. <command>autoheader</command>,
  235. <command>automake</command>,
  236. and related commands.
  237. </para>
  238. <para>
  239. Write access to the Kea repository is only granted to ISC staff. If you
  240. are a developer planning to contribute to Kea, please fork our Github
  241. repository and use the "pull request" mechanism to request integration of
  242. your code. Please consult
  243. <ulink url="https://help.github.com/articles/fork-a-repo/"/> for help on
  244. how to fork a Github repository.
  245. The <ulink url="http://git.kea.isc.org/~tester/kea/doxygen/">Kea
  246. Developer's Guide</ulink> contains more information about the process, as
  247. well as describing the requirements for contributed code to be accepted by ISC.
  248. </para>
  249. </section>
  250. <section id="configure">
  251. <title>Configure Before the Build</title>
  252. <para>
  253. Kea uses the GNU Build System to discover build environment
  254. details.
  255. To generate the makefiles using the defaults, simply run:
  256. <screen>$ <userinput>./configure</userinput></screen>
  257. </para>
  258. <para>
  259. Run <command>./configure</command> with the <option>--help</option>
  260. switch to view the different options. Some commonly-used options are:
  261. <variablelist>
  262. <varlistentry>
  263. <term>--prefix</term>
  264. <listitem>
  265. <simpara>Define the installation location (the
  266. default is <filename>/usr/local</filename>).
  267. </simpara>
  268. </listitem>
  269. </varlistentry>
  270. <varlistentry>
  271. <term>--with-boost-include</term>
  272. <listitem>
  273. <simpara>Define the path to find the Boost headers.
  274. </simpara>
  275. </listitem>
  276. </varlistentry>
  277. <varlistentry>
  278. <term>--with-botan-config</term>
  279. <listitem>
  280. <simpara>Specify the path to the botan-config
  281. script to build with Botan for cryptographic functions.
  282. </simpara>
  283. </listitem>
  284. </varlistentry>
  285. <varlistentry>
  286. <term>--with-dhcp-mysql</term>
  287. <listitem>
  288. <simpara>
  289. Build Kea with code to allow it to store leases (and access
  290. host reservations) in a MySQL database.
  291. </simpara>
  292. </listitem>
  293. </varlistentry>
  294. <varlistentry>
  295. <term>--with-dhcp-pgsql</term>
  296. <listitem>
  297. <simpara>
  298. Build Kea with code to allow it to store leases (and access
  299. host reservations) in a PostgreSQL database.
  300. </simpara>
  301. </listitem>
  302. </varlistentry>
  303. <varlistentry>
  304. <term>--with-gtest-source</term>
  305. <listitem>
  306. <simpara>Enable the building of the C++ Unit Tests using the
  307. Google Test framework. This option specifies the path to the
  308. gtest source. (If the framework
  309. is not installed on your system, it can be downloaded
  310. from <ulink url="https://code.google.com/p/googletest"/>.)
  311. </simpara>
  312. </listitem>
  313. </varlistentry>
  314. <varlistentry>
  315. <term>--with-log4cplus</term>
  316. <listitem>
  317. <simpara>Define the path to find the Log4cplus headers
  318. and libraries.
  319. </simpara>
  320. </listitem>
  321. </varlistentry>
  322. <varlistentry>
  323. <term>--with-openssl</term>
  324. <listitem>
  325. <simpara>Replace Botan by the OpenSSL the cryptographic library.
  326. By default <command>configure</command> searches for a valid
  327. Botan installation:
  328. if one is not found, it searches for OpenSSL.
  329. </simpara>
  330. </listitem>
  331. </varlistentry>
  332. </variablelist>
  333. <note>
  334. <para>
  335. For instructions concerning the installation and configuration
  336. of database backends for Kea, see <xref linkend="dhcp-install-configure"/>.
  337. For information 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 code or you'd like to use the Boost system library
  356. (assumed for the sake of this example to be 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 <command>configure</command> fails, it may be due to missing or old
  363. dependencies.
  364. </para>
  365. <para>
  366. If <command>configure</command> succeeds, it displays a report
  367. with the parameters used to build the code. This report is saved into
  368. the file <filename>config.report</filename> and is also embedded into
  369. the executable 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 <replaceable>prefix</replaceable>/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 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 allows 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 lacks 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
  440. written in a way that makes it possible to choose which database product
  441. should be used to store the lease information. At present, Kea supports
  442. four database backends: MySQL, PostgreSQL, Cassandra and Memfile. To
  443. limit external dependencies, MySQL, PostgreSQL and Cassandra support are
  444. disabled by default and only Memfile is available. Support for the
  445. optional external database backend must be explicitly included when Kea
  446. is built. This section covers the building of Kea with one of the
  447. optional backends and the creation of the lease database.
  448. </para>
  449. <note>
  450. <simpara>
  451. When unit tests are built with Kea (the --with-gtest configuration option is specified),
  452. the databases must be manually pre-configured for the unit tests to run.
  453. The details of this configuration can be found in the
  454. <ulink url="http://git.kea.isc.org/~tester/kea/doxygen">Kea Developer's
  455. Guide</ulink>.
  456. </simpara>
  457. </note>
  458. <section>
  459. <title>Building with MySQL Support</title>
  460. <para>
  461. Install MySQL according to the instructions for your system. The client development
  462. libraries must be installed.
  463. </para>
  464. <para>
  465. Build and install Kea as described in <xref linkend="installation"/>, with
  466. the following modification. To enable the MySQL database code, at the
  467. "configure" step (see <xref linkend="configure"/>), the --with-dhcp-mysql switch
  468. should be specified:
  469. <screen><userinput>./configure [other-options] --with-dhcp-mysql</userinput></screen>
  470. If MySQL was not installed in the default location, the location of the MySQL
  471. configuration program "mysql_config" should be included with the switch, i.e.
  472. <screen><userinput>./configure [other-options] --with-dhcp-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen>
  473. </para>
  474. <para>
  475. See <xref linkend="mysql-database-create"/> for details regarding
  476. MySQL database configuration.
  477. </para>
  478. </section>
  479. <section>
  480. <title>Building with PostgreSQL support</title>
  481. <para>
  482. Install PostgreSQL according to the instructions for your system. The client development
  483. libraries must be installed. Client development libraries are often packaged as &quot;libpq&quot;.
  484. </para>
  485. <para>
  486. Build and install Kea as described in <xref linkend="installation"/>, with
  487. the following modification. To enable the PostgreSQL database code, at the
  488. "configure" step (see <xref linkend="configure"/>), the --with-dhcp-pgsql switch
  489. should be specified:
  490. <screen><userinput>./configure [other-options] --with-dhcp-pgsql</userinput></screen>
  491. If PostgreSQL was not installed in the default location, the location of the PostgreSQL
  492. configuration program "pg_config" should be included with the switch, i.e.
  493. <screen><userinput>./configure [other-options] --with-dhcp-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen>
  494. </para>
  495. <para>
  496. See <xref linkend="pgsql-database-create"/> for details regarding
  497. PostgreSQL database configuration.
  498. </para>
  499. </section>
  500. <section>
  501. <title>Building with CQL (Cassandra) support</title>
  502. <para>
  503. Install Cassandra according to the instructions for your system. The
  504. Cassandra project website contains useful pointers: <ulink
  505. url="http://cassandra.apache.org" />.
  506. </para>
  507. <para>
  508. Download and compile cpp-driver from DataStax. For details regarding
  509. dependencies for building cpp-driver, see the project homepage
  510. <ulink url="https://github.com/datastax/cpp-driver" />. In June
  511. 2016, the following commands were used:
  512. <screen>
  513. $ <userinput>git clone https://github.com/datastax/cpp-driver</userinput>
  514. $ <userinput>cd cpp-driver</userinput>
  515. $ <userinput>mkdir build</userinput>
  516. $ <userinput>cmake ..</userinput>
  517. $ <userinput>make</userinput>
  518. </screen>
  519. </para>
  520. <para>
  521. As of June 2016, cpp-driver does not include cql_config script
  522. yet. Work is in progress to contribute such a script to the
  523. cpp-driver project but, until that is complete,
  524. intermediate steps that need to be conducted. A cql_config script is present in the
  525. tools/ directory of the Kea sources. Before using it, please
  526. edit cql_config_defines.sh in the same directory and change the
  527. environment variable CPP_DRIVER_PATH to point to the directory,
  528. where cpp-driver sources are located. (If the cpp-driver sources already
  529. provide cql_config script please use that rather than the version
  530. from Kea sources.)
  531. </para>
  532. <para>
  533. Build and install Kea as described in <xref linkend="installation"/>, with
  534. the following modification. To enable the Cassandra (CQL) database code, at the
  535. "configure" step (see <xref linkend="configure"/>), do:
  536. <screen><userinput>./configure [other-options] --with-cql=<replaceable>path-to-cql_config</replaceable></userinput></screen>
  537. </para>
  538. </section>
  539. </section>
  540. </chapter>