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.

Articles That May Be Related

Tags: , , , ,

This entry was posted on Sunday, July 5th, 2009 at 9:15 AM and is filed under Debian, Tips and tricks. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Responses to “Apt-p2p for peer-to-peer Debian package downloads”

  1. Apt-p2p for peer-to-peer Debian package downloads | Debian-News.net - Your one stop for news about Debian Says:

    [...] 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 [...]

  2. KristianF Says:

    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.

Leave a Reply