CentOS have great documentation on how to use Kickstart files in order to achieve what you want.
I don't see the point in copy/pasting that entire page, so I'll just link to it: https://projects.centos.org/trac/livecd/wiki/KickstartFile
The kickstart file can include some basic system configuration items,
the package manifest and a script to be run at the end of the build
It falls under automated installations: http://www.centos.org/docs/5/html/5.1/Installation_Guide/ch-kickstart2.html
What are Kickstart Installations?
Many system administrators would prefer to use an automated
installation method to install Red Hat Enterprise Linux on their
machines. To answer this need, Red Hat created the kickstart
installation method. Using kickstart, a system administrator can
create a single file containing the answers to all the questions that
would normally be asked during a typical installation.
Kickstart files can be kept on a single server system and read by
individual computers during the installation. This installation method
can support the use of a single kickstart file to install Red Hat
Enterprise Linux on multiple machines, making it ideal for network and
Kickstart provides a way for users to automate a Red Hat Enterprise