~couchNerd ~serialOutrager ~puts2In42 ~makesPigsFly

Ubuntu TIP: Automating Package Installation – apt-get to the rescue

Admin Note: Rahul is a long time friend of mine, and is a well known geek amongst his friends and colleagues. I’m happy to announce that he will be enriching this site from time-to-time as a guest editor/author. First up is a small tid-bit of a script that he wrote to ease up his life between installations and reinstallations of everyone’s favourite OS: Ubuntu. Over to his post..

Have you ever had to reinstall your ubuntu installation, and then bear the pain of manually installing the applications you’ve come to love (i mean use :)) everyday? If yes, then cheer up buddy, because all you really need is some magic (read scripting), some typing and spend some time digging the package names of your favourite applications.

To get started, you’ll need to type the package information in a configuration file. The format of the file is really simple

  • Any line starting with a # is ignored

  • Blank lines are ignored

  • Any other line, the first word is taken as the package name you want to install

chmod +x rapt-client-install-packages.sh
> > Run this script as root (or using sudo command)

> sudo ./rapt-client-install-packages.sh configFile
> > In case you do not specify the configFile (e.g. package-names.lst), it will bug you to manually enter packages names :D.

What this script does is

  1. read package names from the file specified (or bug user for package names in case filename is not specified)

  2. install these packages

That’s it. And if everything runs fine, you should have a system will all your beloved apps installed.

The below snippet from the sample configuration file would install the packages – hardinfo, gmountiso, devilspie and nautilus-open-terminal. The lines for sysinfo and istanbul would be ignored. In case you later wish to install these packages, all you need to do is uncomment the line, and run the script again :).

> #sysinfo = UNIX/Linux system information > hardinfo = UNIX/Linux hardware information > gmountiso = a PyGTK GUI to mount your cd images > #istanbul = Desktop session recorder > devilspie = find windows and perform actions on them > nautilus-open-terminal = nautilus plugin for opening terminals in arbitrary local paths >
> >


  1. The script will fail in case the package cannot be found using the repositories enabled on your system.

  2. In case you use additional repositories, you must add these manually to your apt configuration file, and do

sudo apt-get update
> >

  1. The hard part is not the installation, but setting up the applications to your likings :D