If you are trying to run many linux machines at a time it can become difficult to keep them in sync. One solution that many use is to mirror the repository(s) to a local network to save on internet bandwidth. While this is a solution it does require a lot of setting up, uses a lot of valuable space, takes a lot of time for the initial download and requires you to store programs that your machines will probably never use. There is a lot quicker way that only requires you to store what you use, uses less hard disk space and reduces the internet load. It involves using NFS to share the apt cache among your linux machines. Here's how to set it up. Setting up NFS is quite simple and is just a matter of "apt-get install nfs-kernel-server" on the machine that will serve the apt cache. Then in the "/etc/exports" file just add the line "/directory/of/apt/cache 192.168.1.0/24(rw,no_root_squash)". The directory can be anywhere, eg. "/opt/cache" and for an initial setup you can copy the contents of "/var/cache/apt" to it. The ip address is your local network and the options ensure that the mount is writable and root can use it. That's all that is required to set up the server. To make sure you can connect from a client check the "/etc/default/portmap" file to ensure that the 'OPTIONS="-i 127.0.0.1"' line is commented out. Then restart the portmap and nfs-kernel-server service. On the client side it is just as simple. First make sure you have a "/var/cache/apt" directory. Then to test the NFS service works you can try "mount -o rsize=8192,wsize=8192,hard 192.168.1.2:/directory/of/apt/cache /var/cache/apt". It should mount and you can then run whatever program you wish to update and add programs. Once you are satisfied with it you can then put the mount command into the "/etc/fstab" file so it mounts at boot. The ip address is of course the address of the serving machine. The options are to increase the size of the read and write buffers for faster performance. What this does is allow already downloaded programs to be used from the cache and any new ones added to the cache so other machines don't have to download them. This means that only the used programs are downloaded and they are only downloaded once. It is a lot simpler than a mirrored repository and a lot less load on the serving machine as you don't have to run a web server as well so it suites older hardware and doesn't need a lot of CPU power or memory. The server machine doesn't even need to be a Debian based machine either. Any operating system that can run as an NFS server will suffice. I have even had a similar method working for yum repositories as well.

Some name

I've always been fascinated with graphics and wrote my first drawing program on the venerable apple ][e. After discovering the x86 IBM clones and wrangling my way into the computer industry I'm now immersed in work as a Computer Engineer, System Administrator, OS builder (Linux from Scratch and Android) and general techno-head.

"Very interesting. I have a very similar situation. I clone drives to make new systems. The updates get behind on the master. So to save download time I copy the /var/apt/cache/archive/*.* (without the ""lock"" file) to a hard drive connected via the usb. I use midnight commander. Then on each new system I just copy back and then do updates.
Locutus If I do it by this network method I am wondering If the client will still update properly after it is disconnected from my network and sent back to my customer. Will I have to remove the
""mount -o rsize=8192,wsize=8192,hard 192.168.1.2:/directory/of/apt/cache /var/cache/apt""
from the fstab file?
frnz: Thanks ... I now have a ""how to"" folder also .... I am so forgetful!

"Or, you can use apt-proxy which does pretty much the same plus configurable cache cleaing of old version and unsed packages, plus the ability to import contents of local apt cache into the apt-proxy, plus probably other things.

Having web server is not required, just a simple entry in client's /etc/apt/sources.list:
deb http://192.168.1.2:9999/debian/ etch main contrib non-free !***!
Click here to go to this entry !***!"

Sorry! Something went wrong on our end. Please try again later.

thewizardalbany

October 03, 2007 06:47 PM

"My, My, Oh My!

Payton and Locutus agree on something!
It is a good world really isn't it?