lfs-uefi: fix efivar-37 FTBFS
[linux_from_scratch_hints.git] / p2p.txt
blob426c6cfa35db1bf1af1ecb17f626b602745f049a
1 AUTHOR: Jeroen Coumans <jeroen at linuxfromscratch dot org>
3 DATE: 2003-11-07
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: How to download the LFS tarballs via eDonkey
9 DESCRIPTION:
10 A legitimate and increasingly popular option for distributing packages online is
11 via peer-to-peer (P2P) networks. This hint describes how to install and
12 configure mlDonkey.
14 PREREQUISITES:
15 A broadband Internet connection and some patience.
17 HINT:
19 A bit of history:
20 The first succesful P2P network was Napster. By sharing music the program attracted millions of users. It
21 wasn't used for much legal content though, which is why it got shut down. Basically, Napster worked by
22 connecting people's clients to each other via servers. The servers were comparable to catalogues and were
23 used to store the information of what each client offered.
24 More recent P2P networks use a decentralized approach to filesharing. The most popular variants nowadays
25 are the Fasttrack network, used by Kazaa, and the eDonkey network. The eDonkey protocol (and the
26 popularized implementation of eMule) has the following features:
28 * Files can be downloaded from different sources at the same time.
29 * Files are identified by unique identifiers (MD4) that can be used to find new
30 sources for a file.
31 * Files are checked using checksums, and chunks (9MB) that are corrupted are
32 downloaded again.
33 * Files chunks can be downloaded in any order.
34 * Files are shared as soon as a checked chunk has been downloaded, to speed up
35 the spreading of files.
36 * Need some servers to be known, mldonkey can use servers.ini file that is in 
37 the distribution.
38 (list copied from the mlDonkey wiki)
40 On http://www.linuxfromscratch.org/lfs/packages.html you find several
41 eDonkey links. These can be used to download the LFS packages tarball via an
42 eDonkey client. Lucky for us, the protocol has several fully-functional open
43 source implementations (xmule, amule, emule, mldonkey). You can also use the
44 official implementation (edonkey and overnet), although it has little advantages
45 over the others and is only available as binary (big no-no for LFS'ers). I'll
46 only explain how to install and use mlDonkey though, since that is what I have
47 actual experience with. If people are willing to contribute instructions for
48 their favorite client, I'll gladly put it in here. :)
50 About eDonkey:
51 eDonkey works with queues: if you start a download, you'll get placed in the
52 queue of everyone who shares that package. Downloading costs you points while
53 uploading gains you points so you are rewarded for sharing. Whatever you
54 download gets automatically shared.
55 Some rules of thumb to keep in mind:
56 1. you probably want to regulate how much bandwidth your client can use, and
57 2. the longer your client runs, the faster your downloads will go. In the 
58 beginning, they'll be slow. I recommend letting it run as long as you can
59 afford your computer to be online (mine is 24x7).
60 3. the more people who share a certain file, the faster your download will go.
62 mlDonkey:
63 mlDonkey requires ocaml for compilation and lablgtk for the ugly
64 GTK-1.2-based GUI. You can use --enable-batch to wget and install them locally
65 just for mlDonkey, or install them seperately if you're paranoid. Skip the
66 installation of ocaml and lablgtk if you intend to use --enable-batch.
68 Download ocaml from:
69 http://caml.inria.fr/distrib/ocaml-3.06/ocaml-3.06.tar.gz
71 Installing ocaml the way mlDonkey would:
72 ./configure -prefix /usr -no-tk -with-pthread &&
73 cd config &&
74 mv Makefile Makefile.old &&
75 sed \
76 "s/OTHERLIBRARIES=.*/OTHERLIBRARIES=unix dynlink num str bigarray threads/" \
77 Makefile.old > Makefile &&
78 cd .. &&
79 make world opt opt.opt &&
80 make INSTALL_MANODIR=/tmp install
82 There are several GUI implementations for mlDonkey. You can use them next to
83 each other since they all use a client-server model to communicate with the
84 mlDonkey daemon. It is not required to install any GUI though, since you can
85 also communicate with the mlDonkey daemon via telnet or via a webbased GUI. To
86 build the GTK-1.2-based GUI bundled with mlDonkey, you require lablgtk.
88 Download lablgtk from:
89 http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/dist/lablgtk-1.2.6.tar.gz
91 Install lablGTK:
92 make configure &&
93 make &&
94 make opt &&
95 make install
97 Installing mlDonkey:
98 Get your source from http://savannah.nongnu.org/download/mldonkey/ . The current
99 stable release can be downloaded from
100 http://savannah.nongnu.org/download/mldonkey/release-2.5-4/official/mldonkey-2.5
101 -4.tar.gz. Compile it with the following commands:
103 ./configure --prefix=/usr &&
104 make &&
105 make install
107 If you only want to use mlDonkey for the eDonkey network, add --disable-multinet
108 to configure options. If you want to disable the gui: --disable-gui. Check
109 --help for other options.
111 To install the G2Gui:
112 Haven't tried compiling it yet, but installing the GTK2 or Motif version is a
113 breeze. Download the appropriate file from
114 http://developer.berlios.de/project/showfiles.php?group_id=610, unpack it and
115 run g2gui.sh. It needs a Java VM in the path though.
117 Running mlDonkey:
118 It is recommended to use a seperate user for mlDonkey, for example "mldonkey".
119 Make sure it is an unique user who only has access to his home directory. I use
120 the following commands to start mldonkey with daemontools' setuidgid:
122 cd /home/mldonkey/exec /usr/bin/env - PWD=/home/mldonkey /sbin/setuidgid mldonkey
123 /usr/bin/mlnet -stdout
125 A similar command which uses su would go like this:
126 su - mldonkey;
127 cd $HOME
128 /usr/bin/env -i HOME=$HOME SHELL=/bin/bash \
129 /bin/bash --noprofile --norc
130 /usr/bin/mlnet -stdout
132 The daemon now runs and outputs a lot of messages. You can run it in the
133 background by leaving out the -stdout and putting an ampersand (&) at the end of
134 the line. You can also run it supervised with daemontools. The first thing the
135 daemon tries to do is connect to a server. Allthough the eDonkey protocol is
136 decentralized and functions server-less, servers are used as catalogues to speed
137 up searches. mlDonkey comes with a large serverlist and automatically maintains
138 its server lists, so this part doesn't require any action. If you have trouble
139 connecting, your firewall may be blocking the daemon. My BLFS firewall allows
140 mlDonkey to work with the following line:
142 iptables -A INPUT  -p tcp --dport 4662 -m state --state NEW,ESTABLISHED \
143 -j ACCEPT
145 You may check the following resources if that doesn't work though (watch line
146 wrapping):
148 http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=FireWall
149 http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=WhatFirewallPortsToOp
151 http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=IPTables
153 Last but not least: it's also possible to compile mlDonkey statically and
154 install it in a chroot. This shouldn't be a lot of work for people who are
155 experienced in that sort of thing.
157 Configuring mldonkey:
158 You can control mldonkey via several ways:
160 * via your browser: http://127.0.0.1:4080/
161 * via the GTK gui: mldonkey_gui
162 * via telnet: telnet 127.0.0.1 4000
164 Start downloading files by using the input field in your browser,
165 the ed2k:// field at the bottom of the Downloads tab in the GUI or by "dllink
166 ed2k://" via telnet. If you like to share files, put them in
167 /home/mldonkey/incoming/ and they'll automatically be shared.
169 To enable Mozilla/MozillaFirebird to automatically download ed2k:// links, copy
170 /usr/src/mldonkey/distrib/ed2k_mozilla/src/ed2kprotocol.js to
171 /usr/lib/mozilla/components/ed2kprotocol.js. Now all links on the LFS packages
172 page work! To use mldonkey with KDE/Konqueror, install the program at 
173 http://www.gibreel.net/projects/kmldonkey/
175 Links:
176 Official edonkey homepage: http://www.edonkey2000.com/
177 Official mldonkey homepage: http://www.nongnu.org/mldonkey/
178 mldonkey world (community page): http://mldonkey.berlios.de/
179 mldonkey FAQ: http://www.nongnu.org/mldonkey/faq.html
181 ACKNOWLEDGEMENTS:
182   * None yet
184 CHANGELOG:
185 [2003-11-06]
186   * Initial hint. 
187 [2003-11-07]
188   * Spell fixes. Added information about the different GUI's.