install.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY mdash "&#x2014;" >
  5. ]>
  6. <chapter id="installation">
  7. <title>Installation</title>
  8. <section id="packages">
  9. <title>Packages</title>
  10. <para>
  11. Some operating systems or software package vendors may provide
  12. ready-to-use, pre-built software packages for Kea. Installing a
  13. pre-built package means you do not need to install build-only
  14. prerequisites and do not need to <emphasis>make</emphasis> the software.
  15. </para>
  16. <para>
  17. FreeBSD ports, NetBSD pkgsrc, and Debian <emphasis>testing</emphasis>
  18. package collections provide all the prerequisite packages.
  19. </para>
  20. </section>
  21. <section id="install-hierarchy">
  22. <title>Install Hierarchy</title>
  23. <para>
  24. The following is the directory layout of the complete Kea installation
  25. (all directories paths are relative to the installation directory):
  26. <itemizedlist>
  27. <listitem>
  28. <simpara>
  29. <filename>etc/kea/</filename> &mdash;
  30. configuration files.
  31. </simpara>
  32. </listitem>
  33. <listitem>
  34. <simpara>
  35. <filename>include/</filename> &mdash;
  36. C++ development header files.
  37. </simpara>
  38. </listitem>
  39. <listitem>
  40. <simpara>
  41. <filename>lib/</filename> &mdash;
  42. libraries.
  43. </simpara>
  44. </listitem>
  45. <listitem>
  46. <simpara>
  47. <filename>sbin/</filename> &mdash;
  48. server software and commands used by the system administrator.
  49. </simpara>
  50. </listitem>
  51. <listitem>
  52. <simpara>
  53. <filename>share/kea/</filename> &mdash;
  54. configuration specifications and examples.
  55. </simpara>
  56. </listitem>
  57. <listitem>
  58. <simpara>
  59. <filename>share/doc/kea/</filename> &mdash;
  60. this guide, other supplementary documentation, and examples.
  61. </simpara>
  62. </listitem>
  63. <listitem>
  64. <simpara>
  65. <filename>share/man/</filename> &mdash;
  66. manual pages (online documentation).
  67. </simpara>
  68. </listitem>
  69. <listitem>
  70. <simpara>
  71. <filename>var/kea/</filename> &mdash;
  72. server identification, lease databases, and log files.
  73. </simpara>
  74. </listitem>
  75. </itemizedlist>
  76. </para>
  77. </section>
  78. <section id="build-requirements">
  79. <title>Building Requirements</title>
  80. <para>
  81. In addition to the run-time requirements (listed in <xref
  82. linkend="required-software"/>), building Kea from source code requires
  83. various development include headers and program development tools.
  84. </para>
  85. <note>
  86. <simpara>
  87. Some operating systems have split their distribution packages into
  88. a run-time and a development package. You will need to install
  89. the development package versions, which include header files and
  90. libraries, to build Kea from the source code.
  91. </simpara>
  92. </note>
  93. <para>
  94. Building from source code requires the following software installed
  95. on the system:</para>
  96. <itemizedlist>
  97. <listitem>
  98. <para>Boost build-time headers
  99. (<ulink url="http://www.boost.org/"/>).
  100. At least Boost version 1.35 is required.
  101. <!-- TODO: we don't check for this version -->
  102. <!-- NOTE: jreed has tested with 1.34, 1.38, and 1.41. -->
  103. </para>
  104. </listitem>
  105. <listitem>
  106. <para>
  107. Botan (at least version 1.8) or OpenSSL.</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
  123. standard development headers.
  124. Kea builds have been tested with GCC g++ 3.4.3, 4.1.2,
  125. 4.1.3, 4.2.1, 4.3.2, and 4.4.1; Clang++ 2.8; and Sun C++ 5.10.
  126. <!-- @todo update this list -->
  127. </para>
  128. </listitem>
  129. <listitem>
  130. <para>
  131. The development tools "make" and "pkg-config".
  132. <!-- @todo update this list, pkg-config shouldn't be required -->
  133. </para>
  134. </listitem>
  135. </itemizedlist>
  136. <para>
  137. Visit the user-contributed wiki at <ulink
  138. url="http://kea.isc.org/wiki/SystemSpecificNotes" />
  139. for system-specific installation tips.
  140. </para>
  141. </section>
  142. <section id="install">
  143. <title>Installation from Source</title>
  144. <para>
  145. Kea is open source software written in C++.
  146. It is freely available in source code form from ISC as a
  147. downloadable tar file or via Kea Git code revision control
  148. service. (It may also be available in pre-compiled ready-to-use
  149. packages from operating system vendors.)
  150. </para>
  151. <section>
  152. <title>Download Tar File</title>
  153. <para>
  154. The Kea release tarballs may be downloaded from:
  155. <ulink url="http://ftp.isc.org/isc/kea/"/> (using FTP or HTTP).
  156. </para>
  157. </section>
  158. <section>
  159. <title>Retrieve from Git</title>
  160. <para>
  161. Downloading this "bleeding edge" code is recommended only for
  162. developers or advanced users. Using development code in a production
  163. environment is not recommended.
  164. </para>
  165. <note>
  166. <para>
  167. When building from source code retrieved via Git, additional
  168. software will be required: automake (v1.11 or later),
  169. libtoolize, and autoconf (2.59 or later).
  170. These may need to be installed.
  171. </para>
  172. </note>
  173. <para>
  174. The latest development code (together with temporary experiments
  175. and un-reviewed code) is available via the Kea code revision
  176. control system. This is powered by Git and all the Kea
  177. development is public.
  178. The leading development is done in the <quote>master</quote>
  179. branch.
  180. </para>
  181. <para>
  182. The code can be checked out from
  183. <filename>git://git.kea.isc.org/kea</filename>:
  184. <screen>$ <userinput>git clone git://git.kea.isc.org/kea</userinput></screen>
  185. </para>
  186. <para>
  187. The code checked out from the git repository doesn't include the
  188. generated configure script, Makefile.in files, nor their
  189. related build files.
  190. They can be created by running <command>autoreconf</command>
  191. with the <option>--install</option> switch.
  192. This will run <command>autoconf</command>,
  193. <command>aclocal</command>,
  194. <command>libtoolize</command>,
  195. <command>autoheader</command>,
  196. <command>automake</command>,
  197. and related commands.
  198. </para>
  199. </section>
  200. <section id="configure">
  201. <title>Configure before the build</title>
  202. <para>
  203. Kea uses the GNU Build System to discover build environment
  204. details.
  205. To generate the makefiles using the defaults, simply run:
  206. <screen>$ <userinput>./configure</userinput></screen>
  207. </para>
  208. <para>
  209. Run <command>./configure</command> with the <option>--help</option>
  210. switch to view the different options. Some commonly-used options are:
  211. <variablelist>
  212. <varlistentry>
  213. <term>--prefix</term>
  214. <listitem>
  215. <simpara>Define the installation location (the
  216. default is <filename>/usr/local</filename>).
  217. </simpara>
  218. </listitem>
  219. </varlistentry>
  220. <varlistentry>
  221. <term>--with-boost-include</term>
  222. <listitem>
  223. <simpara>Define the path to find the Boost headers.
  224. </simpara>
  225. </listitem>
  226. </varlistentry>
  227. <varlistentry>
  228. <term>--with-botan-config</term>
  229. <listitem>
  230. <simpara>To specific the path to the botan-config
  231. script to build with Botan for the crypto code.
  232. </simpara>
  233. </listitem>
  234. </varlistentry>
  235. <varlistentry>
  236. <term>--with-gtest</term>
  237. <listitem>
  238. <simpara>Enable the building of the C++ Unit Tests using the
  239. Google Test framework. Optionally this can define the
  240. path to the gtest header files and library. (If the framework
  241. is not already installed on your system, it can be downloaded
  242. from <ulink url="https://code.google.com/p/googletest"/>.)
  243. </simpara>
  244. </listitem>
  245. </varlistentry>
  246. <varlistentry>
  247. <term>--with-log4cplus</term>
  248. <listitem>
  249. <simpara>Define the path to find the Log4cplus headers
  250. and libraries.
  251. </simpara>
  252. </listitem>
  253. </varlistentry>
  254. <varlistentry>
  255. <term>--with-openssl</term>
  256. <listitem>
  257. <simpara>Replace Botan by OpenSSL for the crypto library.
  258. The default is to try to find a working Botan then
  259. OpenSSL only if Botan is not found.
  260. </simpara>
  261. </listitem>
  262. </varlistentry>
  263. <varlistentry>
  264. <term>--without-werror</term>
  265. <listitem>
  266. <simpara>Disable the default use of the
  267. <option>-Werror</option> compiler flag so that
  268. compiler warnings do not result in build failures.
  269. </simpara>
  270. </listitem>
  271. </varlistentry>
  272. </variablelist>
  273. <note>
  274. <para>
  275. For additional instructions concerning the building and installation of
  276. Kea for various databases, see <xref linkend="dhcp-install-configure"/>.
  277. For additional instructions concerning configuration backends, see
  278. <xref linkend="dhcp-config-backend" />.
  279. </para>
  280. </note>
  281. </para>
  282. <!-- TODO: lcov -->
  283. <para>
  284. For example, the following command configures Kea to find the
  285. Boost headers in /usr/pkg/include, specifies that PostgreSQL
  286. support should be enabled, and sets the installation location
  287. to /opt/kea:
  288. <screen>$ <userinput>./configure \
  289. --with-boost-include=/usr/pkg/include \
  290. --with-dhcp-pgsql=/usr/local/bin/pg_config \
  291. --prefix=/opt/kea</userinput></screen>
  292. </para>
  293. <para>
  294. If the configure fails, it may be due to missing or old
  295. dependencies.
  296. </para>
  297. </section>
  298. <section>
  299. <title>Build</title>
  300. <para>
  301. After the configure step is complete, build the executables
  302. from the C++ code and prepare the Python scripts by running the command:
  303. <screen>$ <userinput>make</userinput></screen>
  304. </para>
  305. </section>
  306. <section>
  307. <title>Install</title>
  308. <para>
  309. To install the Kea executables, support files,
  310. and documentation, issue the command:
  311. <screen>$ <userinput>make install</userinput></screen>
  312. </para>
  313. <para>
  314. Do not use any form of parallel or job server options
  315. (such as GNU make's <command>-j</command> option) when
  316. performing this step: doing so may cause errors.
  317. </para>
  318. <note>
  319. <para>The install step may require superuser privileges.</para>
  320. </note>
  321. <para>
  322. If required, run <command>ldconfig</command> as root with
  323. <filename>/usr/local/lib</filename> (or with ${prefix}/lib if
  324. configured with --prefix) in
  325. <filename>/etc/ld.so.conf</filename> (or the relevant linker
  326. cache configuration file for your OS):
  327. <screen>$ <userinput>ldconfig</userinput></screen>
  328. </para>
  329. <note>
  330. <para>
  331. If you do not run <command>ldconfig</command> where it is
  332. required, you may see errors like the following:
  333. <screen>
  334. program: error while loading shared libraries: libkea-something.so.1:
  335. cannot open shared object file: No such file or directory
  336. </screen>
  337. </para>
  338. </note>
  339. </section>
  340. <!-- @todo: tests -->
  341. </section>
  342. <section id="dhcp-config-backend">
  343. <title>Selecting the Configuration Backend</title>
  344. <para>Kea 0.9 introduces configuration backends that are
  345. switchable during compilation phase. The backend is chosen using
  346. the --with-kea-config switch when running the configure script. It
  347. currently supports two values: BUNDY and JSON. JSON is the default.
  348. </para>
  349. <variablelist>
  350. <varlistentry>
  351. <term>BUNDY</term>
  352. <listitem>
  353. <simpara>BUNDY means
  354. that Kea is linked with the Bundy configuration backend that
  355. connects to the Bundy framework and in general works exactly the
  356. same as Kea 0.8 and earlier BIND10 versions. The benefits
  357. of that backend are uniform integration with the Bundy
  358. framework, easy on-line reconfiguration using bindctl,
  359. available RESTful API. On the other hand, it requires
  360. the whole heavy Bundy framework that requires Python3
  361. to be present. That backend is likely to go away with
  362. the release of Kea 1.0.</simpara>
  363. </listitem>
  364. </varlistentry>
  365. <varlistentry>
  366. <term>JSON</term>
  367. <listitem>
  368. <simpara>JSON is a new default configuration backend
  369. that causes Kea to read JSON configuration file from
  370. disk. It does not require any framework and thus is
  371. considered more lightweight. It will allow dynamic
  372. on-line reconfiguration, but will lack remote capabilities
  373. (i.e. no RESTful API).</simpara>
  374. </listitem>
  375. </varlistentry>
  376. </variablelist>
  377. </section>
  378. <section id="dhcp-install-configure">
  379. <title>DHCP Database Installation and Configuration</title>
  380. <para>
  381. Kea stores its leases in a lease database. The software has been written in
  382. a way that makes it possible to choose which database product should be used to
  383. store the lease information. At present, Kea supports three database backends: MySQL,
  384. PostgreSQL and Memfile. To limit external dependencies, both MySQL and PostgreSQL
  385. support are disabled by default and only Memfile
  386. is available. Support for the optional external database backend must be explicitly included when
  387. Kea is built. This section covers the building of Kea with MySQL and/or PostgreSQL
  388. and the creation of the lease database.
  389. </para>
  390. <section>
  391. <title>Building with MySQL Support</title>
  392. <para>
  393. Install MySQL according to the instructions for your system. The client development
  394. libraries must be installed.
  395. </para>
  396. <para>
  397. Build and install Kea as described in <xref linkend="installation"/>, with
  398. the following modification. To enable the MySQL database code, at the
  399. "configure" step (see <xref linkend="configure"/>), do:
  400. <screen><userinput>./configure [other-options] --with-dhcp-mysql</userinput></screen>
  401. Or specify the location of the MySQL configuration program
  402. "mysql_config" if MySQL was not installed in the default location:
  403. <screen><userinput>./configure [other-options] --with-dhcp-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen>
  404. </para>
  405. </section>
  406. <section id="dhcp-mysql-database-create">
  407. <title>Create the MySQL Database and the Kea User</title>
  408. <para>
  409. The next task is to create both the lease database and the user under which the servers will
  410. access it. A number of steps are required:
  411. </para>
  412. <para>
  413. 1. Log into MySQL as "root":
  414. <screen>$ <userinput>mysql -u root -p</userinput>
  415. Enter password:<userinput/>
  416. :<userinput/>
  417. mysql></screen>
  418. </para>
  419. <para>
  420. 2. Create the database:
  421. <screen>mysql> <userinput>CREATE DATABASE <replaceable>database-name</replaceable>;</userinput></screen>
  422. (<replaceable>database-name</replaceable> is the name you
  423. have chosen for the database.)
  424. </para>
  425. <para>
  426. 3. Create the database tables by running the dhcpdb_create.mysql script supplied as part of Kea:
  427. <screen>mysql> <userinput>CONNECT <replaceable>database-name</replaceable>;</userinput>
  428. mysql> <userinput>SOURCE <replaceable>path-to-kea</replaceable>/share/kea/dhcpdb_create.mysql</userinput></screen>
  429. </para>
  430. <para>
  431. 4. Create the user under which Kea will access the database (and give it a password), then grant it access to the database tables:
  432. <screen>mysql> <userinput>CREATE USER '<replaceable>user-name</replaceable>'@'localhost' IDENTIFIED BY '<replaceable>password</replaceable>';</userinput>
  433. mysql> <userinput>GRANT ALL ON <replaceable>database-name</replaceable>.* TO '<replaceable>user-name</replaceable>'@'localhost';</userinput></screen>
  434. </para>
  435. <para>
  436. 5. Exit MySQL:
  437. <screen>mysql> <userinput>quit</userinput>
  438. Bye<userinput/>
  439. $</screen>
  440. </para>
  441. </section>
  442. <section>
  443. <title>Building with PostgreSQL support</title>
  444. <para>
  445. Install PostgreSQL according to the instructions for your system. The client development
  446. libraries must be installed. Client development libraries are often packaged as &quot;libpq&quot;.
  447. </para>
  448. <para>
  449. Build and install Kea as described in <xref linkend="installation"/>, with
  450. the following modification. To enable the PostgreSQL database code, at the
  451. "configure" step (see <xref linkend="configure"/>), do:
  452. <screen><userinput>./configure [other-options] --with-dhcp-pgsql</userinput></screen>
  453. Or specify the location of the PostgreSQL configuration
  454. program "pg_config" if PostgreSQL was not installed in
  455. the default location:
  456. <screen><userinput>./configure [other-options] --with-dhcp-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen>
  457. </para>
  458. </section>
  459. <section id="dhcp-pgsql-database-create">
  460. <title>Create PostgreSQL Database and Kea User</title>
  461. <para>
  462. The next task is to create both the lease database and the user under which the servers will
  463. access it. A number of steps are required:
  464. </para>
  465. <para>
  466. 1. Log into PostgreSQL as "root":
  467. <screen>$ <userinput>sudo -u postgres psql postgres</userinput>
  468. Enter password:<userinput/>
  469. :<userinput/>
  470. postgres=#</screen>
  471. </para>
  472. <para>
  473. 2. Create the database:
  474. <screen>
  475. postgres=#<userinput> CREATE DATABASE <replaceable>database-name</replaceable>;</userinput>
  476. CREATE DATABASE
  477. postgres=#
  478. </screen>
  479. (<replaceable>database-name</replaceable> is the name you
  480. have chosen for the database.)
  481. </para>
  482. <para>
  483. 3. Create the user under which Kea will access the database (and give it a password), then grant it access to the database:
  484. <screen>postgres=#<userinput> CREATE USER <replaceable>user-name</replaceable> WITH PASSWORD '<replaceable>password</replaceable>';</userinput>
  485. CREATE ROLE
  486. postgres=#
  487. postgres=#<userinput> GRANT ALL PRIVILEGES ON DATABASE <replaceable>database-name</replaceable> TO <replaceable>user-name</replaceable>;</userinput>
  488. GRANT
  489. postgres=#
  490. </screen>
  491. </para>
  492. <para>
  493. 4. Exit PostgreSQL:
  494. <screen>postgres=# <userinput>\q</userinput>
  495. Bye<userinput/>
  496. $</screen>
  497. </para>
  498. <para>
  499. 5. Create the database tables using the new user's credentials and the dhcpdb_create.pgsql script supplied with Kea.
  500. After entering the following command, you will be prompted for the new
  501. user's password. When the command completes you will be returned to
  502. the shell prompt. You should see output similar to following:
  503. <screen>$ <userinput>psql -d <replaceable>database-name</replaceable> -U <replaceable>user-name</replaceable> -f <replaceable>path-to-kea</replaceable>/share/kea/dhcpdb_create.pgsql</userinput>
  504. Password for user <replaceable>user-name</replaceable>:
  505. CREATE TABLE
  506. CREATE INDEX
  507. CREATE INDEX
  508. CREATE TABLE
  509. CREATE INDEX
  510. CREATE TABLE
  511. START TRANSACTION
  512. INSERT 0 1
  513. INSERT 0 1
  514. INSERT 0 1
  515. COMMIT
  516. CREATE TABLE
  517. START TRANSACTION
  518. INSERT 0 1
  519. COMMIT
  520. $
  521. </screen>
  522. </para>
  523. <para>
  524. If instead you encounter an error like:
  525. </para>
  526. <screen>
  527. psql: FATAL: no pg_hba.conf entry for host "[local]", user "<replaceable>user-name</replaceable>", database "<replaceable>database-name</replaceable>", SSL off
  528. </screen>
  529. <para>
  530. ... you will need to alter the PostgreSQL configuration.
  531. Kea uses password authentication when connecting to the database and must
  532. have the appropriate entries added to PostgreSQL's pg_hba.conf file. This
  533. file is normally located in the primary data directory for your PostgreSQL
  534. server. The precise path may vary but the default location for PostgreSQL 9.3
  535. on Centos 6.5 is:
  536. <filename>/var/lib/pgsql/9.3/data/pg_hba.conf</filename>.
  537. Assuming Kea is running on the same host as PostgreSQL, adding lines similar
  538. to following should be sufficient to provide password-authenticated access to
  539. Kea's database:
  540. </para>
  541. <screen>
  542. local <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> password
  543. host <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> 127.0.0.1/32 password
  544. host <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> ::1/128 password
  545. </screen>
  546. <para>
  547. Please consult your PostgreSQL user manual before making these changes as they
  548. may expose your other databases that you run on the same system.
  549. </para>
  550. </section>
  551. </section>
  552. </chapter>