README 6.84 KB
Newer Older
1 2
Dependencies
============
3

4 5 6 7 8 9
Knot DNS has several dependencies:
* libtool
* autoconf > 2.65
* flex >= 2.5.31
* bison >= 2.3
* libssl >= 0.9.8
10
* liburcu >= 0.5.4
11 12

Optional packages:
13 14
* libcap-ng >= 0.6.4 (for POSIX 1003.1e capabilites(7))
* ragel (for fast zone parsing)
15 16 17

Dependencies for building documentation:
* texinfo
18

19
Knot DNS requires compiler to support atomic intrinsics.
20 21
GCC version at least 4.1 supports legacy atomic builtins, however 4.7
or newer is preferred.
22 23
Clang supports atomics since version 2.9.

24 25 26 27 28 29
By default Knot DNS is distributed with a slower zone file parser because of
smaller source file and quick compile time. In most cases it is sufficient.
If you plan to process large zone files, it is recomended to build Knot DNS
using ./configure --enable-fastparser. In this case Ragel compiler is required
and it is normal if the C compiler takes much more time (minutes).

Jan Mercl's avatar
Jan Mercl committed
30 31
Installation
============
32

33 34 35 36 37 38 39 40 41 42
Knot DNS may be already included in your operating system distribution and
therefore can be installed from packages (Linux) or ports (BSD). This is
always preferred unless you want to test the latest features, contribute to
Knot development, or you just know what you are doing.

Following sections describe how to build Knot DNS from the source code.

Installation on Debian based distributions
==========================================

43
The following steps should work (verified in VirtualBox only)
44
on the distribution/architecture/release combinations as listed bellow.
Jan Mercl's avatar
Jan Mercl committed
45

46 47 48 49 50
----------------------------------------------
Debian         (AMD64, I386) 6.0.2.1 (squeeze)
Ubuntu Server  (AMD64, I386) 10.04 LTS
Ubuntu Desktop (AMD64, I386) 10.04 LTS
----------------------------------------------
Jan Mercl's avatar
Jan Mercl committed
51

52
# Make the system up-to-date
Jan Mercl's avatar
Jan Mercl committed
53 54
$ sudo apt-get update
$ sudo apt-get upgrade
55 56 57 58 59 60 61 62

# Ensure all prerequisites are installed
$ sudo apt-get install git-core autoconf libtool flex bison libssl-dev liburcu-dev

# Install optional packages (POSIX 1003.1e capabilities)
$ sudo apt-get install libcap-ng-dev

# If the liburcu-dev package is not present, install directly
63 64
$ wget http://bd.archive.ubuntu.com/ubuntu/pool/universe/libu/liburcu/liburcu0_0.5.4-1_amd64.deb
$ wget http://bd.archive.ubuntu.com/ubuntu/pool/universe/libu/liburcu/liburcu-dev_0.5.4-1_amd64.deb
65 66
$ sudo dpkg -i liburcu0_0.5.4-1_amd64.deb
$ sudo dpkg -i liburcu-dev_0.5.4-1_amd64.deb
67 68

# Go for the real thing
Marek Vavrusa's avatar
Marek Vavrusa committed
69
$ git clone git://git.nic.cz/knot-dns.git
70 71 72
$ cd knot
$ autoreconf -if
$ ./configure
Marek Vavrusa's avatar
Marek Vavrusa committed
73
$ make
74 75
$ sudo make install
$ sudo ldconfig
76

77
Alternative packages for I386:
Jan Včelák's avatar
Jan Včelák committed
78
$ # the required version of liburcu is not available in the default package
79
$ # sources.
80 81 82 83 84
$
$ wget http://bd.archive.ubuntu.com/ubuntu/pool/universe/libu/liburcu/liburcu0_0.5.4-1_i386.deb
$ wget http://bd.archive.ubuntu.com/ubuntu/pool/universe/libu/liburcu/liburcu-dev_0.5.4-1_i386.deb
$ sudo dpkg -i liburcu0_0.5.4-1_i386.deb
$ sudo dpkg -i liburcu-dev_0.5.4-1_i386.deb
85

86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
Installation on Fedora
======================

Notice: Knot DNS is available in official distribution repositories since
Fedora 18 (Spherical Cow). Search for 'knot' package.

All commands with the '#' prompt should be run as the root user, commands with
the '$' prompt should be run as a regular non-root user.

Update the system:
# yum upgrade

Ensure all base development tools are available:
# yum install @buildsys-build

Ensure all prerequisites are installed:
# yum install libtool autoconf flex bison openssl-devel userspace-rcu-devel

You can also install optional packages:
# yum install libcap-ng-devel ragel

Download the latest source code from Git and compile it:
$ git clone git://git.nic.cz/knot-dns.git
$ cd knot
$ autoreconf -if
$ ./configure
$ make

Install Knot DNS into system (run only if you really know what these commands do):
# make install
# ldconfig

118 119 120 121 122 123 124
Installation on BSD
===================

Not all prerequisites are available as ports on BSD.

- liburcu must be compiled from sources
  - version 0.6.4 compiles on BSD without any source code modifications
125 126
  - in case of x86_64 build, CFLAGS nad build type has to be set appropriately.
    $ CFLAGS=-fPIC ./configure --build amd64
Marek Vavrusa's avatar
Marek Vavrusa committed
127
- flex must be newer version from ports that support reentrant parsers
128

129 130
Knot DNS requires more recent version of flex from ports, to prevent name clash
specify flex destination.
131 132
$ cd <knot sources>
$ autoreconf -if
Marek Vavrusa's avatar
Marek Vavrusa committed
133
$ ./configure
134 135
$ make && sudo make install

Marek Vavrusa's avatar
Marek Vavrusa committed
136 137 138 139
It is also present in port tree, so you can install it from there.
$ cd /usr/ports/dns/knot
$ sudo make install

140 141
Installation on OpenBSD/NetBSD
==============================
142

143 144 145 146 147
Also works for OS X, if you don't want to install gcc from ports.
Prerequisites:
- liburcu needs patch for absent compiler TLS capability
  - patch is located in "scripts/urcu-tls-compat.patch"
- patch compatible with liburcu-0.6.7
Marek Vavrusa's avatar
Marek Vavrusa committed
148
- liburcu >= 0.7.0 works out of the box
149
- flex and bison from packages
150 151 152

$ mkdir liburcu && cd liburcu
$ wget "http://lttng.org/files/urcu/userspace-rcu-0.6.7.tar.bz2"
Jan Včelák's avatar
Jan Včelák committed
153
$ patch -p1 < ../scripts/urcu-tls-compat.patch
154 155 156 157 158
$ autoconf && ./configure && make && sudo make install
$ # or follow installation instructions in INSTALL

Knot DNS installation is the same as in previous section (Installation on BSD).

159 160 161 162 163 164 165 166 167
Installation on OS X
====================

Not all prerequisites are preinstalled for OS X.

- liburcu must be compiled from sources
  - liburcu requires gcc-4.6 from MacPorts, as it depends on __thread keyword
  $ CC=gcc-mp-4.6 ARCH=x86_64 ./configure
  $ make && sudo make install
168 169
- liburcu >= 0.7.0 works with supplied compiler, however ARCH must still be set
  - alternative is to set it with configure parameter --target
170

Jan Včelák's avatar
Jan Včelák committed
171
Compiling Knot DNS with gcc-mp-4.6 is recommended, but not necessary.
172

173 174 175
Running
=======

Jan Včelák's avatar
Jan Včelák committed
176 177
First, each server needs configuration file.
Please see samples/knot.sample.conf for reference.
178
Minimal configuration can be found in samples/knot.min.conf
179 180 181 182 183 184 185 186
Configuration zone has to specify:
* storage for PID files, compiled zones etc.
* network interfaces
* served zones

$ cp samples/knot.min.conf myserver.conf
$ vim myserver.conf # or your favourite text editor
$ knotc -h # see what it can do
Marek Vavrusa's avatar
Marek Vavrusa committed
187

188
Prepare working directory.
Marek Vavrusa's avatar
Marek Vavrusa committed
189 190

$ mkdir -p /tmp/knot-minimal/samples; cp samples/example.com.zone /tmp/knot-minimal/samples/
191 192 193 194 195 196 197 198 199 200 201 202

Third, lets load server. You can do this by running 'knotd' directly, or with
'knotc' as well. Server is able to run in daemonized or interactive mode.
Lets start our server in interactive mode (parameter '-i') to see if it runs.

$ knotc -c myserver.conf -i start # start server in interactive mode

Running as daemon
=================

Controller runs server in daemonized mode as default. Disadvantage is, that
it closes stdout/stderr so you need to set up either syslog or logging to
Jan Včelák's avatar
Jan Včelák committed
203
own files in the configuration. Controller parameter '-w' waits for the
204
operation to finish. Let's test server functionality.
205 206 207 208 209

$ knotc -c myserver.conf -w start # start server
$ dig @$ADDR -p $PORT example.com # issue a query and see result
$ ...
$ knotc -c myserver.conf -w stop  # stop server