Use apt-cacher to save on bandwidth on multiple PCs
https://www.zyxware.com/sites/default/files/styles/user_image/public/pictures/zyxlogo.png?itok=J9t-ZEoU
BY webmaster
11 years ago
Linux
6
comments comment

When you have more than one system with Ubuntu installed, and you have to install same or similar set of packages on all your PCs, you can save on a lot of bandwidth if you had some ways of sharing the downloaded packages and updates. There is an easy way to do this in Ubuntu. This is done using apt-cacher a proxy server for your package repositories. It is very easy to set up and configure apt-cacher on a PC with Ubuntu inside your LAN.

When fully installed and configured, apt-cacher runs as a server on your intranet and all the PCs in your LAN will query the apt-cacher for any kind of package requirements and apt-cacher will in turn get the package from its local cache, if the package was already downloaded in a previous request, or from the internet repositories if the package is a new package not already requested. The bandwidth savings are directly proportional to the number of PCs in the network running Ubuntu (or any other debian variant)

The following set of information will assume that you have a network of PCs with Ubuntu installed on them and that you have internet access from your network.

First select a computer with enough disk space and which you would like to set up as your local package repository. On this PC install apt-cacher
sudo apt-get install apt-cacher
This will install apt-cacher on the PC. Now the next task is to configure this. The configuration file is located at /etc/apt-cacher/apt-cacher.conf. Create a backup copy and open the file for editing
sudo cp /etc/apt-cacher/apt-cacher.conf /etc/apt-cacher/apt-cacher.conf.bak
sudo gedit /etc/apt-cacher/apt-cacher.conf

By default apt-cacher allows access from any IP address. But if you want to restrict access only to the PCs in the intranet (which is a safe option) set the allowed_hosts parameter to
allowed_hosts=192.168.1.0/24
There are two parameters 'group' and 'user' which sets the group and user for the apt-cacher application. If you comment these the application will run as the native user. In any case make sure that the application has write access to the cache directory set by the cache_dir parameter in the file. If you would like to keep all the packages downloaded you can set clean_cache parameter to 0 to prevent automatic deletion of unreferenced packages.

The last and the most important setting in the configuration file is the path_map parameter. This parameter maps the online repositories to local virtual repositories. These have to be given meaningful names so that the repository can be easily identified from the client machine in the intranet.
path_map = ubuntu archive.ubuntu.com/ubuntu; ubuntu-updates archive.ubuntu.com/ubuntu; ubuntu-security security.ubuntu.com/ubuntu; wine wine.budgetdedicated.com/apt; medibuntu packages.medibuntu.org;

If you want to add any other repository other than what is mentioned above you can very easily add it to the above parameter. For example if you want to add the skype repository which is at http://download.skype.com/linux/repos/debian you can append
skype download.skype.com/linux/repos/debian;
to the end of the above path_map parameter to do that.

Now edit /etc/default/apt-cacher and set AUTOSTART to 1 to enable apt-cacher to boot at system startup.
Restart apt-cacher by running
sudo /etc/init.d/apt-cacher restart
Test your apt-cacher installation by accessing
http://localhost:3142
in your browser. If apt-cacher is running you will see the report when you access this URL.

You can now use a Ubuntu CD/Ubuntu DVD and copy all the packages from the CD/DVD into the apt-cacher cache. Replace '/media/UbuntuCD' with whatever is the correct path where the CD or the DVD is mounted.
sudo /usr/share/apt-cacher/apt-cacher-import.pl /media/UbuntuCD

Once apt-cacher is configured on the local package repository machine it is time to update the sources.list on all the client machines in the intranet to use the local cache. On each PC create a copy of the original sources.list and edit the file to add the local repository.
sudo cp /etc/apt/source.list /etc/apt/sources.list.bak
sudo gedit /etc/apt/sources.list

Copy and paste the following code into sources.list and replace <YourLocalRepositoryMachineIP> with the IP address of the local package repository that you have configured

## Ubuntu Packages
deb http://[YourLocalRepositoryMachineIP]:3142/ubuntu/ gutsy main restricted multiverse universe
deb-src http://[YourLocalRepositoryMachineIP]:3142/ubuntu/ gutsy main restricted multiverse universe

## Ubuntu Major Bug fixes
deb http://[YourLocalRepositoryMachineIP]:3142/ubuntu-updates/ gutsy-updates main restricted multiverse universe
deb-src http://[YourLocalRepositoryMachineIP]:3142/ubuntu-updates/ gutsy-updates main restricted multiverse universe

## Ubuntu Backports
deb http://[YourLocalRepositoryMachineIP]:3142/ubuntu/ gutsy-backports main restricted universe multiverse
deb-src http://[YourLocalRepositoryMachineIP]:3142/ubuntu/ gutsy-backports main restricted universe multiverse

## Ubuntu Security
deb http://[YourLocalRepositoryMachineIP]:3142/ubuntu-security/ gutsy-security main restricted multiverse universe
deb-src http://[YourLocalRepositoryMachineIP]:3142/ubuntu-security/ gutsy-security main restricted multiverse universe

## Other Repositories
deb http://[YourLocalRepositoryMachineIP]:3142/wine gutsy main
deb http://[YourLocalRepositoryMachineIP]:3142/medibuntu gutsy free non-free

Test the apt-cacher setup by running
sudo apt-get update
on the client machine where the sources.list have been updated. If everything is fine copy the modified sources.list to all the client machines in the intranet which has Ubuntu on them.

If you have any problems in setting this up, please use the comment form given below to submit your questions and we will try to help you in whatever way we can.


RELATED ARTICLE

more_horiz
close

on 30th March 2007 / by webmaster
Ever since we started our pc sales and services division we have been trying to get a system with Hardware Linux Leave a reply Your email address will not be published. Required fields are marker * Cherry (not verified) access_time 18 Aug 2019 - 14:41 Is that true ? Are there many people who still use modems to dialup internet ? I was thinking of helping out with some limited internal modem support for NetBSD, but wasn’t sure what the user base is like. Anoop John (not verified) access_time 18 Aug 2019 - 14:41 Yes I have come across quite a few customers who still use dialup as the only means of accessing net. For people who just use internet to check mail, dialup is the cheapest way to go. shankar (not verified) access_time 18 Aug 2019 - 14:41 I have read your above article. I have the same problem. I want to use the new Bharatiya Operating System Solution (BOSS) which is linux based. My dial up modem of D-Link is not detected in linux/BOSS neither I can get a driver for linux. D-Link company have informed that they do not have any modem supporting linux. Please inform whether you can send it by post, cost and methods available for payment. regards, shankar Pagination Current page 1 Page 2 Page 3 Page 4 Next page Next › Last page Last » Add new comment
more_horiz
close

on 04th April 2007 / by webmaster
Linux is the epitome of the FLOSS model. Linux Leave a reply Your email address will not be published. Required fields are marker * Dewey J. Corl (not verified) access_time 18 Aug 2019 - 18:49 Linux is not ready for the general public! (I am a Ubuntu user). For proof, 1. try to simply print labels on a Dymo label printer. It takes a LOT of work to get to the ease of label printing already available in Windows and Mac. 2. try syncing a modern Palm based PDA. Yes, jpilot and others will sync the main data, but pictures and midi files do not get transferred without a lot of extra setup. These are examples of applications that are not ready for the general public. Since an operating system only supports applications, Linux is not ready to be a common desktop for the general public. While we are waiting for the applications to catch up, keep up the good work!! Anoop John (not verified) access_time 18 Aug 2019 - 18:49 Dewey Yes you may be right. But these are not applications that a common man would use. A common man would use one of these applications - Internet browser, Chat Client, Email Client, Document Writer, Presentation Creator, Spreadsheet Editor, Movie Viewer, Music Player, CD/DVD Writer. Both examples you cited are more specific applications that only a small percentage of the whole population uses. It will take time before those hardware vendors identify the need from their perspective to address the Linux community. Krishnadas (not verified) access_time 18 Aug 2019 - 18:49 Dear Mr Anoop, Thank you very much for the free installation of LINUX done in my PC. I am getting immersed in the LINUX and seeing the versatility. To my surprise, I am able to read one of my old backup CD(wherein lot of my valuable file exist) done in DIRECT CD wizard (a custom cd writing software of Easy Cd creator in WIN98) which could not be read in XP. Installation of old version of easycd creator/direct cd program was not possible in XP. I thought that possible i lost all data. Very pleasant start! Srikanth N. S. (not verified) access_time 18 Aug 2019 - 18:49 Hi Anoop, My friend is thrilled with Ubuntu. One of his grouses with windows was that after OS installation, everything else is to be installed separately which is a real headache. WHereas if u install Linux, everything is installed as a package and he is thrilled to bits! Let linux installation spread in Trivandrum and your service in this direction is highly appreciated. Kepp up the good work Regards. PDA Freak (not verified) access_time 18 Aug 2019 - 18:49 Is it possible to install linux on a packardbell notebook ? Add new comment
more_horiz
close

on 20th April 2007 / by webmaster
Linux has been growing in leaps and bounds in terms of internationalization. Linux Malayalam Open Source Ubuntu Leave a reply Your email address will not be published. Required fields are marker * Ranjith Antony (not verified) access_time 18 Aug 2019 - 14:35 Everything is fine an dandy. However, to read those websites which doesn't support unicode fonts you have to install padma firefox extension . Those websites include all malayalam newspaper websites including, deepika, manorama, keralakaumudi etc. These websites only support truetype fonts. TrueTypes are glyphs matching a malayalam character but doesn't have a hex code assigned to it. They use ASCII character set but with a different glyph. Just to read malayalam, you only need to perform the first 3 steps in Peringodan's blog, in addition to the hacks thats been explained in this blog post. PS: Its so funny; a tutorial to explain how to install malayalam read and write support is written in malayalam. Thats what called a chicken and egg problem. Cherry (not verified) access_time 18 Aug 2019 - 14:35 I’d like to point out a couple of things: a) Malayalam support is not an Ubuntu thing or a Linux thing… I am running NetBSD -current on my laptop with x.org and I can type malayalam. Learning the key combinations is very easy and intuitive… it just requires attention and commitment. I learnt it in about a week and something. b) Mangleesh support for TeX has been around for a while. The TuX group in Trivandrum and specifically A.J.Alex have worked on very good quality latex support for malayalam. See: sarovar.org Just to set the record. Cheers, Cherry. vimal access_time 18 Aug 2019 - 14:35 Ready to use packages to support malayalam in Ubuntu 7.10 and Debian GNU/Linux Etch is available at http://malaylam.web4all.in . Pagination Current page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 &hellip; Next page Next › Last page Last » Add new comment
Leave a reply
Your email address will not be published. Required fields are marker *

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
The content of this field is kept private and will not be shown publicly.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

author-image
Sameer G (not verified)
access_time 18 Aug 2019 - 20:06

Hi,

This seems to be very promising.... Would save me a lot of headache :). What i am wondering though is whether apt-cacher supports multiple versions. I have a few machines running gutsy and while others run feisty. Are there any special configurations to support multiple versions???


author-image

Yes. You can use one installation of apt-cacher for all the releases of Ubuntu. In our office we have releases from 6.06 to 8.04 running smoothly on one apt-cacher. When you set the configuration in the apt-cacher just remember to not use the release names as part of the urls. You can just pass them via the deb line in the sources.list. For example in the apt-cacher.conf set the path map as
archives.ubuntu.com ubuntu; security.ubuntu.com ubuntu-security
and then in the sources.list set of a hardy machine
deb http://192.168.1.10/ubuntu hardy main restricted universe
deb http://192.168.1.10/ubuntu-security hardy main restricted universe
while for a gutsy machine you can use
deb http://192.168.1.10/ubuntu gutsy main restricted universe
deb http://192.168.1.10/ubuntu-security gutsy main restricted universe
Cheers
Anoop John
Team Zyxware


author-image
Stewart (not verified)
access_time 18 Aug 2019 - 20:06

Hi,
Does the following (from your description) actually work:-
sudo /usr/share/apt-cacher/apt-cacher-import.pl /media/UbuntuCD

From my understanding, is apt-cacher-import.pl is non-recursive, so will find nothing with your example (as there are no DEBs in the route of CD.
Also I did a find ./ -name '*.deb' on an ubuntu ISO and found very few debs, the rest I think are compressed into *.gz ??

I have been unable to import a CD into apt-cacher.
Stewart


author-image
Tom Kent (not verified)
access_time 18 Aug 2019 - 20:06

To get the files off the CD, you actually need to recurse into sub-directories, since the .deb files aren't in the root, use the "-R" option. (Also, I just make a copy of them, so the script won't try doing any links to a CD that may go away, use the "-r" option).

Here's how my line looks:
sudo /usr/share/apt-cacher/apt-cacher-import.pl -R -r /media/UbuntuCD

If you have the CD image, and don't want to burn it, you can also mount the CD first:
sudo mount -o loop /home/ubuntu-9.10-rc-alternate-i386.iso

Tom


author-image
Salvia (not verified)
access_time 18 Aug 2019 - 20:06

Does is work with Windows? Because I only have windows and that would be of great help. I'm not talking about windows at my house but the one of the computers.