• Print
  • Share
  • Dark
    Light

Kea build on CentOS & RedHat

  • Updated on 12 Dec 2018
  • 5 minutes to read
  • Contributors

CentOS/RedHat System-Specific Install Notes

This page documents Kea installation on CentOS and RedHat version 7. It covers two installation procedures: using ready to use rpm (the easy one) and compiling from source (slightly more complicated, but still easy).

Install from rpm packages

RPM packages are not available in base CentOS repositories, but they are available in EPEL (Extra Packages for Enterprise Linux), which is a very rich set of additional packages. If you never installed anything from EPEL, here's what you should do:

#!/bin/bash
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum repolist
sudo yum install kea

The first command will add EPEL as additional packages repository to your system. You only need to do this if you never used EPEL before.

The second command will download list of available repositories. It seems like a good idea to issue that command every time before you install anything, so your list is up to date.

The third command installs kea package.

The downside of this approach is that as of today (12-December-2018), the version available in EPEL is 1.1.0. If you want to get a newer version (and you do), you should use the following instructions and install from source instead.

Install from Source

This approach requires a bit more work, but it gives you Kea 1.4.0-P1.

Installing from Source

Kea 1.4.0 depends on one package that needs a newer compiler than is available in the base CentOS release. For this reason, it is necessary to install the GCC 7 toolchain.

There are TWO scripts that need to be run to install Kea from source - the first sets up the environment and the second installs the Boost library and Kea itself.

Script 1:

# install all pre-built/native dependencies
sudo yum -y install cmake bison flex pcre-devel libev-devel protobuf-c-devel protobuf-c-compiler make rpm-build doxygen swig
sudo yum -y install autoconf automake libtool gtest-devel
sudo yum -y install openssl-devel

# If you don't already have git installed, it is needed to fetch the source
sudo yum -y install git
# We also need to grab some packages via wget
sudo yum -y install wget

# Now, add the community tools
sudo yum -y install epel-release

# This one comes from EPEL, so it has to be listed after...
sudo yum -y install log4cplus-devel

# Speed things up a bit (also in EPEL)
sudo yum -y install ccache

# Mocka is not needed (it's used for unit-tests for sysrepo)
# sudo yum -y install libcmocka-devel

# Allow environment modification
sudo yum -y install centos-release-scl

# This installs gcc 7. The standard gcc available in CentOS (4.8.5) is too old to compile
# some of the dependencies (libyang requires at the very least a 4.9).
sudo yum -y install devtoolset-7-gcc*

# enter devtools environment, this sets path to GCC 7, etc
# Note: This command starts bash with paths set to use gcc7. Once you close that
# shell, your environment will revert back to the standard tools (GCC 4.8.5).
scl enable devtoolset-7 bash

Script 2:

wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
tar xfz boost_1_65_1.tar.gz 
cd boost_1_65_1
  ./bootstrap.sh 
  ./b2 --with-system --with-thread --with-date_time --with-regex --with-serialization
  sudo ./b2 --with-system --with-thread --with-date_time --with-regex --with-serialization install
cd ..
#!/bin/bash -x
wget -nd https://ftp.isc.org/isc/kea/1.4.0-P1/kea-1.4.0-P1.tar.gz
tar zxvf kea-1.4.0-P1.tar.gz
rm kea-1.4.0-P1.tar.gz
cd kea-1.4.0-P1
./configure [your options here]
make
sudo make install

Installing from Source with MySQL (optional)

This is an optional dependency. You need it only if you want Kea to be able to store its information in MySQL.

You will need to run the scripts associated with installing Kea (above) before executing these commands:

sudo yum install mariadb-devel
./configure --with-mysql [your additional options here]
make
sudo make install

Note that older (1.3.0 and earlier) versions use --with-dhcp-mysql. Kea 1.4.0 and newer use --with-mysql.


Installing from Source with Sysrepo (optional)

2018-10-12
This information pertains to install upcoming Kea 1.5.0 on CentOS 7.5.

Sysrepo requires several extra dependencies like libredblack, libyang, etc. Note the libyang version is paired with the sysrepo one so when you update sysrepo you must first update libyang.

For more details check here and here.

These instructions are split into three separate scripts:

  1. Install package based dependancies. The order of the yum install packages are important as some of the software being installed are in both the base and the EPEL and it matters which repository they are pulled from. The first script also sets up the environment for the second and third (compilers, etc).
  2. Install certain dependancies from source. These are not (at the time of this writing) available as package based installs.
  3. Install Kea from the git archive.

Script 1:

# install all pre-built/native dependencies
sudo yum -y install cmake bison flex pcre-devel libev-devel protobuf-c-devel protobuf-c-compiler make rpm-build doxygen swig
sudo yum -y install autoconf automake libtool gtest-devel
sudo yum -y install openssl-devel

# If you don't already have git installed, it is needed to fetch the source
sudo yum -y install git
# We also need to grab some packages via wget
sudo yum -y install wget

# Now, add the community tools
sudo yum -y install epel-release

# This one comes from EPEL, so it has to be listed after...
sudo yum -y install log4cplus-devel

# Speed things up a bit (also in EPEL)
sudo yum -y install ccache

# Mocka is not needed (it's used for unit-tests for sysrepo)
# sudo yum -y install libcmocka-devel

# As-of Kea 1.5, we can get away with boost-devel and not a specific version
sudo yum -y install boost-devel

# Allow environment modification
sudo yum -y install centos-release-scl

# This installs gcc 7. The standard gcc available in CentOS (4.8.5) is too old to compile
# some of the dependencies (libyang requires at the very least a 4.9).
sudo yum -y install devtoolset-7-gcc*

# enter devtools environment, this sets path to GCC 7, etc
# Note: This command starts bash with paths set to use gcc7. Once you close that
# shell, your environment will revert back to the standard tools (GCC 4.8.5).
scl enable devtoolset-7 bash

Script 2:

# fetch, build and install libredblack
git clone https://github.com/sysrepo/libredblack.git
cd libredblack
  ./configure
  make
  sudo make install
cd ..

# Install libyang
wget https://github.com/CESNET/libyang/archive/v0.16-r2.tar.gz
tar zxvf v0.16-r2.tar.gz
rm v0.16-r2.tar.gz
  cd libyang-0.16-r2
  mkdir build
    cd build
    cmake ..
    make
    sudo make install
cd ../..

# Install Sysrepo
# Download the latest release version from https://github.com/sysrepo/sysrepo/releases
# At the time of writing this document the latest version was 0.7.7.
wget https://github.com/sysrepo/sysrepo/archive/v0.7.7.tar.gz
tar zxvf v0.7.7.tar.gz
rm v0.7.7.tar.gz
cd sysrepo-0.7.7
  mkdir build
  cd build
    cmake -DSWIG_EXECUTABLE=/usr/local/bin/swig -DCMAKE_BUILD_TYPE=Release -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON -DGEN_PYTHON_BINDINGS=OFF -DGEN_LUA_BINDINGS=OFF -DENABLE_TESTS=OFF ..
    make
    sudo make install
cd ../..

Script 3:

# Install Kea

wget https://ftp.isc.org/isc/kea/1.5.0-beta2/kea-1.5.0-beta2.tar.gz
tar xvfz kea-1.5.0-beta2.tar.gz
cd kea-1.5.0-beta2

export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig
# export CC="ccache gcc" CXX="ccache g++"
declare -x PATH="/usr/lib64/ccache:$PATH"
autoreconf --install
./configure --with-sysrepo [your additional options here]
make -j4
sudo make install

This script is known to work on a clean install of CentOS 7.5 (as-of 11-NOV-2018). If this is run on an existing CentOS system with already installed components, it is not guaranteed to work.