]> git.mxchange.org Git - quix0rs-apt-p2p.git/blob - docs/debaday.html
a8675017dc141ed166836fb8e452d69119711d2e
[quix0rs-apt-p2p.git] / docs / debaday.html
1 <div class="entry">
2
3 <p><strong>Article submitted by Cameron Dale. Guess what? We still need
4 you to <a href="http://debaday.debian.net/contribute/">submit good
5 articles about software you like</a>!</strong></p>
6
7 <p>Do you want to help out the Debian (or Ubuntu) project with some
8 mirror bandwidth but don't know how? Do you want to contribute somehow
9 to Debian's infrastructure, but you're not a coder? Tired of getting
10 slow download speeds when the mirrors are overloaded after a new
11 release? Then Apt-P2P is for you.</p>
12
13 <p>After installing the apt-p2p package and making some minor changes to
14 apt's sources, all the files you download with apt (or aptitude,
15 synaptic, gnome-apt, etc...) will be shared with other users, and any
16 files you download will use other users (peers) to download from.
17 However, if no other users have the file you want there's no need to
18 worry, Apt-P2P will happily fall back to downloading directly from the
19 mirror so your download will not fail.<p>
20
21 <h4>How it works</h4>
22
23 <p>The main operation of Apt-P2P is the maintenance of a
24 <a href="http://en.wikipedia.org/wiki/Distributed_hash_table">Distributed
25 Hash Table (DHT)</a> used to find and store peers to download from for
26 each file. Whenever you download a file, apt-2p will first lookup the
27 SHA1 hash of the file in the DHT. If it is found and has peers listed,
28 then the downloading will occur from the peers (if there are only 1 or 2
29 peers, the mirror is used as well to speed up the download). If it is
30 not found then the file is requested directly from the mirror. Once the
31 download is complete, a new value is added to the DHT using the SHA1
32 hash of the file as the key, and including your contact info, so that
33 other peers can then find you to download the file from.</p>
34
35 <p>That's just a brief overview, but there are many hidden details that
36 make things go smoother. For example, for larger files the SHA1 hashes
37 of pieces of the file are stored in the DHT as well, which allows
38 downloaders to break up large files among several peers to get better
39 download speeds (similar to BitTorrent). For more information, you can
40 go to the Apt-P2P home page:
41 <a href="http://www.camrdale.org/apt-p2p/">http://www.camrdale.org/apt-p2p/</a>.</p>
42
43 <h4>Statistics</h4>
44
45 <p>Since Apt-P2P is a daemon, it doesn't have any user interface for a
46 nice screenshot. However, if you go to
47 <a href="http://localhost:9977/">http://localhost:9977/</a> in your
48 browser on the machine Apt-P2P is running on, you will get a nice
49 display of various statistics. These include:</p>
50
51 <ul>
52 <li>Total amount downloaded and uploaded this session.</li>
53 <li>Total amount downloaded and uploaded for all time.</li>
54 <li>Amount downloaded broken up into mirrors and other users.</li>
55 <li>Number of files being shared.</li>
56 <li>Number of DHT keys and values being stored for other peers.</li>
57 <li>Amount downloaded and uploaded in DHT messages.</li>
58 <li>Number of DHT peers in contact and an estimated total number.</li>
59 </ul>
60
61 <p>Don't be discouraged if you don't upload much to, or download much
62 from, other peers yet. Apt-P2P is still young and needs more people to
63 use it to increase the chances of finding peers for files. Tell your
64 friends!</p>
65
66 <h4>Comparison with other P2P programs</h4>
67
68 Other than <a href="http://debtorrent.alioth.debian.org/">DebTorrent<a>,
69 there aren't any other peer-to-peer downloaders available for apt. There
70 was <a href="http://sianka.free.fr/">apt-torrent<a>, but it was never
71 packaged in Debian, and now seems to be dead (no updates in 18 months).
72 Comparing Apt-P2P with DebTorrent, Apt-P2P:
73
74 <ul>
75 <li>Is faster at downloading from mirrors.</li>
76 <li>Uses much less memory and a little less CPU.</li>
77 <li>Can download almost all files (source files,
78 <kbd>Packages.bz2</kbd>, etc...) from peers, not just <kbd>.deb</kbd>
79 packages.</li>
80 <li>Works with only the information apt has, no need for other
81 files.</li>
82 <li>Doesn't require a new apt transport for communicating with apt.</li>
83 <li>Is more modular and easier to understand as it is based on existing
84 technologies (e.g. <a href="http://twistedmatrix.com">twisted<a>).</li>
85 </ul>
86
87 <h4>Setup</h4>
88
89 <p>Apt-P2P is available in testing (lenny) and unstable (sid), and will
90 be available in Intrepid for Ubuntu. It can be installed by
91 <kbd>aptitude install apt-p2p</kbd>.</p>
92
93 <p>Setting up apt to use Apt-P2P as a proxy is easy, especially if you
94 have used other proxy software (e.g. apt-proxy, apt-cacher, approx) in
95 the past. The configuration change is the same, simply adding a
96 <kbd>localhost:9977/</kbd> to the front of the entries in your
97 <kbd>/etc/apt/sources.list</kbd> file. For example, if you previously
98 had this:
99
100 <pre class="terminal"># Official
101 deb http://ftp.us.debian.org/debian etch main contrib non-free
102 deb-src http://ftp.us.debian.org/debian etch main contrib non-free
103
104 # Security Updates
105 deb http://security.debian.org/ etch/updates main contrib non-free
106 deb-src http://security.debian.org/ etch/updates main contrib non-free
107
108 # Unofficial
109 deb http://ftp.debian-unofficial.org/debian etch main contrib non-free restricted
110 deb-src http://ftp.debian-unofficial.org/debian etch main contrib non-free restricted
111
112 # Backports
113 deb http://www.backports.org/debian etch-backports main contrib non-free
114 deb-src http://www.backports.org/debian etch-backports main contrib non-free</pre>
115
116 <p>Then, if you only want to share the official and backported packages,
117 you would change it to this:</p>
118
119 <pre class="terminal"># Official
120 deb http://localhost:9977/ftp.us.debian.org/debian etch main contrib non-free
121 deb-src http://localhost:9977/ftp.us.debian.org/debian etch main contrib non-free
122
123 # Security Updates
124 deb http://security.debian.org/ etch/updates main contrib non-free
125 deb-src http://security.debian.org/ etch/updates main contrib non-free
126
127 # Unofficial
128 deb http://ftp.debian-unofficial.org/debian etch main contrib non-free restricted
129 deb-src http://ftp.debian-unofficial.org/debian etch main contrib non-free restricted
130
131 # Backports
132 deb http://localhost:9977/www.backports.org/debian etch-backports main contrib non-free
133 deb-src http://localhost:9977/www.backports.org/debian etch-backports main contrib non-free</pre>
134
135 <p>Then, run an <kbd>apt-get update</kbd> and start installing
136 packages.</p>
137
138 <p>It's also <strong>VERY</strong> important to set up port forwarding
139 if your machine is behind a firewall or router/NAT. More information on
140 how to determine if you are connectable can be
141 <a href="http://www.camrdale.org/blog/posts/May-10-2008/">found
142 here</a>.</p>
143
144 </div>