Apt-p2p for peer-to-peer Debian package downloads
Apt-p2p gives you the ability to download Debian packages via a peer-to-peer protocol. Apt-p2p will try to get the packages from peers before it resorts to pulling them from the repository. This saves bandwidth for the repository servers, can speed up your download speed, and ads to the sense of community which Debian is so rich with. Downloading and installing Apt-p2p is pretty simple and can be done via apt. Take a look at the main apt-p2p page for download details.
Installing Apt-p2p
$: apt-get install apt-p2p
Or http://packages.debian.org/source/lenny/apt-p2p
Configuring Apt-p2p
Apt-p2p is run from init.d using twistd, this means that options can not be specified for apt-p2p within the command line. All options are required to be changed in the configuration file which can be found at ${HOME}/.apt-p2p/apt-p2p.conf and /etc/apt-p2p/apt-p2p.conf
In order for apt-p2p to be able to pull from peers before repositories you must edit your sources list found at /etc/apt/sources.list. Unless you have changed the default port then apt-p2p will run on port 9977 and you can edit each entry to start with http://localhost:9977
Example:
deb http://ftp.us.debian.org/debian etch main contrib non-free
-replace with
deb http://localhost:9977/ftp.us.debian.org/debian etch main contrib non-free
Port Forwarding
If you don’t have the port forwarded correctly you will not be able to do anything. Please make sure you have your port settings correct in your firewall, router, etc.
Apt-P2P uses a default port of 9977, over both TCP and UDP, for it’s communication. You can change this port in the /etc/apt-p2p/apt-p2p.conf file
Options
These programs follow the usual GNU command line syntax, with short
options starting with a single dash (’-’), and long options starting
with two dashes (’–’). A summary of options is included below.
-c filename, –configfile=filename
the filename to use for the configuration file, options found
in this file are combined with those in ${HOME}/.apt-p2p/apt-
p2p.conf and /etc/apt-p2p/apt-p2p.conf (see apt-p2p.conf(5)
for the format of the file)
-l filename, –logfile=filename
the filename to print log messages to, or ’-’ to log to stan?
dard output, if not specified then /var/log/apt-p2p.log will
be used
h, –help
print a help message describing the invocation of the program
-v, –version
print the version of the program
Using apt-p2p
Once you have everything set up for apt-p2p there really is nothing left to do. When you use apt-get, aptitude, or anything else that draws from the apt repositories it will attempt to pull the files from p2p before it defaults to the repository.


•
July 6th, 2009 at 11:40 AM
[...] will try to get the packages from peers before it resorts to pulling them from the repository. More here This saves bandwidth for the repository servers, can speed up your download speed, and ads to the [...]
November 6th, 2009 at 10:58 PM
Are there a way you can limit upload speed in any way?
Looked in the repositories could not find any man page for apt-p2p.