These instructions are for Debian 9.2. Changes for newer Debian versions are noted.
2017-11-22: Kea 1.3.0 Source installation (with hooks) on Debian 9.2 with PostgreSQL support.
Introduction and System Description
Overview of installing and compiling Kea 1.3.0 from source tarball and git on Debian 9.2, with added PostgreSQL support.
$
prompt implies non-privileged user commands
#
prompt implies privileged user commands (ie: run with sudo, or run as root)
Debian 9.2 Installation Notes
The Debian installation in this example was performed as a network install using the minimal install image.
See this how-to on a [https://www.howtoforge.com/tutorial/debian-minimal-server/ Debian minimal install]. The how-to linked is for Debian 9.1, but it should be the same for 9.2.
When the install gets to the {{{Software selection}}} screen, I chose only SSH server, and omitted all other options.
Setup of Packaged Prerequisites
The following list of packages is believed to be the complete list required for this use case.
# apt-get install automake libtool pkg-config libboost-dev libboost-system-dev liblog4cplus-dev build-essential libssl-dev ccache
Note on Postgres
If you want to compile Kea with PostgreSQL, support also install the following packages:
# apt-get install postgresql-server-dev-all libpq-dev
Make sure you use --with-dhcp-pgsql (Kea 1.3) or --with-pgsql (Kea 1.4 or later) when running configure.
Note on development environment
If you want to compile Kea with unit-tests (not needed for users, only useful if you want to change Kea code and possibly contribute patches), you will need the following:
# apt-get install googletest libgtest-dev
Make sure you extend your configure script with --with-gtest-source=/usr/src/googletest as this is where Debian puts the Google test sources.
Note on git
If you are compiling from git source, clone the git repository and reconfigure
# apt-get install git
$ git clone https://github.com/isc-projects/kea.git
Cloning into 'kea'...
remote: Counting objects: 225440, done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 225440 (delta 201), reused 154 (delta 131), pack-reused 225165
Receiving objects: 100% (225440/225440), 50.95 MiB | 15.72 MiB/s, done.
Resolving deltas: 100% (184957/184957), done.
$ cd kea
$ autoreconf --install
Note on hooks library
If using hooks, copy the tarball into the root of the Kea source tree, and extract in place.
$ cp kea-subscription-1.3.0.tar.gz kea-1.3.0/
$ tar -zxvf kea-subscription-1.3.0.tar.gz
Building and Installing
The following environment variables attempt to speed up compilation, and recompilation.
$ export CC="ccache gcc" CXX="ccache g++"
Configure the installation. This example enables PostgreSQL and the Kea hooks library. Note that a Kea support is required to obtain the Kea hooks source tarball. If you don't know what this means, chances are the option will do nothing.
$ ./configure --with-dhcp-pgsql --with-tier2=yes
Starting with 1.4, the command line option for PostgreSQL will be --with-pgsql.
Compile and install the configured source tree. Assuming your Kea server has 2 CPU cores, substitute -jX with -j2
$ make -jX
# make install
Add the Kea libraries to ldconfig
# touch /etc/ld.so.conf.d/kea.conf
# echo "/usr/local/lib/hooks" > /etc/ld.so.conf.d/kea.conf
# ldconfig
Notes on Running
There is no startup script provided. Once Kea is correctly installed and configured for your environment, you will likely want to start it on boot. You can do so by simply adding the following to /etc/rc.local
and enabling rc.local compatibility on your system.
# /etc/rc.local
#!/bin/bash
keactrl start
exit 0
See [https://lists.debian.org/debian-user/2014/08/msg01349.html This Link] for details in enabling rc.local compatibility.
Note: Debian's default systemd
handles startup in more modern ways. rc.local
compatibility is considered the old way.