aboutsummaryrefslogtreecommitdiff
path: root/template/install-on-debian9.html.j2
blob: 2e3ee95fdf3c801f7c85d0ef4d7cdfd6b2d8d1f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
{% extends "common/base.j2" %}
{% block body_content %}
<article class="container">

  <header>
    <h1>{{ _("Tutorial: GNUnet on Debian 9") }}</h1>
  </header>

  <h2>{{ _("Introduction") }}</h2>
  <p>
    Welcome to the hopefully painless GNUnet tutorial for Debian 9! It provides
    very concrete instructions on how to compile, install and configure a current
    version of GNUnet. The goal is to support newcomers, either end users or
    developers, who want to get in touch with GNUnet for the first time. After
    installing GNUnet we will make sure that out new GNUnet installation is working
    correctly.
  </p>

  <p>
    <b>Attention: If you came across the official gnunet package for Debian 9,
      ignore it! It is ancient and not compatible with current GNUnet
      installations.</b>
  </p>

  <p>
    Now let's start!
  </p>

  <h2>{{ _("Requirements") }}</h2>

  <p>
    First let's install the following Debian 9 packages to use GNUnet
    painlessly. Optional dependencies are listed in Appendix A. They are required
    for some experimental GNUnet features.
  </p>

  <code>
      $ sudo apt install git libtool autoconf autopoint libargon2-dev\<br>
      build-essential libgcrypt-dev libidn11-dev zlib1g-dev \<br>
      libunistring-dev libglpk-dev miniupnpc libextractor-dev \<br>
      libjansson-dev libcurl4-gnutls-dev gnutls-bin libsqlite3-dev \<br>
      openssl libnss3-tools libopus-dev libpulse-dev libogg-dev \<br>
      libsodium-dev
  </code>

  <h2>{{ _("Make an installation directory") }}</h2>

  <p>
    Next we create a directory in our home directory where we store
    the source code later. We should keep this directory after
    installation because it contains Makefiles that can be used for
    uninstalling GNUnet again (see chapter *Uninstall GNUnet and its
    dependencies*).
  </p>

  <code>
    $ mkdir ~/gnunet_installation
  </code>

  <h2>{{ _("Get the source code") }}</h2>

  <p>
    We download the GNUnet source code using git. On Debian 9 we need the
    sources of another library (libmicrohttpd).
  </p>

  <p>
    Note: The official libmicrohttpd package for Debian 9 is too old, we need
      at least version 0.9.52 – that's why we install it from gnunet.org, and not from the package manager.
  </p>

  <code>
    $ cd ~/gnunet_installation<br>
    $ git clone --depth 1 https://gnunet.org/git/gnunet.git<br>
    $ git clone --depth 1 https://gnunet.org/git/gnunet-gtk.git<br>
    $ git clone --depth 1 https://gnunet.org/git/libmicrohttpd.git
  </code>

  <h2>{{ _("Compile and Install") }}</h2>


  <p>
    Before we can compile GNUnet on Debian 9, we compile and install libmicrohttpd.
  </p>

  <code>
    $ cd ~/gnunet_installation/libmicrohttpd<br>
    $ autoreconf -fi<br>
    $ sudo apt install libgnutls28-dev<br>
    $ ./configure --disable-doc --prefix=/opt/libmicrohttpd<br>
    $ make -j$(nproc || echo -n 1)<br>
    $ sudo make install<br>
  </code>

  <p>
    Installing GNUnet is not hard. We have two options:
    installing a <b>production version</b> and installing a <b>development version</b>. If
    you want to start writing GNUnet applications or join the GNUnet development
    choose the development version (it will print more debug output and contains
    debug symbols that can be displayed with a debugger). Otherwise choose the
    production version.
  </p>

  <h3>{{ _("Option 1: GNUnet for testing / usage") }}</h3>

  <code>
    $ cd ~/gnunet_installation/gnunet<br>
    $ ./bootstrap<br>
    $ export GNUNET_PREFIX=/usr/local # for example, other locations possible<br>
    $ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --with-microhttpd=/opt/libmicrohttpd<br>
    $ sudo addgroup gnunet<br>
    $ sudo usermod -aG gnunet $USER<br>
    $ make -j$(nproc || echo -n 1)<br>
    $ sudo make install
  </code>

  <h3>{{ _("Option 2: GNUnet for development") }}</h3>

  <code>
    $ cd ~/gnunet_installation/gnunet<br>
    $ ./bootstrap<br>
    $ export GNUNET_PREFIX=/usr/local # for example, other locations possible<br>
    $ export CFLAGS="-g -Wall -O0"<br>
    $ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --enable-logging=verbose --with-microhttpd=/opt/libmicrohttpd<br>
    $ sudo addgroup gnunet<br>
    $ sudo usermod -aG gnunet $USER<br>
    $ make -j$(nproc || echo -n 1)<br>
    $ sudo make install
  </code>

  <h3>{{ _("In Addition: gnunet-gtk") }}</h3>
  <p>
    Installing the Gtk+-based graphical user
    interface can be done on top of either the production or development installation.
  </p>
  <code>
    $ sudo apt install libgtk-3-dev libgladeui-dev libunique-dev libqrencode-dev</br>
    $ cd ~/gnunet_installation/gnunet-gtk<br>
    $ ./bootstrap<br>
    $ export GNUNET_PREFIX=/usr/local # for example, other locations possible</br>
    $ export CFLAGS="-g -Wall -O0"<br>
    $ ./configure --prefix=$GNUNET_PREFIX --with-gnunet=$GNUNET_PREFIX<br>
    $ make -j$(nproc || echo -n 1)<br>
    $ sudo make install
  </code>
  <p>
  Since we added our user to the group gnunet, we need to call the following command (or alternatively log out and log in again) to make the membership effective:
  </p>
  <code>
  $ newgrp<br>
  </code>

<!--
  <h3>{{ _("Install GNUnet plugin for name resolution") }}</h3>
      <p>
        So now it gets a bit nasty. It's not so bad. All we have to do
        is copy a file and edit another one. The file we need to copy
        is GNUnet's plugin for the Name Service Switch (NSS) in unix
        systems. Different unixes expect it in different locations and
        GNUnet's build system does not try to guess. On Debian 9 we
        have to do
        <code>
          $ sudo cp /usr/lib/gnunet/nss/libnss_gns.so.2 /lib/$(uname -m)-linux-gnu/
        </code>
      </p>

  <p>
    The next step is activating the GNUnet plugin we just copied
    in the NSS config. It is located in `/etc/nsswitch.conf`. It should
    contain a line starting with "hosts" similar to this (at least "files"
    and "dns" should be there):
  </p>

  <p>
    <code>
      $ cat /etc/nsswitch.conf<br>
      hosts: files mdns4_minimal [NOTFOUND=return] dns
    </code>
  </p>

  <p>
    <b>Attention: Once we modified `/etc/nsswitch.conf` DNS resolution will only
      be possible as long as is GNUnet is running. We can leave the next step out,
      but then we will not be able to use GNUnet's name resolution in external
      applications.</b>
  </p>

  <p>We save a copy of the original file and then modify the line using sed:</p>

  <p>
    <code>
      $ sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.original<br>
      $ sudo sed -i -E 's/^(hosts:.*) dns/\1 gns [NOTFOUND=return] dns/' /etc/nsswitch.conf
    </code>
  </p>

  <p>Now in the line starting with "hosts" should contain an entry "gns [NOTFOUND=return]" before the "dns" entry like this:</p>

  <p>
    <code>
      hosts: files mdns4_minimal [NOTFOUND=return] gns [NOTFOUND=return] dns
    </code>
  </p>

  <p>That's it. It wasn't that nasty, was it?</p>
-->

  <h2>{{ _("Create configuration file") }}</h2>

  <p>
    Congratulations! GNUnet is now installed! Before we start it we
    need to create a configuration file. By default GNUnet looks in
    our home directory for the file `~/.config/gnunet.conf`. We can
    start with an empty file for now:
  </p>

  <code>
    $ mkdir -p ~/.config</br>
    $ touch ~/.config/gnunet.conf
  </code>

  <p>
    Now we created the configuration file. Please check the handbook for a first <a href="https://docs.gnunet.org/handbook/gnunet.html#Minimal-configuration">minimal configuration</a>. But in general, we dont need to configure anything in particular for now.
  </p>

To go on, please <a href="https://gnunet.org/en/use.html">move over here</a>:

  <h2>{{ _("Use GNUnet!") }}</h2>
  <p>
      Please head over here: <a href="https://gnunet.org/en/use.html">Use!</a>
  <p>

  <h2>{{ _("Uninstall GNUnet and its dependencies") }}</h2>

  <code>
    $ cd ~/gnunet_installation/gnunet<br>
    $ sudo make uninstall<br>
    $ cd ~/gnunet_installation/libmicrohttpd<br>
    $ sudo make uninstall<br>
    $ sudo apt remove git libtool autoconf autopoint build-essential libgcrypt-dev libidn11-dev zlib1g-dev libunistring-dev libglpk-dev miniupnpc libextractor-dev libjansson-dev libcurl4-gnutls-dev libsqlite3-dev<br>
    $ sudo apt autoremove<br>
    $ sudo userdel -r gnunet<br>
    $ sudo groupdel gnunet<br>
  </code>

</article>
{% endblock body_content %}