install.xml 22 KB

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