install.xml 23 KB

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