README 4.98 KB
Newer Older
Marek Vavrusa's avatar
Marek Vavrusa committed
1 2 3 4 5 6 7 8 9 10 11 12 13
Dependencies
============
Knot DNS has several dependencies:
* libtool
* autoconf > 2.65
* flex >= 2.5.31
* bison >= 2.3
* libssl >= 0.9.8
* liburcu >= 0.5.4 (available as packages or as a sources from http://lttng.org/urcu)

Optional packages:
* libcap-ng >= 0.6.4 for POSIX 1003.1e capabilites(7)

Jan Mercl's avatar
Jan Mercl committed
14 15
Installation
============
16

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

20 21 22 23 24
----------------------------------------------
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
25

26
# Make the system up-to-date
Jan Mercl's avatar
Jan Mercl committed
27 28
$ sudo apt-get update
$ sudo apt-get upgrade
29 30 31 32 33 34 35 36

# 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
37 38
$ 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
Jan Mercl's avatar
Jan Mercl committed
39 40
$ sudo dpkg -i liburcu0_0.5.4-1_amd64.deb
$ sudo dpkg -i liburcu-dev_0.5.4-1_amd64.deb
41 42

# Go for the real thing
Marek Vavrusa's avatar
Marek Vavrusa committed
43
$ git clone git://git.nic.cz/knot-dns.git
44 45 46
$ cd knot
$ autoreconf -if
$ ./configure
Marek Vavrusa's avatar
Marek Vavrusa committed
47
$ make
48 49
$ sudo make install
$ sudo ldconfig
Jan Mercl's avatar
Jan Mercl committed
50

51
Alternative packages for I386:
52 53
$ # the required version of liburcu is not available in the default package 
$ # sources.
Jan Mercl's avatar
Jan Mercl committed
54 55 56 57 58
$
$ 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
59

60 61 62 63 64 65 66
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
67 68
  - 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
69
- flex must be newer version from ports that support reentrant parsers
70

71 72
Knot DNS requires more recent version of flex from ports, to prevent name clash
specify flex destination.
73 74
$ cd <knot sources>
$ autoreconf -if
Marek Vavrusa's avatar
Marek Vavrusa committed
75
$ ./configure
76 77
$ make && sudo make install

Marek Vavrusa's avatar
Marek Vavrusa committed
78 79 80 81
It is also present in port tree, so you can install it from there.
$ cd /usr/ports/dns/knot
$ sudo make install

82 83 84 85 86 87 88
Installation on OpenBSD/NetBSD
==============================
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
89
- liburcu >= 0.7.0 works out of the box
Marek Vavrusa's avatar
Marek Vavrusa committed
90
- flex and bison from packages
91 92 93 94 95 96 97 98 99

$ mkdir liburcu && cd liburcu
$ wget "http://lttng.org/files/urcu/userspace-rcu-0.6.7.tar.bz2"
$ patch -p1 < ../scripts/urcu-tls-compat.patch 
$ 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).

100 101 102 103 104 105 106 107 108
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
109 110
- liburcu >= 0.7.0 works with supplied compiler, however ARCH must still be set
  - alternative is to set it with configure parameter --target
111

112
Compiling Knot DNS with gcc-mp-4.6 is recommended, but not necessary. 
113

114 115 116
Running
=======

117 118 119
First, each server needs configuration file. 
Please see samples/knot.sample.conf for reference. 
Minimal configuration can be found in samples/knot.min.conf
120 121 122 123 124 125 126 127
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
128

129
Prepare working directory.
Marek Vavrusa's avatar
Marek Vavrusa committed
130 131

$ mkdir -p /tmp/knot-minimal/samples; cp samples/example.com.zone /tmp/knot-minimal/samples/
132 133 134 135 136 137 138 139 140 141 142 143

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
144 145
own files in the configuration. Controller parameter '-w' waits for the 
operation to finish. Let's test server functionality.
146 147 148 149 150 151

$ 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