How can 'programatically' configure my site?
So You Want to Build a Drupal Distro 

Take a look at Packaging a distribution on Drupal.org

Here are the steps:


Assemble the pre-requisites
Create a Drush Make file
Convert to a Drupal.org-specific Drush Make file
Build and verify it works
Commit your code to Git
Release your code on Drupal.org
Maintain your distribution


Another great tutorial How to Write a Drupal 7 Installation Profile

Also there is Profiler Builder module.


  Profiler Builder is a module for automating the creation of
  installation profiles and distributions. It has support for the
  Profiler installation profile simplifier library but is able to run
  independent of it (1.0-RC4+). This module creates a downloadable tar
  package that gives you a well made installation profile and associated
  drush make file based on the site its installed on.