aboutsummaryrefslogtreecommitdiff
path: root/template/tutorial-ubuntu1804.html.j2
diff options
context:
space:
mode:
Diffstat (limited to 'template/tutorial-ubuntu1804.html.j2')
-rw-r--r--template/tutorial-ubuntu1804.html.j2499
1 files changed, 499 insertions, 0 deletions
diff --git a/template/tutorial-ubuntu1804.html.j2 b/template/tutorial-ubuntu1804.html.j2
new file mode 100644
index 00000000..9645f169
--- /dev/null
+++ b/template/tutorial-ubuntu1804.html.j2
@@ -0,0 +1,499 @@
1{% extends "common/base.j2" %}
2{% block body_content %}
3<article class="container">
4<!--<article> -->
5<header>
6 <h2>{{ _("Tutorial: GNUnet on Ubuntu 18.04") }}</h2>
7</header>
8<section>
9 <h3>{{ _("Introduction") }}</h3>
10 <p>
11 Welcome to the hopefully painless GNUnet tutorial for Ubuntu 18.04!
12 It provides very concrete instructions on how to compile, install
13 and configure a current version of GNUnet. The goal is to support
14 newcomers, either end users or developers, who want to get in touch
15 with GNUnet for the first time. After installing GNUnet we will make
16 sure that out new GNUnet installation is working correctly.
17 </p>
18 <p>
19 <b>Attention: If you came across the official gnunet package for
20 Ubuntu 18.04, ignore it! It is ancient and not compatible with
21 current GNUnet installations.</b>
22 </p>
23 <p>
24 Now let's start!
25 </p>
26</section>
27<section>
28 <h3>{{ _("Requirements") }}</h3>
29 <p>
30 First let's install the following Ubuntu 18.04 packages to use
31 GNUnet painlessly. Optional dependencies are listed in Appendix
32 A. They are required for some experimental GNUnet features.
33 </p>
34 <code>
35 $ sudo apt install git libtool autoconf autopoint \<br>
36 build-essential libgcrypt-dev libidn11-dev zlib1g-dev \<br>
37 libunistring-dev libglpk-dev miniupnpc libextractor-dev \<br>
38 libjansson-dev libcurl4-gnutls-dev libsqlite3-dev openssl \<br>
39 libnss3-tools libmicrohttpd-dev
40 </code>
41</section>
42<section>
43 <h3>{{ _("Make an installation directory") }}</h3>
44 <p>
45 Next we create a directory in our home directory where we store
46 the source code later. We should keep this directory after
47 installation because it contains Makefiles that can be used for
48 uninstalling GNUnet again (see chapter *Uninstall GNUnet and its
49 dependencies*).
50 </p>
51 <code>
52 $ mkdir ~/gnunet_installation
53 </code>
54</section>
55<section>
56 <h3>{{ _("Get the source code") }}</h3>
57 <p>
58 We download the GNUnet source code using git.
59 </p>
60 <code>
61 $ cd ~/gnunet_installation<br>
62 $ git clone --depth 1 https://gnunet.org/git/gnunet.git<br>
63 </code>
64</section>
65<section>
66 <h3>{{ _("Compile and Install") }}</h3>
67 <p>
68 Installing GNUnet is not hard. We have two options:
69 installing a *production version* and installing a *development version*. If
70 you want to start writing GNUnet applications or join the GNUnet development
71 choose the development version (it will print more debug output and contains
72 debug symbols that can be displayed with a debugger). Otherwise choose the
73 production version.
74 </p>
75</section>
76<section>
77 <h4>{{ _("Option 1: GNUnet for production / usage") }}</h4>
78 <code>
79 $ cd ~/gnunet_installation/gnunet<br>
80 $ ./bootstrap<br>
81 $ export GNUNET_PREFIX=/usr<br>
82 $ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --with-microhttpd=/opt/libmicrohttpd<br>
83 $ sudo addgroup gnunetdns<br>
84 $ sudo adduser --system --group --disabled-login --home /var/lib/gnunet gnunet<br>
85 $ make -j$(nproc || echo -n 1)<br>
86 $ sudo make install
87 </code>
88</section>
89<section>
90 <h4>{{ _("Option 2: GNUnet for development") }}</h4>
91
92 <code>
93 $ cd ~/gnunet_installation/gnunet<br>
94 $ ./bootstrap<br>
95 $ export GNUNET_PREFIX=/usr<br>
96 $ export CFLAGS="-g -Wall -O0"<br>
97 $ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --enable-logging=verbose <br>
98 $ make -j$(nproc || echo -n 1)<br>
99 $ sudo make install
100 </code>
101
102 <!--
103<h4>{{ _("Install GNUnet plugin for name resolution") }}</h4>
104 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 Ubuntu 18.04 we have to do
105
106 <code>
107 $ sudo cp /usr/lib/gnunet/nss/libnss_gns.so.2 /lib/$(uname -m)-linux-gnu/
108 </code>
109
110 <p>The next step is activating the GNUnet plugin we just copied in the NSS
111 config. It is located in `/etc/nsswitch.conf`. It should contain a line
112 starting with "hosts" similar to this (at least "files" and "dns" should be
113 there):</p>
114
115 <code>
116 $ cat /etc/nsswitch.conf<br>
117 hosts: files mdns4_minimal [NOTFOUND=return] dns
118 </code>
119
120 <p><b>Attention: Once we modified `etc/nsswitch.conf` DNS resolution will only
121 be possible as long as is GNUnet is running. We can leave the next step out,
122 but then we will not be able to use GNUnet's name resolution in external
123 applications.</b></p>
124
125 <p>We save a copy of the original file and then modify the line using sed:</p>
126
127 <code>
128 $ sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.original<br>
129 $ sudo sed -i -E 's/^(hosts:.*) dns/\1 gns [NOTFOUND=return] dns/' /etc/nsswitch.conf
130 </code>
131
132 <p>Now in the line starting with "hosts" should contain an entry "gns [NOTFOUND=return]" before the "dns" entry like this:</p>
133
134 <code>
135 hosts: files mdns4_minimal [NOTFOUND=return] gns [NOTFOUND=return] dns
136 </code>
137
138 <p>That's it. It wasn't that nasty, was it?</p>
139-->
140</section>
141<section>
142 <h3>{{ _("Configuration") }}</h3>
143
144 <p>
145 Congratulations! GNUnet is now installed! Before we start it we
146 need to create a configuration file. By default GNUnet looks in
147 our home directory for the file `~/.gnunet/gnunet.conf`. We can
148 start with an empty file for now:
149 </p>
150
151 <code>
152 $ touch ~/.config/gnunet.conf
153 </code>
154
155 <p>
156 Now we can start it with the command line tool `gnunet-arm`
157 (Automatic Restart Manager).
158 </p>
159
160 <code>
161 $ gnunet-arm -s
162 </code>
163
164 <p>
165 It starts the default GNUnet services. We can list them with the `-I` option:
166 </p>
167
168 <code>
169 $ gnunet-arm -I<br>
170 Running services:<br>
171 ats (gnunet-service-ats)<br>
172 revocation (gnunet-service-revocation)<br>
173 set (gnunet-service-set)<br>
174 nat (gnunet-service-nat)<br>
175 transport (gnunet-service-transport)<br>
176 peerstore (gnunet-service-peerstore)<br>
177 hostlist (gnunet-daemon-hostlist)<br>
178 identity (gnunet-service-identity)<br>
179 namecache (gnunet-service-namecache)<br>
180 peerinfo (gnunet-service-peerinfo)<br>
181 datastore (gnunet-service-datastore)<br>
182 zonemaster (gnunet-service-zonemaster)<br>
183 zonemaster-monitor (gnunet-service-zonemaster-monitor)<br>
184 nse (gnunet-service-nse)<br>
185 cadet (gnunet-service-cadet)<br>
186 dht (gnunet-service-dht)<br>
187 core (gnunet-service-core)<br>
188 gns (gnunet-service-gns)<br>
189 statistics (gnunet-service-statistics)<br>
190 topology (gnunet-daemon-topology)<br>
191 fs (gnunet-service-fs)<br>
192 namestore (gnunet-service-namestore)<br>
193 vpn (gnunet-service-vpn)
194 </code>
195
196 <p>
197 For stopping GNUnet again we can use the `-e` option.
198 </p>
199
200 <code>
201 $ gnunet-arm -e
202 </code>
203</section>
204<section>
205 <h3>{{ _("Make sure it works") }}</h3>
206
207 <p>
208 Let's try out some of GNUnet's use cases. Some should be done before others:
209 </p>
210
211 <ul>
212 <li>filesharing</li>
213 <li>A simple chat using CADET</li>
214 <li>Name resolution using GNS on the command line</li>
215 <li>Name resolution using GNS with a browser (do it on the command line first)</li>
216 <li>Serving a website using VPN (do name resolution with a browser first)</li>
217 </ul>
218</section>
219<section>
220 <h4>{{ _("filesharing") }}</h4>
221
222 <p>
223 Let's publish a file in the GNUnet filesharing network. We use the keywords
224 ("commons" and "state") so other people will be able to search for the file.
225 </p>
226
227 <p>
228 We can choose any file and describe it with meaningful keywords (using the
229 `-k` command line option).
230 </p>
231
232 <code>
233 $ gnunet-publish -k commons -k state ostrom.pdf<br>
234 Publishing `/home/myself/ostrom.pdf' done.<br>
235 URI is `gnunet://fs/chk/M57SXDJ72EWS25CT6307KKJ8K0GCNSPTAZ649NA1NS10MJB4A1GZ9EN4Y02KST9VA5BHE8B335RPXQVBWVZ587Y83WQ7J3DHMBX30Q8.DHNGBN4CB2DBX1QRZ1R0B1Q18WTEAK4R94S9D57C9JMJJ3H7SSQDCV4D1218C4S2VP085AMQQSMG18FCP6NQMZQZJ91XR5NBX7YF0V0.42197237'.
236 </code>
237
238 <p>
239 Finding the file by keyword works with `gnunet-search`.
240 </p>
241
242 <code>
243 $ gnunet-search commons<br>
244 #1:<br>
245 gnunet-download -o "ostrom.pdf" gnunet://fs/chk/M57SXDJ72EWS25CT6307KKJ8K0GCNSPTAZ649NA1NS10MJB4A1GZ9EN4Y02KST9VA5BHE8B335RPXQVBWVZ587Y83WQ7J3DHMBX30Q8.DHNGBN4CB2DBX1QRZ1R0B1Q18WTEAK4R94S9D57C9JMJJ3H7SSQDCV4D1218C4S2VP085AMQQSMG18FCP6NQMZQZJ91XR5NBX7YF0V0.42197237
246 </code>
247
248 <p>
249 It gives us the command line call to download the file (and store it as
250 ostrom.pdf)!
251 </p>
252</section>
253<section>
254 <h4>{{ _("CADET (and Chat)") }}</h4>
255
256 <p>
257 We can use the `gnunet-cadet` command line tool to open a port and from
258 another machine connect to this port and chat or transfer data. First we need
259 our *peer ID* of the GNUnet peer opening the port.
260 </p>
261
262 <code>
263 $ gnunet-peerinfo -s<br>
264 I am peer `P4T5GHS1PCZ06R82D3KW8Z8J1113BQZWAWGYHTZ8G1ZXMWXQGAVG'.
265 </code>
266
267 <p>
268 Now we open the port (it can be any string!):
269 </p>
270
271 <code>
272 $ gnunet-cadet -o my-secret-port
273 </code>
274
275 <p>On the other machine we can connect using the peer ID and the port and start chatting!</p>
276
277 <code>
278 $ gnunet-cadet P4T5GHS1PCZ06R82D3KW8Z8J1113BQZWAWGYHTZ8G1ZXMWXQGAVG my-secret-port
279 </code>
280</section>
281<section>
282 <h4>{{ _("Name resolution using GNS on the command line") }}</h4>
283
284 <p>GNS is the GNU name service, a fully decentralized alternatice to DNS. We'll publish an IP address in a GNS record try to resolve it on the command line. First we need an identity which is the
285 equivalent to a zone in DNS. We'll call it "myself" and create it using the
286 `gnunet-identity` command line tool. Instead of "myself" you can surely use your
287 nick or any other name. </p>
288
289 <code>
290 $ gnunet-identity -C myself
291 </code>
292
293 <p>We can check if it worked using the same tool. We expect the name of our identity and the corresponding public key to be displayed.</p>
294
295 <code>
296 $ gnunet-identity -d<br>
297 myself - HWTYD3P5D77JVFNVMZ1M5T10V4SZYNMY3PCGQCSVENKD6ZCRKPMG
298 </code>
299
300 <p>
301 Now we add a public `A` record to our zone. It has the name "ccc", a value
302 of "195.54.164.39" and it expires after one day.
303 </p>
304
305 <code>
306 $ gnunet-namestore -z myself -a -e "1 d" -p -t A -n ccc -V 195.54.164.39
307 </code>
308
309 <p>Now we can query that record using the command line tool `gnunet-gns`.</p>
310
311 <code>
312 $ gnunet-gns -t A -u ccc.myself<br>
313 ccc.myself:<br>
314 Got `A' record: 195.54.164.39
315 </code>
316
317 <p>
318 So it worked! But only resolving our own records is boring. So we
319 can give our identity (the public key of it to be precise) to
320 someone else so they can try to resolve our records, too. The
321 other person (Bob) has to add it to his namestore like this:
322 </p>
323
324 <code>
325 $ gnunet-namestore -z myself -a -e never -p -t PKEY -n alice -V HWTYD3P5D77JVFNVMZ1M5T10V4SZYNMY3PCGQCSVENKD6ZCRKPMG
326 </code>
327
328 <p>
329 Our identity in Bobs namestore is a public record (-p) and never
330 expires (-e never). Now Bob (let's assume he has called his
331 identity myself, too) should be able to resolve our "ccc" record,
332 too!
333 </p>
334
335 <code>
336 $ gnunet-gns -t A -u ccc.alice.myself<br>
337 ccc.alice.myself:<br>
338 Got `A' record: 195.54.164.39
339 </code>
340
341 <p>
342 It can continue like this. A friend of Bob would be able to
343 resolve our records too because Bob published our identity in a
344 public record. Bobs friend would simply use "ccc.alice.bob.myself"
345 to resolve our "ccc" record.
346 </p>
347</section>
348<section>
349 <h4>{{ _("Name resolution using GNS with a browser") }}</h4>
350
351 <p>
352 In the previous use case "Name resolution using GNS on the command line" we got an idea
353 about what GNS is about, but now let's use it with a browser, to make it actually useful. Currently Firefox and Chromium are known to work.
354 </p>
355
356 <p>
357 Many websites enforce HTTPS and thus provide certificates for
358 their hostnames (and not our GNS names). Browsers don't like wrong
359 hostnames in certificates and will present error messages. So GNUnet
360 has to trick them by generating own certificates for our GNS
361 names. This means we need to create our own certificate authority
362 and tell our browser about it. Luckily there's a script for it:
363 </p>
364
365 <code>
366 $ gnunet-gns-proxy-setup-ca
367 </code>
368
369 <p>After executing this script the Browser has to be restarted.</p>
370
371 <p>
372 GNUnet provides a proxy service (gnunet-gns-proxy) that the
373 browser can send DNS and HTTP traffic to. It will try to resolve
374 names with GNS first and forward the rest of the DNS traffic to
375 the system's DNS resolver. It will also take care of the HTTP
376 traffic, so the browser gets valid certificates and the web server
377 will not be confused by our GNS hostnames. Our GNS namestore
378 doesn't know about any DNS hostnames yet, so we have to store
379 them, too. For our "ccc" A record, we have to store a LEHO (legacy
380 hostname) record, too. It must contain the website's original DNS
381 hostname:
382 </p>
383
384 <code>
385 $ gnunet-namestore -z myself -a -e "1 d" -p -t LEHO -n ccc -V www.ccc.de
386 </code>
387
388 <p>Now let's start gnunet-gns-proxy.</p>
389
390 <code>
391 $ /usr/lib/gnunet/libexec/gnunet-gns-proxy
392 </code>
393
394 <p>
395 Our browser has to be configured so it uses our proxy. In Firefox
396 we have to set these options under "about:config":
397 </p>
398
399 <code>
400 network.proxy.socks: localhost<br>
401 network.proxy.socks_port: 7777<br>
402 network.proxy.socks_remote_dns true<br>
403 network.proxy.type: 1
404 </code>
405
406 <p>
407 To tell Chromium to use the proxy, it has to be started with the
408 "--proxy-server" command line option:
409 </p>
410
411 <code>
412 $ chromium --proxy-server="socks5://127.0.0.1:7777"
413 </code>
414
415 <p>
416 Now we should be able to resolve our GNS names in the browser! We
417 just have to type "https://ccc.myself" into the address bar. If
418 our friend Bob prepared his system, too, he can resolve our record
419 by typing "ccc.alice.myself".
420 </p>
421</section>
422<section>
423 <h4>{{ _("VPN") }}</h4>
424
425 <p>
426 TBD
427 </p>
428</section>
429<section>
430 <h3>{{ _("Uninstall GNUnet and its dependencies") }}</h3>
431
432 <code>
433 $ cd ~/gnunet_installation/gnunet<br>
434 $ sudo make uninstall<br>
435 $ cd ~/gnunet_installation/libmicrohttpd<br>
436 $ sudo make uninstall<br>
437 $ 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>
438 $ sudo apt autoremove<br>
439 $ sudo userdel -r gnunet<br>
440 $ sudo groupdel gnunet<br>
441 $ sudo groupdel gnunetdns<br>
442 $ sudo mv /etc/nsswitch.conf.original /etc/nsswitch.conf<br>
443 $ sudo rm /lib/$(uname -m)-linux-gnu/libnss_gns.so.2
444 </code>
445</section>
446<section>
447 <h3>{{ _("Appendix A: Optional GNUnet features") }}</h3>
448
449 <p>
450 TBD
451 </p>
452</section>
453<section>
454 <h3>{{ _("Troubleshooting") }}</h3>
455</section>
456<section>
457 <h4>{{ _("You can't reach other people's nodes") }}</h4>
458
459 <p>
460 Should our computer not have reached the open GNUnet network automatically,
461 we can manually instruct our node how to reach the nodes of our friends. This
462 works by exchanging HELLO strings. This is how we get a hello string for our
463 computer.
464 </p>
465
466 <code>
467 $ gnunet-peerinfo -gn
468 </code>
469
470 <p>
471 We can now pass this string to our friends "out of band" (using whatever
472 existing chat or messaging technology). If the string contains some private IP
473 networks we don't want to share, we can carefully edit them out.
474 </p>
475
476 <p>
477 Once we receive such strings from our friends, we can add them like
478 this:
479 </p>
480
481 <code>
482 gnunet-peerinfo -p <string>
483 </code>
484
485 <p>Now our GNUnet nodes can attempt reaching each other directly. This may
486 still fail due to NAT traversal issues.</p>
487
488 <!--<h4>{{ _("OMG you guys broke my internet") }}</h4>
489
490 <p>We can replace `/etc/nsswitch.conf` with the backup we made earlier
491 (`/etc/nsswitch.conf.original`). Now DNS resolution should work again without a
492 running GNUnet.</p>
493
494 <code>
495 $ cp /etc/nsswitch.conf.original /etc/nsswitch.conf
496 </code>-->
497</section>
498</article>
499{% endblock body_content %}