install.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  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>--without-werror</term>
  270. <listitem>
  271. <simpara>Disable the default use of the
  272. <option>-Werror</option> compiler flag so that
  273. compiler warnings do not result in build failures.
  274. </simpara>
  275. </listitem>
  276. </varlistentry>
  277. </variablelist>
  278. <note>
  279. <para>
  280. For additional instructions concerning the building and installation of
  281. Kea for various databases, see <xref linkend="dhcp-install-configure"/>.
  282. For additional instructions concerning configuration backends, see
  283. <xref linkend="dhcp-config-backend" />.
  284. </para>
  285. </note>
  286. </para>
  287. <!-- TODO: lcov -->
  288. <para>
  289. For example, the following command configures Kea to find the
  290. Boost headers in /usr/pkg/include, specifies that PostgreSQL
  291. support should be enabled, and sets the installation location
  292. to /opt/kea:
  293. <screen>$ <userinput>./configure \
  294. --with-boost-include=/usr/pkg/include \
  295. --with-dhcp-pgsql=/usr/local/bin/pg_config \
  296. --prefix=/opt/kea</userinput></screen>
  297. </para>
  298. <para>
  299. If the configure fails, it may be due to missing or old
  300. dependencies.
  301. </para>
  302. </section>
  303. <section>
  304. <title>Build</title>
  305. <para>
  306. After the configure step is complete, build the executables
  307. from the C++ code and prepare the Python scripts by running the command:
  308. <screen>$ <userinput>make</userinput></screen>
  309. </para>
  310. </section>
  311. <section>
  312. <title>Install</title>
  313. <para>
  314. To install the Kea executables, support files,
  315. and documentation, issue the command:
  316. <screen>$ <userinput>make install</userinput></screen>
  317. </para>
  318. <para>
  319. Do not use any form of parallel or job server options
  320. (such as GNU make's <command>-j</command> option) when
  321. performing this step: doing so may cause errors.
  322. </para>
  323. <note>
  324. <para>The install step may require superuser privileges.</para>
  325. </note>
  326. <para>
  327. If required, run <command>ldconfig</command> as root with
  328. <filename>/usr/local/lib</filename> (or with ${prefix}/lib if
  329. configured with --prefix) in
  330. <filename>/etc/ld.so.conf</filename> (or the relevant linker
  331. cache configuration file for your OS):
  332. <screen>$ <userinput>ldconfig</userinput></screen>
  333. </para>
  334. <note>
  335. <para>
  336. If you do not run <command>ldconfig</command> where it is
  337. required, you may see errors like the following:
  338. <screen>
  339. program: error while loading shared libraries: libkea-something.so.1:
  340. cannot open shared object file: No such file or directory
  341. </screen>
  342. </para>
  343. </note>
  344. </section>
  345. <!-- @todo: tests -->
  346. </section>
  347. <section id="dhcp-config-backend">
  348. <title>Selecting the Configuration Backend</title>
  349. <para>Kea 0.9 introduces configuration backends that are
  350. switchable during compilation phase. The backend is chosen using
  351. the --with-kea-config switch when running the configure script. It
  352. currently supports two values: BIND10 and JSON. This is currently
  353. only supported by DHCPv6 component.</para>
  354. <variablelist>
  355. <varlistentry>
  356. <term>BIND10</term>
  357. <listitem>
  358. <simpara>BIND10 (which is the default value as of April 2014) means
  359. that Kea6 is linked with the BIND10 configuration backend that
  360. connects to the BIND10 framework and in general works exactly the
  361. same as Kea 0.8 and earlier versions. The benefits of that backend
  362. are uniform integration with BIND10 framework, easy on-line
  363. reconfiguration using bindctl, available RESTful API. On the other
  364. hand, it requires the whole heavy BIND10 framework that requires
  365. Python3 to be present. That backend is likely to go away with the
  366. release of Kea 0.9.</simpara>
  367. </listitem>
  368. </varlistentry>
  369. <varlistentry>
  370. <term>JSON</term>
  371. <listitem>
  372. <simpara>JSON is a new configuration backend that causes Kea to read
  373. JSON configuration file from disk. It does not require any framework
  374. and thus is considered more lightweight. It will allow dynamic
  375. on-line reconfiguration, but will lack remote capabilities (i.e. no
  376. RESTful API). This configuration backend is expected to be the
  377. default for upcoming Kea 0.9.</simpara>
  378. </listitem>
  379. </varlistentry>
  380. </variablelist>
  381. </section>
  382. <section id="dhcp-install-configure">
  383. <title>DHCP Database Installation and Configuration</title>
  384. <para>
  385. Kea stores its leases in a lease database. The software has been written in
  386. a way that makes it possible to choose which database product should be used to
  387. store the lease information. At present, Kea supports three database backends: MySQL,
  388. PostgreSQL and Memfile. To limit external dependencies, both MySQL and PostgreSQL
  389. support are disabled by default and only Memfile (which is implemented in pure C++)
  390. is available. Support for a given database backend must be explicitly included when
  391. Kea is built. This section covers the building of Kea with MySQL and/or PostgreSQL
  392. and the creation of the lease database.
  393. </para>
  394. <section>
  395. <title>Building with MySQL Support</title>
  396. <para>
  397. Install MySQL according to the instructions for your system. The client development
  398. libraries must be installed.
  399. </para>
  400. <para>
  401. Build and install Kea as described in <xref linkend="installation"/>, with
  402. the following modification: to enable the MySQL database code, at the
  403. "configure" step (see <xref linkend="configure"/>), specify the location of the
  404. MySQL configuration program "mysql_config" with the "--with-dhcp-mysql" switch,
  405. i.e.
  406. <screen><userinput>./configure [other-options] --with-dhcp-mysql</userinput></screen>
  407. ...if MySQL was installed in the default location, or:
  408. <screen><userinput>./configure [other-options] --with-dhcp-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen>
  409. ...if not.
  410. </para>
  411. </section>
  412. <section id="dhcp-mysql-database-create">
  413. <title>Create the MySQL Database and the Kea User</title>
  414. <para>
  415. The next task is to create both the lease database and the user under which the servers will
  416. access it. A number of steps are required:
  417. </para>
  418. <para>
  419. 1. Log into MySQL as "root":
  420. <screen>$ <userinput>mysql -u root -p</userinput>
  421. Enter password:<userinput/>
  422. :<userinput/>
  423. mysql></screen>
  424. </para>
  425. <para>
  426. 2. Create the database:
  427. <screen>mysql> <userinput>CREATE DATABASE <replaceable>database-name</replaceable>;</userinput></screen>
  428. ... <replaceable>database-name</replaceable> is the name you have chosen for the database.
  429. </para>
  430. <para>
  431. 3. Create the database tables by running the dhcpdb_create.mysql script supplied as part of Kea:
  432. <screen>mysql> <userinput>CONNECT <replaceable>database-name</replaceable>;</userinput>
  433. mysql> <userinput>SOURCE <replaceable>path-to-bind10</replaceable>/share/bind10/dhcpdb_create.mysql</userinput></screen>
  434. </para>
  435. <para>
  436. 4. Create the user under which Kea will access the database (and give it a password), then grant it access to the database tables:
  437. <screen>mysql> <userinput>CREATE USER '<replaceable>user-name</replaceable>'@'localhost' IDENTIFIED BY '<replaceable>password</replaceable>';</userinput>
  438. mysql> <userinput>GRANT ALL ON <replaceable>database-name</replaceable>.* TO '<replaceable>user-name</replaceable>'@'localhost';</userinput></screen>
  439. </para>
  440. <para>
  441. 5. Exit MySQL:
  442. <screen>mysql> <userinput>quit</userinput>
  443. Bye<userinput/>
  444. $</screen>
  445. </para>
  446. </section>
  447. <section>
  448. <title>Building with PostgreSQL support</title>
  449. <para>
  450. Install PostgreSQL according to the instructions for your system. The client development
  451. libraries must be installed. Client development libraries are often packaged as &quot;libpq&quot;.
  452. </para>
  453. <para>
  454. Build and install Kea as described in <xref linkend="installation"/>, with
  455. the following modification: to enable the PostgreSQL database code, at the
  456. "configure" step (see <xref linkend="configure"/>), specify the location of the
  457. PostgreSQL configuration program "pg_config" with the "--with-dhcp-pgsql" switch,
  458. i.e.
  459. <screen><userinput>./configure [other-options] --with-dhcp-pgsql</userinput></screen>
  460. ...if PostgreSQL was installed in the default location, or:
  461. <screen><userinput>./configure [other-options] --with-dhcp-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen>
  462. ...if not.
  463. </para>
  464. </section>
  465. <section id="dhcp-pgsql-database-create">
  466. <title>Create PostgreSQL Database and Kea User</title>
  467. <para>
  468. The next task is to create both the lease database and the user under which the servers will
  469. access it. A number of steps are required:
  470. </para>
  471. <para>
  472. 1. Log into PostgreSQL as "root":
  473. <screen>$ <userinput>sudo -u postgres psql postgres</userinput>
  474. Enter password:<userinput/>
  475. :<userinput/>
  476. postgres=#</screen>
  477. </para>
  478. <para>
  479. 2. Create the database:
  480. <screen>
  481. postgres=#<userinput> CREATE DATABASE <replaceable>database-name</replaceable>;</userinput>
  482. CREATE DATABASE
  483. postgres=#
  484. </screen>
  485. ... <replaceable>database-name</replaceable> is the name you have chosen for the database.
  486. </para>
  487. <para>
  488. 3. Create the user under which Kea will access the database (and give it a password), then grant it access to the database:
  489. <screen>postgres=#<userinput> CREATE USER <replaceable>user-name</replaceable> WITH PASSWORD '<replaceable>password</replaceable>';</userinput>
  490. CREATE ROLE
  491. postgres=#
  492. postgres=#<userinput> GRANT ALL PRIVILEGES ON DATABASE <replaceable>database-name</replaceable> TO <replaceable>user-name</replaceable>;</userinput>
  493. GRANT
  494. postgres=#
  495. </screen>
  496. </para>
  497. <para>
  498. 4. Exit PostgreSQL:
  499. <screen>postgres=# <userinput>\q</userinput>
  500. Bye<userinput/>
  501. $</screen>
  502. </para>
  503. <para>
  504. 5. Create the database tables using the new user's credentials and the dhcpdb_create.pgsql script supplied with Kea.
  505. After entering the following command, you will be prompted for the new
  506. user's password. When the command completes you will be returned to
  507. the shell prompt. You should see output similar to following:
  508. <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>
  509. Password for user <replaceable>user-name</replaceable>:
  510. CREATE TABLE
  511. CREATE INDEX
  512. CREATE INDEX
  513. CREATE TABLE
  514. CREATE INDEX
  515. CREATE TABLE
  516. START TRANSACTION
  517. INSERT 0 1
  518. INSERT 0 1
  519. INSERT 0 1
  520. COMMIT
  521. CREATE TABLE
  522. START TRANSACTION
  523. INSERT 0 1
  524. COMMIT
  525. $
  526. </screen>
  527. </para>
  528. <para>
  529. If instead you encounter an error like:
  530. </para>
  531. <screen>
  532. psql: FATAL: no pg_hba.conf entry for host "[local]", user "<replaceable>user-name</replaceable>", database "<replaceable>database-name</replaceable>", SSL off
  533. </screen>
  534. <para>
  535. ... you will need to alter the PostgreSQL configuration.
  536. Kea uses password authentication when connecting to the database and must
  537. have the appropriate entries added to PostgreSQL's pg_hba.conf file. This
  538. file is normally located in the primary data directory for your PostgreSQL
  539. server. The precise path may vary but the default location for PostgreSQL 9.3
  540. on Centos 6.5 is:
  541. <filename>/var/lib/pgsql/9.3/data/pg_hba.conf</filename>.
  542. Assuming Kea is running on the same host as PostgreSQL, adding lines similar
  543. to following should be sufficient to provide password-authenticated access to
  544. Kea's database:
  545. </para>
  546. <screen>
  547. local <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> password
  548. host <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> 127.0.0.1/32 password
  549. host <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> ::1/128 password
  550. </screen>
  551. <para>
  552. Please consult your PostgreSQL user manual before making these changes as they
  553. may expose your other databases that you run on the same system.
  554. </para>
  555. </section>
  556. </section>
  557. </chapter>