1.. highlight:: console 2.. _Installation: 3 4************ 5Installation 6************ 7 8.. _Installation from a package_: 9 10Installation from a package 11=========================== 12 13Knot DNS may already be included in your operating system distribution and 14therefore can be installed from packages (Linux), ports (BSD), or via 15Homebrew (macOS). This is always preferred unless you want to test the latest 16features, contribute to Knot development, or you know what you are doing. 17 18See the project `download <https://www.knot-dns.cz/download>`_ page for 19the latest information. 20 21.. _Installation from source code: 22 23Installation from source code 24============================= 25 26Required build environment 27-------------------------- 28 29The build process relies on these standard tools: 30 31* make 32* libtool 33* pkg-config 34* autoconf >= 2.65 35* python-sphinx (optional, for documentation building) 36 37GCC >= 4.1 is mandatory for atomic built-ins, but the latest 38available version is recommended. Another requirement is ``_GNU_SOURCE`` 39and C99 support, otherwise it adapts to the available compiler features. 40LLVM clang compiler since version 2.9 can be used as well. 41 42Getting the source code 43----------------------- 44 45You can find the source code for the latest release on `www.knot-dns.cz <https://www.knot-dns.cz>`_. 46Alternatively, you can fetch the whole project from the git repository 47`https://gitlab.nic.cz/knot/knot-dns.git <https://gitlab.nic.cz/knot/knot-dns>`_. 48 49After obtaining the source code, compilation and installation is quite a 50straightforward process using autotools. 51 52.. _Configuring and generating Makefiles: 53 54Configuring and generating Makefiles 55------------------------------------ 56 57If compiling from git source, you need to bootstrap the ``./configure`` file first:: 58 59 $ autoreconf -i -f 60 61In most cases, you can just run configure without any options:: 62 63 $ ./configure 64 65For all available configure options run:: 66 67 $ ./configure --help 68 69Compilation 70----------- 71 72After running ``./configure`` you can compile Knot DNS by running 73``make`` command, which will produce binaries and other related 74files:: 75 76 $ make 77 78.. NOTE:: 79 The compilation with enabled optimizations may take a long time. In such 80 a case the ``--disable-fastparser`` configure option can help. 81 82Installation 83------------ 84 85When you have finished building Knot DNS, it's time to install the 86binaries and configuration files into the operation system hierarchy. 87You can do so by executing:: 88 89 $ make install 90 91When installing as a non-root user, you might have to gain elevated privileges by 92switching to root user, e.g. ``sudo make install`` or ``su -c 'make install'``. 93