Prefetching Ubuntu packages for offline install

Sometimes you can’t just provide an internet connection for every system that needs one, i.e. the VMs in the lab are all configured with “standalone” networking for the moment, as I can’t just launch a few “extra” DHCP servers on the production lan. I’m already thinking about fun ways to connect them, the current favorite is having GRE tunnels attached to the linux bridges in the KVM hosts. But I can’t just drift off and play networking while the storage layer is still down!

Edit: Just found out XCP / XenServer went the same way after they introduced OpenVSwitch: . Kinda lame though, I’d have figured with a whole company as backing they could’ve looked into MPLS or Is-Is instead. This is not just my nerdiness speaking – MPLS would be extremely sensible if you consider Cisco also looked into that direction. Implementing “the” distributed switch over GRE tunnels when the largest Vendors are moving to flat L3 networking for the datacenter is… innovative? not so much!

I now had to find a sane way to download all packages and dependencies for opennebula (for the cloud controller) and glusterfs (for the storage server vm’s) to a directory. Didn’t work on my laptop or the other KVM host as, well, some of the stuff was already installed and apt-get won’t do anything in that situation.

It’s sorted, here you go:

I now fired up another VM with minimal Ubuntu install gave it internet connection with NAT and downloaded from there using the following command:

export PKGS=”opennebula-common opennebula opennebula-node glusterfs-server”

wget $( apt-get –print-uris –yes install $PKGS | grep ^\’ | cut -f2 -d \; )

actually, I’ll beautified them for you a little bit. 🙂 I found the original command in some forum post that also pointed at Keryx, which I only tried for a second. I didn’t have the http_proxy url exported and found it try to download forever, cancelling did not work, nothing did.

kill -9 did work well and TBH software that can’t abort it’s own tasks will never get a second chance.

One last warning, dpkg is not a package manager, so if you break dependencies using dpkg then apt won’t easily be able to fix them for you. So if you’re able to provision internet access, then do that instead and use apt. Otherwise, know what you’re doing and/or have a blog where you can vent off about it 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s