install.xml 22 KB

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