5

I have two computers on the same WIFI network at home. Both run on Ubuntu 12.04 and both will need to update to 12.10 shortly.

There are some applications that are installed on one but not on the other and vice versa. But they share a large many applications.

Please indicate how can I upgrade both in such a way that:

  • I download all the packages required on Computer 1
  • Move the downloaded packages to the other computer using external HD (that is much quicker than over WIFI)
  • Then upgrade Computer 1
  • Then upgrade Computer 2 -- after it downloads any packages that are not already available.

Also, I am a newbie and would be grateful if the process is simple and properly explained.

2 Answers 2

4

Upgrade the first computer normally, then copy all of the .deb files that it downloaded to an external drive:

cp -v /var/cache/apt/archives/*.deb /media/pendrive

Next copy all of the .deb file onto the same directory on the second computer:

sudo cp -v /media/pendrive/*.deb /var/cache/apt/archives/

Then upgrade the second computer. Of course, change /media/pendrive/ to the correct path for your deb backup device.

This way, the update will happen on the second computer but it will be able to re-use the .deb files that have already been downloaded without downloading them again. Both computers must be the same release - either 32 or 64 bit.

You can also use this technique to update both systems normally. Set one to update automatically if you wish, and the other one to not check for updates automatically. Periodically copy the updated .deb files to the second computer and run the update. If you keep this library of .deb files then you can also use it after installing a new machine to make the first update very quick - do not let the system do the updates during installation and instead do it manually after installation.

I actually use scripts to maintain the .deb file backups, restore them, and even copy them to a new system while it is being installed. Using cp with the -n switch it doesn't try to copy over items that are already there and is very easy to use and maintain. Here's the one I use to upload the .deb files to the pendrive. Note that the pendrive should have a volume name so that it's mountpoint is always /media/yourname - the script will accept the volume name as an argument eg

debupdate yourname

The script can also keep separate backups for different releases without getting confused - it stores the archives under /media/yourname/archives/kernel where kernel is the major release level (ignoring the -xx extensions). If you're worried about the .deb files being deleted you could run this several times during the update, or maybe automate it to do so.

Here's the script:

#! /bin/bash
#copy the contents of the working archives to the given device
#No files will be overwritten (existing will be skipped)
#
args=("$@")
rel="$(uname -r)"
release="${rel:0:6}"
#
# For releases with single digit third series, truncate the '-'
if [ "${rel:5:1}" == "-" ]; then
release="${rel:0:5}"
fi
##############
#
echo
echo "Kernel release level is "$release
#
#
#
if [ -z ${args[0]} ]; then
    echo "You must pass the volume name of target"
else    
    if [ ! -d "/media/${args[0]}" ]; then
     echo "Backup device ${args[0]} not found"
     exit 1
    else
     mkdir -p /media/${args[0]}/archives/$release/
     cp -nv /var/cache/apt/archives/*.deb /media/${args[0]}/archives/$release/
    fi
fi
2
  • Just one small question to confirm that we are not missing anything out. All the .deb files will remain in /var/cache/apt/archives EVEN AFTER the upgrade is complete, correct? There is no need to copy them BEFORE the actual upgrade takes place, correct?
    – deshmukh
    Oct 7, 2012 at 9:59
  • As far as I know, yes. I always do full installs however the .deb files should stay in the archives until a -clean or -autoclean operation is done by apt-get. Oct 7, 2012 at 10:40
0

I would look @ using apt-cache-server. See https://help.ubuntu.com/community/Apt-Cacher-Server for more details. You update the first box, and then update the second, it will use the cache on the first. avoids duplication of packages.

2
  • any advantages over the scheme suggested by @fabricator4? The biggest advantage there is I can move files using a pendrive --- much faster than over my wireless network
    – deshmukh
    Oct 11, 2012 at 12:20
  • The advantage is that it's probably a good permanent solution for long term use. The only time I've used a system like this was as a repository for use at an install fest. It saved us heaps of time updating new installs and installing software. That was a full repository though - GB's of data. This seems to be different in that it only caches packages that need to be installed at the time. Presumably it saves on duplicating packages across releases, which mine does not, and is more automated in operation. If I wasn't such a clutz at networking issues I'd try it immediately. Oct 11, 2012 at 14:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .