gnunet-handbook

The GNUnet Handbook
Log | Files | Refs

installing.rst (9659B)


      1 Installation
      2 ============
      3 
      4 This guide is intended for those who want to install GNUnet from source.
      5 For instructions on how to install GNUnet as a binary package please
      6 refer to the official documentation of your operating system or package
      7 manager.
      8 
      9 For understanding this guide properly it is important to know that there
     10 are two different ways of running GNUnet:
     11 
     12 -  the single-user setup
     13 -  the multi-user setup
     14 
     15 The latter variant has a better security model and requires extra
     16 preparation before running make install and a different configuration.
     17 Beginners who want to quickly try out GNUnet can use the single-user
     18 setup.
     19 
     20 Dependencies
     21 ------------
     22 
     23 GNUnet needs few libraries and applications for being able to run and
     24 another few optional ones for using certain features. Preferably they
     25 should be installed with a package manager.
     26 
     27 The mandatory libraries and applications are
     28 
     29 -  meson 1.0 or above
     30 -  recutils 1.0 or above (when building from git)
     31 -  gettext
     32 -  glibc (read below, other libcs work)
     33 -  GnuTLS 3.2.12 or above, recommended to be linked against libunbound
     34 -  GNU make 4.0 or higher (other make implementations do work)
     35 -  iptables (on Linux systems)
     36 -  libtool 2.2 or above
     37 -  libltdl (part of libtool)
     38 -  libgcrypt 1.6 or above
     39 -  libidn2 or libidn
     40 -  libmicrohttpd 0.9.63 or above
     41 -  libunistring
     42 -  libjansson
     43 -  libjose (optional, for reclaimID)
     44 -  libgmp
     45 -  libcurl (ideally linked to GnuTLS) 7.35.0 or
     46    above
     47 -  Texinfo 5.2 or above (for building the documentation)
     48 -  Texlive 2012 or above (for building the documentation, and for
     49    gnunet-bcd)
     50 -  makeinfo 4.8 or above
     51 -  pkgconf (or pkg-config)
     52 -  zlib
     53 
     54 Glibc is required for certain NSS features:
     55 
     56 .. code-block:: text
     57 
     58   One mechanism of integrating GNS with legacy applications via NSS is
     59   not available if this is disabled. But applications that don't use the
     60   glibc for NS resolution won't work anyway with this, so little is lost
     61   on *BSD systems.
     62   GNS via direct use or via the HTTP or DNS proxies is unaffected.
     63 
     64 Other libcs should work, the resulting builds just don’t include the
     65 glibc NSS specific code. One example is the build against NetBSD’s libc
     66 as detailed in https://bugs.gnunet.org/view.php?id=5605.
     67 
     68 In addition GNUnet needs at least one of these three databases (at the
     69 minimum sqlite3)
     70 
     71 -  sqlite + libsqlite 3.8 or above (the default, requires no further
     72    configuration)
     73 -  postgres + libpq
     74 -  mysql + libmysqlclient
     75 
     76 These are the dependencies only required for certain features
     77 
     78 -  miniupnpc (for traversing NAT boxes more reliably)
     79 -  libnss
     80 -  libopus (for running the GNUnet conversation telephony application)
     81 -  libogg (for running the GNUnet conversation telephony application)
     82 -  gstreamer OR libpulse (for running the GNUnet conversation telephony
     83    application)
     84 -  bluez (for bluetooth support)
     85 -  libextractor (optional but highly recommended, read below)
     86 -  texi2mdoc (for automatic mdoc generation)
     87 -  perl5 for some utilities (which are not installed)
     88 
     89 About libextractor being optional:
     90 
     91 .. code-block:: text
     92 
     93    While libextractor ("LE") is optional, it is recommended to build gnunet
     94    against it. If you install it later, you won't benefit from libextractor.
     95    If you are a distributor, we recommend to split LE into basis + plugins
     96    rather than making LE an option as an afterthought by the user.  LE
     97    itself is very small, but its dependency chain on first, second, third
     98    etc level can be big.  There is a small effect on privacy if your LE
     99    build differs from one which includes all plugins (plugins are build as
    100    shared objects): if users publish a directory with a mixture of file
    101    types (for example mpeg, jpeg, png, gif) the configuration of LE could
    102    leak which plugins are installed for which filetypes are not providing
    103    more details.  However, this leak is just a minor concern.
    104 
    105 These are the test-suite requirements:
    106 
    107 -  python3.6 or higher
    108 -  gnunet (installation first)
    109 -  some core-utils: which(1), bc(1), curl(1), sed(1), awk(1), etc.
    110 -  a shell (very few Bash scripts, the majority are POSIX sh scripts)
    111 
    112 These are runtime requirements:
    113 
    114 -  nss (the certutil binary, for gnunet-gns-proxy-setup-ca)
    115 -  openssl (openssl binary, for gnunet-gns-proxy-setup-ca)
    116 
    117 Getting the Source Code
    118 -----------------------
    119 
    120 You can either download the source code using git (you obviously need
    121 git installed) or as an archive.
    122 
    123 Using git type
    124 
    125 ::
    126 
    127    $ git clone git://git.gnunet.org/gnunet.git
    128 
    129 The release archive can be found at https://ftpmirror.gnu.org/gnu/gnunet/.
    130 You can find nightly builds at https://buildbot.gnunet.org/artifacts/.
    131 Extract it using a graphical archive tool or tar:
    132 
    133 ::
    134 
    135    tar xf gnunet-<VERSION> .tar.gz
    136 
    137 In the next chapter we will assume that the source code is available in
    138 the home directory at ~/gnunet.
    139 
    140 Create user and groups for the system services
    141 ----------------------------------------------
    142 
    143 **For single-user setup this section can be skipped**
    144 
    145 The multi-user setup means that there are system services, which are run
    146 once per machine as a dedicated system user (called gnunet) and user
    147 services which can be started by every user who wants to use GNUnet
    148 applications. The user services communicate with the system services
    149 over unix domain sockets. To gain permissions to read and write those
    150 sockets the users running GNUnet applications will need to be in the
    151 gnunet group. In addition the group gnunetdns may be needed (see below).
    152 
    153 Create user gnunet who is member of the group gnunet (automatically
    154 created) and specify a home directory where the GNUnet services will
    155 store persistent data such as information about peers.
    156 
    157 ::
    158 
    159    $ sudo useradd --system --home-dir /var/lib/gnunet --create-home gnunet
    160 
    161 Now add your own user to the gnunet group:
    162 
    163 ::
    164 
    165    $ sudo usermod -aG gnunet <user>
    166 
    167 Create a group gnunetdns. This allows using setgid in a way that only
    168 the DNS service can run the gnunet-helper-dns binary. This is only
    169 needed if system-wide DNS interception will be used. For more
    170 information see `Configuring system-wide DNS
    171 interception <installing#configuring%20system-wide-dns-interception>`__.
    172 
    173 ::
    174 
    175    $ sudo groupadd gnunetdns
    176 
    177 Preparing and Compiling the Source Code
    178 ---------------------------------------
    179 
    180 Get the source code from git or a source tarball. When running
    181 `meson setup`, options can be specified to customize the compilation and
    182 installation process. For details execute:
    183 
    184 ::
    185 
    186    $ meson setup --help
    187 
    188 The following example configures the installation prefix `/usr/local`
    189 and creates the out-of-tree build folder `build`.
    190 
    191 ::
    192 
    193    $ ./bootstrap (only when installing from git)
    194    $ meson setup -Dprefix=/usr/local build
    195 
    196 After running the bootstrap script and setup successfully the source
    197 code can be compiled and the compiled binaries can be installed using:
    198 
    199 ::
    200 
    201    $ meson compile -C build
    202    $ meson install -C build
    203 
    204 The latter command may need to be run as root (or with sudo) because
    205 some binaries need the suid bit set. Without that some features
    206 (e.g. the VPN service, system-wide DNS interception, NAT traversal using
    207 ICMP) will not work.
    208 
    209 NSS plugin (optional)
    210 ~~~~~~~~~~~~~~~~~~~~~
    211 
    212 **NOTE: The installation of the NSS plugin is only necessary if GNS
    213 resolution shall be used with legacy applications (that only support
    214 DNS) and if you cannot do not want to use the DNS2GNS service.**
    215 
    216 One important library is the GNS plugin for NSS (the name services
    217 switch) which allows using GNS (the GNU name system) in the normal DNS
    218 resolution process. Unfortunately NSS expects it in a specific location
    219 (probably ``/lib``) which may differ from the installation prefix (see
    220 ``--prefix`` option in the previous section). This is why the plugin has
    221 to be installed manually.
    222 
    223 Find the directory where nss plugins are installed on your system, e.g.:
    224 
    225 ::
    226 
    227    $ ls -l /lib/libnss_*
    228    /lib/libnss_mymachines.so.2
    229    /lib/libnss_resolve.so.2
    230    /lib/libnss_myhostname.so.2
    231    /lib/libnss_systemd.so.2
    232 
    233 Copy the GNS NSS plugin to that directory:
    234 
    235 ::
    236 
    237    cp ~/gnunet/src/gns/nss/.libs/libnss_gns.so.2 /lib
    238 
    239 Installing the GNS Certificate Authority (Optional)
    240 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    241 
    242 **NOTE: Installing the GNS certificate authority is only necessary if
    243 GNS shall be used in a browser and if you cannot or do not want to use
    244 the DNS2GNS service.**
    245 
    246 The GNS Certificate authority can provide TLS certificates for GNS names
    247 while downloading webpages from legacy webservers. This allows browsers
    248 to use HTTPS in combinations with GNS name resolution.
    249 
    250 To install it execute the GNS CA-setup script. So far Firefox and
    251 Chromium are supported.
    252 
    253 ::
    254 
    255    $ gnunet-gns-proxy-setup-ca
    256 
    257 A local proxy server, that takes care of the name resolution and
    258 provides certificates on-the-fly needs to be started:
    259 
    260 ::
    261 
    262    $ /usr/lib/gnunet/libexec/gnunet-gns-proxy
    263 
    264 Now GNS should work in browsers that are configured to use a SOCKS proxy
    265 on localhost:7777.
    266 
    267 
    268 .. _Minimal-configuration:
    269 
    270 Minimal configuration
    271 ---------------------
    272 
    273 GNUnet needs a configuration file to start (see `Config file
    274 format <#Config-file-format>`__). For the *single-user setup* an empty
    275 file is sufficient:
    276 
    277 ::
    278 
    279    $ touch ~/.config/gnunet.conf
    280 
    281 For the *multi-user setup* we need an extra config file for the system
    282 services. The default location is ``/etc/gnunet.conf``. The minimal
    283 content of that file which activates the system services roll is:
    284 
    285 ::
    286 
    287    [arm]
    288    START_SYSTEM_SERVICES = YES
    289    START_USER_SERVICES = NO
    290 
    291 The config file for the user services (``~/.config/gnunet.conf``) needs
    292 the opposite configuration to activate the user services roll:
    293 
    294 ::
    295 
    296    [arm]
    297    START_SYSTEM_SERVICES = NO
    298    START_USER_SERVICES = YES