Linux tuts

Debian package management speed ups

debian logo
Debian is a Linux distro that’s used by millions of machines all over the planet.

No one likes to sit around waiting for slow mirrors while updating multiple packages but its a fact of life usually. In debian it means typing apt-get update and sitting around for a while, then doing the actual install or upgrade and getting some coffee. what if you could speed the process along somewhat? well now just like we showed you how to speed up apt downloads for ubuntu you can speed up the apt speeds for Debian! This way you can focus more on clashing some clans or something…. whatever you do in your free time that is.


In comes httpredir, “It uses the geographic and network location of the user and the mirrors, the architecture of the requested files, IP address family, the availability and freshness of the mirrors, and a few other things” to find the closest and fastest mirror of data for you. This gives you the quickest way to get your files without resorting to new tools or alternate package managers. This is already there for Jessie ( debian 8 ) so no need to edit that, but for everyone else on older releases this will bring wonderful speedups.

setting up httpredir is simple :

edit your /etc/apt/soucres.list

deb sid main
deb-src sid main

replace with

deb sid main
deb-src sid main

Sample apt.sources file with

Remove the us. part if you arent on a US server.

change the word precise to whatever your version of ubuntu is.



deb mirror:// precise main restricted universe multiverse
deb mirror:// precise-updates main restricted universe multiverse
deb mirror:// precise-backports main restricted universe multiverse
deb mirror:// precise-security main restricted universe multiverse

deb precise main restricted
deb-src precise main restricted
deb precise-updates main restricted
deb-src precise-updates main restricted
deb precise universe
deb-src precise universe
deb precise-updates universe
deb-src precise-updates universe
deb precise multiverse
deb-src precise multiverse
deb precise-updates multiverse

deb precise-security main restricted universe multiverse
deb-src precise-security main restricted universe multiverse

deb precise partner
deb-src precise partner
deb precise main
deb-src precise main


General Linux shell

Aptitude installed package list

Today I got a new VPS… well great but now I need to install a bunch of new packages and libraries and helper apps. how do I remember it all? did I have python 2.6 or 2.7? not to mention which boost libs did I install? well here.s a couple of ways to deal with this issue of whats on my installed package list.

Using dkpg and apt-get

dpkg –get-selections > selections.txt

Scp / email / copy to USB or copy it bit by bit, whatever floats your boat. Move to new machine.

dpkg –set-selections < selections.txt
apt-get update
apt-get upgrade

voilà it should be ok. but there’s a lot of clutter, like libraries and dependencies that were needed on old machine and might not be needed again. so how to find a cleaned up list? or alteast one that shows the automated installed? there’s always aptitude Smile its simpler in syntax and better imho

Using Aptitude

aptitude search '~i'

which gives you aresult of all your packages like :

i   udev                                                                                               – /dev/ and hotplug management daemon
i A unattended-upgrades                                                                                – automatic installation of security upgrades
i   upstart                                                                                            – event-based init daemon
i A usbutils                                                                                           – Linux USB utilities
i   util-linux                                                                                         – Miscellaneous system utilities
i   vim                                                                                                – Vi IMproved – enhanced vi editor
i   vim-common                                                                                         – Vi IMproved – Common files
i   vim-runtime                                                                                        – Vi IMproved – Runtime files
i   wget                                                                                               – retrieves files from the web

This of course scrolls all the packages past your view very quickly and can be …. hard on those of us that cant read 10000 words per minute. You can always output the results to a text file, note in my example I’m using the date command to insert current date and time into the file name, you can run this with a cron job to have a snapshot of your packages at a given time.

aptitude search '~i' > installed_packages_$(date +%F_%R).txt

Or if you just want a temp text file you can output to less or vim the same way.

aptitude search '~i' | less
aptitude search '~i' | vim

and if you want you can even grep / search / parse it on the fly like so

aptitude search '~i' | grep -i "X11"

i A libxpm4                         – X11 pixmap library
i A libxrandr2                      – X11 RandR extension library
i A libxss1                         – X11 Screen Saver extension library
i A libxt6                          – X11 toolkit intrinsics library
i A libxtst6                        – X11 Testing — Record extension library
i A libxv1                          – X11 Video extension library
i A libxxf86dga1                    – X11 Direct Graphics Access extension libra
i A libxxf86vm1                     – X11 XFree86 video mode extension library
i A tk                              – Toolkit for Tcl and X11 (default version)
i A tk8.6                           – Tk toolkit for Tcl and X11 v8.6 – windowin
i A x11-common                      – X Window System (X.Org) infrastructure
i A x11-utils                       – X11 utilities

questions? comments? don’t hesitate to ask!