123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
- <!ENTITY mdash "—" >
- ]>
- <chapter id="installation">
- <title>Installation</title>
- <section id="packages">
- <title>Packages</title>
- <para>
- Some operating systems or software package vendors may provide
- ready-to-use, pre-built software packages for Kea. Installing a
- pre-built package means you do not need to install build-only
- prerequisites and do not need to <emphasis>make</emphasis> the software.
- </para>
- <para>
- FreeBSD ports, NetBSD pkgsrc, and Debian <emphasis>testing</emphasis>
- package collections provide all the prerequisite packages.
- </para>
- </section>
- <section id="install-hierarchy">
- <title>Install Hierarchy</title>
- <para>
- The following is the directory layout of the complete Kea installation
- (all directories paths are relative to the installation directory):
- <itemizedlist>
- <listitem>
- <simpara>
- <filename>bin/</filename> —
- general tools and diagnostic clients.
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <!-- @todo: 0.9: update this -->
- <filename>etc/bind10/</filename> —
- configuration files.
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <filename>lib/</filename> —
- libraries and python modules.
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <!-- @todo 0.9: update this -->
- <filename>libexec/bind10/</filename> —
- executables that a user wouldn't normally run directly and
- are not run independently.
- These are the BIND 10 and Kea modules which are daemons started by
- the <command>b10-init</command> master process.
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <filename>sbin/</filename> —
- commands used by the system administrator.
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <!-- @todo 0.9: update this -->
- <filename>share/bind10/</filename> —
- configuration specifications.
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <!-- @todo 0.9: update this -->
- <filename>share/doc/bind10/</filename> —
- this guide and other supplementary documentation.
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <filename>share/man/</filename> —
- manual pages (online documentation).
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <!-- @todo 0.9: update this -->
- <filename>var/bind10/</filename> —
- data source and configuration databases.
- </simpara>
- </listitem>
- </itemizedlist>
- </para>
- </section>
- <section id="build-requirements">
- <title>Building Requirements</title>
- <para>
- In addition to the run-time requirements (listed in <xref
- linkend="required-software"/>), building Kea from source code requires
- various development include headers and program development tools.
- </para>
- <note>
- <simpara>
- Some operating systems have split their distribution packages into
- a run-time and a development package. You will need to install
- the development package versions, which include header files and
- libraries, to build Kea from the source code.
- </simpara>
- </note>
- <para>
- Building from source code requires the following software installed
- on the system:</para>
- <itemizedlist>
- <listitem>
- <para>Boost build-time headers
- (<ulink url="http://www.boost.org/"/>).
- At least Boost version 1.35 is required.
- <!-- TODO: we don't check for this version -->
- <!-- NOTE: jreed has tested with 1.34, 1.38, and 1.41. -->
- </para>
- </listitem>
- <listitem>
- <para>
- Botan (at least version
- 1.8).</para>
- </listitem>
- <listitem>
- <para>
- log4cplus (at least version 1.0.3)
- development include headers.
- <!-- @todo: Add OpenSSL note here once #2406 is merged -->
- </para>
- </listitem>
- <!--
- TODO
- Debian and Ubuntu:
- libgmp3-dev and libbz2-dev required for botan too
- -->
- <!-- NOTE: _sqlite3 is only needed at test time; it is already listed
- as a dependency earlier -->
- <listitem>
- <para>
- A C++ compiler and
- standard development headers.
- Kea builds have been tested with GCC g++ 3.4.3, 4.1.2,
- 4.1.3, 4.2.1, 4.3.2, and 4.4.1; Clang++ 2.8; and Sun C++ 5.10.
- <!-- @todo update this list -->
- </para>
- </listitem>
- <listitem>
- <para>
- The development tools "make" and "pkg-config".
- <!-- @todo update this list -->
- </para>
- </listitem>
- </itemizedlist>
- <para>
- Visit the user-contributed wiki at <ulink
- url="http://kea.isc.org/wiki/SystemSpecificNotes" />
- for system-specific installation tips.
- </para>
- </section>
- <section id="install">
- <title>Installation from Source</title>
- <para>
- Kea is open source software written in C++ (some components of the
- BIND 10 framework are written in Python).
- It is freely available in source code form from ISC as a
- downloadable tar file or via Kea Git code revision control
- service. (It may also be available in pre-compiled ready-to-use
- packages from operating system vendors.)
- </para>
- <section>
- <title>Download Tar File</title>
- <para>
- Kea 0.8 is available as a part of BIND10 1.2 release, which is a final
- release of BIND10 from ISC. This release can be downloaded from:
- <ulink url="ftp://ftp.isc.org/isc/bind10/"/>. The upcoming Kea 0.9 and all
- following releases will be shipped as a stand-alone tarball.
- </para>
- </section>
- <section>
- <title>Retrieve from Git</title>
- <para>
- Downloading this "bleeding edge" code is recommended only for
- developers or advanced users. Using development code in a production
- environment is not recommended.
- </para>
- <note>
- <para>
- When building from source code retrieved via Git, additional
- software will be required: automake (v1.11 or later),
- libtoolize, and autoconf (2.59 or later).
- These may need to be installed.
- </para>
- </note>
- <para>
- The latest development code (together with temporary experiments
- and un-reviewed code) is available via the Kea code revision
- control system. This is powered by Git and all the Kea
- development is public.
- The leading development is done in the <quote>master</quote>
- branch.
- </para>
- <para>
- The code can be checked out from
- <filename>git://git.kea.isc.org/kea</filename>:
- <screen>$ <userinput>git clone git://git.kea.isc.org/kea</userinput></screen>
- </para>
- <para>
- The code checked out from the git repository doesn't include the
- generated configure script, Makefile.in files, nor their
- related build files.
- They can be created by running <command>autoreconf</command>
- with the <option>--install</option> switch.
- This will run <command>autoconf</command>,
- <command>aclocal</command>,
- <command>libtoolize</command>,
- <command>autoheader</command>,
- <command>automake</command>,
- and related commands.
- </para>
- </section>
- <section id="configure">
- <title>Configure before the build</title>
- <para>
- Kea uses the GNU Build System to discover build environment
- details.
- To generate the makefiles using the defaults, simply run:
- <screen>$ <userinput>./configure</userinput></screen>
- </para>
- <para>
- Run <command>./configure</command> with the <option>--help</option>
- switch to view the different options. Some commonly-used options are:
- <variablelist>
- <varlistentry>
- <term>--prefix</term>
- <listitem>
- <simpara>Define the installation location (the
- default is <filename>/usr/local</filename>).
- </simpara>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--with-boost-include</term>
- <listitem>
- <simpara>Define the path to find the Boost headers.
- </simpara>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--with-pythonpath</term>
- <listitem>
- <simpara>Define the path to Python 3.x if it is not in the
- standard execution path. Python 3.x is mandatory for Kea 0.8,
- but will not be required for the upcoming Kea 0.9.
- </simpara>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--with-gtest</term>
- <listitem>
- <simpara>Enable the building of the C++ Unit Tests using the
- Google Test framework. Optionally this can define the
- path to the gtest header files and library. (If the framework
- is not already installed on your system, it can be downloaded
- from <ulink url="https://code.google.com/p/googletest"/>.)
- </simpara>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--with-openssl</term>
- <listitem>
- <simpara>Replace Botan by OpenSSL for the crypto library.
- The default is to try to find a working Botan then
- OpenSSL only if Botan is not found.
- </simpara>
- </listitem>
- </varlistentry>
- <!-- missing -with-botan-config -->
- <varlistentry>
- <term>--without-werror</term>
- <listitem>
- <simpara>Disable the default use of the
- <option>-Werror</option> compiler flag so that
- compiler warnings do not result in build failures.
- </simpara>
- </listitem>
- </varlistentry>
- </variablelist>
- <note>
- <para>
- For additional instructions concerning the building and installation of
- Kea for various databases, see <xref linkend="dhcp-install-configure"/>.
- For additional instructions concerning configuration backends, see
- <xref linkend="dhcp-config-backend" />.
- </para>
- </note>
- </para>
- <!-- TODO: lcov -->
- <para>
- For example, the following command configures Kea to find the
- Boost headers in /usr/pkg/include, specifies that PostgreSQL
- support should be enabled, and sets the installation location
- to /opt/kea:
- <screen>$ <userinput>./configure \
- --with-boost-include=/usr/pkg/include \
- --with-dhcp-pgsql=/usr/local/bin/pg_config \
- --prefix=/opt/kea</userinput></screen>
- </para>
- <para>
- If the configure fails, it may be due to missing or old
- dependencies.
- </para>
- </section>
- <section>
- <title>Build</title>
- <para>
- After the configure step is complete, build the executables
- from the C++ code and prepare the Python scripts by running the command:
- <screen>$ <userinput>make</userinput></screen>
- </para>
- </section>
- <section>
- <title>Install</title>
- <para>
- To install the Kea executables, support files,
- and documentation, issue the command:
- <screen>$ <userinput>make install</userinput></screen>
- </para>
- <para>
- Do not use any form of parallel or job server options
- (such as GNU make's <command>-j</command> option) when
- performing this step: doing so may cause errors.
- </para>
- <note>
- <para>The install step may require superuser privileges.</para>
- </note>
- <para>
- If required, run <command>ldconfig</command> as root with
- <filename>/usr/local/lib</filename> (or with ${prefix}/lib if
- configured with --prefix) in
- <filename>/etc/ld.so.conf</filename> (or the relevant linker
- cache configuration file for your OS):
- <screen>$ <userinput>ldconfig</userinput></screen>
- </para>
- <note>
- <para>
- If you do not run <command>ldconfig</command> where it is
- required, you may see errors like the following:
- <screen>
- program: error while loading shared libraries: libkea-something.so.1:
- cannot open shared object file: No such file or directory
- </screen>
- </para>
- </note>
- </section>
- <!-- @todo: tests -->
- </section>
- <section id="dhcp-config-backend">
- <title>Selecting the Configuration Backend</title>
- <para>Kea 0.9 introduces configuration backends that are
- switchable during compilation phase. The backend is chosen using
- the --with-kea-config switch when running the configure script. It
- currently supports two values: BIND10 and JSON. This is currently
- only supported by DHCPv6 component.</para>
- <variablelist>
- <varlistentry>
- <term>BIND10</term>
- <listitem>
- <simpara>BIND10 (which is the default value as of April 2014) means
- that Kea6 is linked with the BIND10 configuration backend that
- connects to the BIND10 framework and in general works exactly the
- same as Kea 0.8 and earlier versions. The benefits of that backend
- are uniform integration with BIND10 framework, easy on-line
- reconfiguration using bindctl, available RESTful API. On the other
- hand, it requires the whole heavy BIND10 framework that requires
- Python3 to be present. That backend is likely to go away with the
- release of Kea 0.9.</simpara>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>JSON</term>
- <listitem>
- <simpara>JSON is a new configuration backend that causes Kea to read
- JSON configuration file from disk. It does not require any framework
- and thus is considered more lightweight. It will allow dynamic
- on-line reconfiguration, but will lack remote capabilities (i.e. no
- RESTful API). This configuration backend is expected to be the
- default for upcoming Kea 0.9.</simpara>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="dhcp-install-configure">
- <title>DHCP Database Installation and Configuration</title>
- <para>
- Kea stores its leases in a lease database. The software has been written in
- a way that makes it possible to choose which database product should be used to
- store the lease information. At present, Kea supports three database backends: MySQL,
- PostgreSQL and Memfile. To limit external dependencies, both MySQL and PostgreSQL
- support are disabled by default and only Memfile (which is implemented in pure C++)
- is available. Support for a given database backend must be explicitly included when
- Kea is built. This section covers the building of Kea with MySQL and/or PostgreSQL
- and the creation of the lease database.
- </para>
- <section>
- <title>Building with MySQL Support</title>
- <para>
- Install MySQL according to the instructions for your system. The client development
- libraries must be installed.
- </para>
- <para>
- Build and install Kea as described in <xref linkend="installation"/>, with
- the following modification: to enable the MySQL database code, at the
- "configure" step (see <xref linkend="configure"/>), specify the location of the
- MySQL configuration program "mysql_config" with the "--with-dhcp-mysql" switch,
- i.e.
- <screen><userinput>./configure [other-options] --with-dhcp-mysql</userinput></screen>
- ...if MySQL was installed in the default location, or:
- <screen><userinput>./configure [other-options] --with-dhcp-mysql=<replaceable>path-to-mysql_config</replaceable></userinput></screen>
- ...if not.
- </para>
- </section>
- <section id="dhcp-mysql-database-create">
- <title>Create the MySQL Database and the Kea User</title>
- <para>
- The next task is to create both the lease database and the user under which the servers will
- access it. A number of steps are required:
- </para>
- <para>
- 1. Log into MySQL as "root":
- <screen>$ <userinput>mysql -u root -p</userinput>
- Enter password:<userinput/>
- :<userinput/>
- mysql></screen>
- </para>
- <para>
- 2. Create the database:
- <screen>mysql> <userinput>CREATE DATABASE <replaceable>database-name</replaceable>;</userinput></screen>
- ... <replaceable>database-name</replaceable> is the name you have chosen for the database.
- </para>
- <para>
- 3. Create the database tables by running the dhcpdb_create.mysql script supplied as part of Kea:
- <screen>mysql> <userinput>CONNECT <replaceable>database-name</replaceable>;</userinput>
- mysql> <userinput>SOURCE <replaceable>path-to-bind10</replaceable>/share/bind10/dhcpdb_create.mysql</userinput></screen>
- </para>
- <para>
- 4. Create the user under which Kea will access the database (and give it a password), then grant it access to the database tables:
- <screen>mysql> <userinput>CREATE USER '<replaceable>user-name</replaceable>'@'localhost' IDENTIFIED BY '<replaceable>password</replaceable>';</userinput>
- mysql> <userinput>GRANT ALL ON <replaceable>database-name</replaceable>.* TO '<replaceable>user-name</replaceable>'@'localhost';</userinput></screen>
- </para>
- <para>
- 5. Exit MySQL:
- <screen>mysql> <userinput>quit</userinput>
- Bye<userinput/>
- $</screen>
- </para>
- </section>
- <section>
- <title>Building with PostgreSQL support</title>
- <para>
- Install PostgreSQL according to the instructions for your system. The client development
- libraries must be installed. Client development libraries are often packaged as "libpq".
- </para>
- <para>
- Build and install Kea as described in <xref linkend="installation"/>, with
- the following modification: to enable the PostgreSQL database code, at the
- "configure" step (see <xref linkend="configure"/>), specify the location of the
- PostgreSQL configuration program "pg_config" with the "--with-dhcp-pgsql" switch,
- i.e.
- <screen><userinput>./configure [other-options] --with-dhcp-pgsql</userinput></screen>
- ...if PostgreSQL was installed in the default location, or:
- <screen><userinput>./configure [other-options] --with-dhcp-pgsql=<replaceable>path-to-pg_config</replaceable></userinput></screen>
- ...if not.
- </para>
- </section>
- <section id="dhcp-pgsql-database-create">
- <title>Create PostgreSQL Database and Kea User</title>
- <para>
- The next task is to create both the lease database and the user under which the servers will
- access it. A number of steps are required:
- </para>
- <para>
- 1. Log into PostgreSQL as "root":
- <screen>$ <userinput>sudo -u postgres psql postgres</userinput>
- Enter password:<userinput/>
- :<userinput/>
- postgres=#</screen>
- </para>
- <para>
- 2. Create the database:
- <screen>
- postgres=#<userinput> CREATE DATABASE <replaceable>database-name</replaceable>;</userinput>
- CREATE DATABASE
- postgres=#
- </screen>
- ... <replaceable>database-name</replaceable> is the name you have chosen for the database.
- </para>
- <para>
- 3. Create the user under which Kea will access the database (and give it a password), then grant it access to the database:
- <screen>postgres=#<userinput> CREATE USER <replaceable>user-name</replaceable> WITH PASSWORD '<replaceable>password</replaceable>';</userinput>
- CREATE ROLE
- postgres=#
- postgres=#<userinput> GRANT ALL PRIVILEGES ON DATABASE <replaceable>database-name</replaceable> TO <replaceable>user-name</replaceable>;</userinput>
- GRANT
- postgres=#
- </screen>
- </para>
- <para>
- 4. Exit PostgreSQL:
- <screen>postgres=# <userinput>\q</userinput>
- Bye<userinput/>
- $</screen>
- </para>
- <para>
- 5. Create the database tables using the new user's credentials and the dhcpdb_create.pgsql script supplied with Kea.
- After entering the following command, you will be prompted for the new
- user's password. When the command completes you will be returned to
- the shell prompt. You should see output similar to following:
- <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>
- Password for user <replaceable>user-name</replaceable>:
- CREATE TABLE
- CREATE INDEX
- CREATE INDEX
- CREATE TABLE
- CREATE INDEX
- CREATE TABLE
- START TRANSACTION
- INSERT 0 1
- INSERT 0 1
- INSERT 0 1
- COMMIT
- CREATE TABLE
- START TRANSACTION
- INSERT 0 1
- COMMIT
- $
- </screen>
- </para>
- <para>
- If instead you encounter an error like:
- </para>
- <screen>
- psql: FATAL: no pg_hba.conf entry for host "[local]", user "<replaceable>user-name</replaceable>", database "<replaceable>database-name</replaceable>", SSL off
- </screen>
- <para>
- ... you will need to alter the PostgreSQL configuration.
- Kea uses password authentication when connecting to the database and must
- have the appropriate entries added to PostgreSQL's pg_hba.conf file. This
- file is normally located in the primary data directory for your PostgreSQL
- server. The precise path may vary but the default location for PostgreSQL 9.3
- on Centos 6.5 is:
- <filename>/var/lib/pgsql/9.3/data/pg_hba.conf</filename>.
- Assuming Kea is running on the same host as PostgreSQL, adding lines similar
- to following should be sufficient to provide password-authenticated access to
- Kea's database:
- </para>
- <screen>
- local <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> password
- host <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> 127.0.0.1/32 password
- host <replaceable>database-name</replaceable> <replaceable>user-name</replaceable> ::1/128 password
- </screen>
- <para>
- Please consult your PostgreSQL user manual before making these changes as they
- may expose your other databases that you run on the same system.
- </para>
- </section>
- </section>
- </chapter>
|