First make sure that the tcl8.4 and tcl8.4-dev packages are installed (# sudo apt-get install tcl8.4 tcl8.4-dev). The tcl8.4-dev package can later be removed.

# tar -xzf modules-3.2.6.tar.gz
# cd modules-3.2.6
# ./configure --with-tcl-lib=/usr/lib/tcl8.4 --prefix=/opt
# make
# sudo make install
# cd /opt/Modules
# sudo ln -s 3.2.6 default
# cd default
# sudo mv modulefiles modulefile_old
# sudo mkdir modulefiles

Now add "source /opt/Modules/default/init/bash" in your .bashrc or "source /opt/Modules/default/init/csh" in your .cshrc file. Also add "MANDATORY_MANPATH /opt/Modules/default/man" to /etc/manpath.config.

In the modulefiles directory you can now create subdirectories/files for various programs. For example if you have two versions of mpich installed (one configured with Intel and the other with GNU compilers) alongwith PetSc and ScaLAPACK (configured with mpich that is further configured with Intel compilers) then the content of your /opt/Modules/default/modulefiles can be as follows.

petsc/2.3.3
scalapack/1.8.0
mpich-gnu/4.1.2
mpich-intel/7.1
intel/7.1
gnu/4.1.2

Everything is now set. Simply source your .bashrc/.cshrc or relogin and test the installation by invoking Intel compilers:
# module load mpich-intel/7.1 (or simply "module load mpich-intel")

To unload a module use:
# module unload mpich-intel ("module purge all" unloads all loaded modules)

To switch from mpich-intel to mpich-gnu:
# module switch mpich-intel mpich-gnu

To invoke PetSc simply use:
# module load petsc (mpich-intel and intel modules will be invoked automatically)