peer-to-peer proxy to speed apt downloads in Ubuntu with Apt-P2P

This post was written by admin on April 18, 2011
Posted Under: Internet

Apt-P2P is a peer-to-peer proxy for apt downloads. Similar to DebTorrent, Apt-P2P will act as a proxy between apt requests and a debian repository server, downloading any requested files from peers (if possible), but falling back to a direct HTTP download. Unlike DebTorrent, Apt-P2P will be simple, efficient, and fast.

Features

  • Downloads from peers, increasing the available bandwidth to the user
  • Reduces the bandwidth requirements needed to setup a repository of packages
  • Seamlessly integrates with the current APT tool
  • Automatically falls back to downloading from an HTTP mirror when peers are not available
  • Builds on other already existing tools where possible
  • Fast and requires limited CPU and memory
  • Will try to download any file it can find a hash for from peers (including Packages.bz2, Sources.gz, …)

This software is open-source and is released at no charge under the terms of the GPL v2 license.

Install and setup apt-p2p

1.) First, install the dependences:

sudo apt-get install python python-apt python-twisted python-twisted-web2

2.) Then install apt-p2p using:

sudo apt-get install apt-p2p

3.) Backup and configure the source.list:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo sed -i 's%http://%http://localhost:9977/%g' /etc/apt/sources.list

4.) edit apt-p2p configuration file:

gksudo gedit /etc/apt-p2p/apt-p2p.conf

here you can change the UDP port, upload bandwidth, peers, cache dir, and so on.

5.) If there’s a firewall or route, set to allow 9967 and 9977.

6.) Restart apt-p2p service to apply change:

sudo rm -rf /var/cache/apt-p2p/cache/*
sudo /etc/init.d/apt-p2p restart

Now, you can use apt-get command to install packages or update system as apt-p2p fully integrated.

BTW: If you change mind and want to unistall apt-p2p or something’s messed up, use following command to restore:

sudo apt-get remove --purge apt-p2p
sudo cp /etc/apt/sources.list.backup /etc/apt/sources.list
sudo rm -rf /var/cache/apt-p2p/*
sudo apt-get update

This is a rewrite of the original tutorial in Chinese.

Related posts:

  1. Speed up web browsing in Firefox/Opera using Local DNS
  2. Install YaCy The Peer-to-Peer search engine in Ubuntu
  3. Speed up Firefox by moving cache into RAM in Ubuntu
  4. MLDonkey-multi-platform,multi-network,peer-to-peer client for Linux/Unix/Windows
  5. Optimize the Usage of Swap to Speed up Response for Ubuntu

    Reader Comments

    Thank You Very Much , This Tips Was Useful For Me Keep Working :)

    [Reply]

    #1 
    Written By Saih Younes on October 21st, 2011 @ 12:01 pm

    Will not using synaptic do the same thing?

    [Reply]

    #2 
    Written By the old rang on December 7th, 2011 @ 3:48 pm

    Add a Comment

    required, use real name
    required, will not be published
    optional, your blog address