My answer is a slightly wider scope than the original question, but if you want to do this repeatedly, from scratch, across multiple machines you are setting up then I'd recommend spending the time looking into pxeboot. (I'm assuming you are a debian derivative mentioning aptitude). The learning curve is steep, the documentation a bit patchy but worth persisting if you need it.
If you have to do machines like this on a semi regular basis it's a no brainer. We have machines build from blank to fully configured in around 8 minutes with a ton of custom packages, auto installed.
For bonus points, look into some sort of apt caching mechanism as well.
A perfectly good setup is to make a build server / apt cache out of a virtual machine image to avoid polluting an existing machine