EDIT: Credit to Viceroy
https://bitcointalk.org/index.php?action=profile;u=34771 for building a better script on a more stable OS.
Please use his guide for CentOs if your not already stuck on Ubuntu:
https://bitcointalk.org/index.php?topic=170516.0END EDIT.
I use this to deploy new miners to SSD's let me know if it helps anyone:
This is designed to be executed in blocks, each set of commands is between ######### and #######. This assumes your username or at least homedir is miner and that you have setup networking correctly. This is also using Ubuntu 12.04.2 Server as that's what I have lying around. You could save time by installing xubuntu off the bat.
#CGMiner
#Install server 12.04
#configure networking for static IP and DNS
#user miner
######################
sudo -s
######################
apt-get -y remove --purge nvidia-common nvidia-current nvidia-opencl-dev nvidia-settings
apt-get -y update
apt-get -y upgrade
apt-get -y install xubuntu-desktop
reboot
######################
sudo -s
######################
apt-get -y install build-essential git-core unzip cmake automake libncurses5-dev autoconf libcurl4-openssl-dev pkg-config automake yasm
apt-get -y autoremove
exit
#####################
#I store these and transfer with SCP, you'll have to download them.
#DOWNLOAD ADL: ADL_SDK_5.0.zip
#DOWNLOAD AMD-APP-SDK AMD-APP-SDK-v2.8-lnx64.tgz
#CREDIT: http://rdmsnippets.com/2013/03/20/bitcoin-mining-with-ubuntu-12-04-tls-and-cgminer/
#APP http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/#one
#http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/downloads/#one
######################
cd
git clone git://github.com/ckolivas/cgminer.git cgminer
mkdir ADL_SDK
cd ADL_SDK
cp ~/ADL_SDK_5.0.zip .
unzip -o ADL_SDK_5.0.zip
cp include/* ~/cgminer/ADL_SDK
###################
sudo -s
###################
cd /opt
tar xf /home/miner/AMD-APP-SDK-v2.8-lnx64.tgz
cd /opt/
./Install-AMD-APP.sh
ldconfig
reboot
###################
sudo -s
###################
#Choose your standard, experimental, etc drivers
#apt-cache search fglrx will give a list
apt-get install fglrx
#Set machine to autologin to xserver
cat > /etc/lightdm/lightdm.conf << EOF
[SeatDefaults]
autologin-user=miner
autologin-user-timeout=0
user-session=xubuntu
greeter-session=lightdm-gtk-greeter
EOF
# You can use the newest AMD non-ubuntu packaged drivers as well
#http://support.amd.com/us/gpudownload/linux/Pages/radeon_linux.aspx
#wget http://www2.ati.com/drivers/linux/amd-catalyst-13.4-linux-x86.x86_64.zip
#unzip -o amd-catalyst-13.4-linux-x86.x86_64.zip
#sh amd-catalyst-13.4-linux-x86.x86_64.run
aticonfig --adapter=all -f --initial
reboot
######################
export DISPLAY=:0
aticonfig --list-adapters
######################
#STOP HERE
#If you do not have adapters listed, you broke something.
######################
cd ~/cgminer
git pull
make clean
./autogen.sh
CFLAGS="-O2 -Wall -march=native -I /opt/AMDAPP/include/" LDFLAGS="-L/opt/AMDAPP/lib/x86_64" ./configure --enable-scrypt
make
###################
#TEST YOUR CGMINER BUILD
export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
export GPU_MAX_HEAP_SIZE=100
/home/miner/cgminer/cgminer -n
#If this doesn't spit out your device ID's something is wrong.
###################
sudo -s
###################
#Disable the screensaver
sed 's/LOCK_SCREEN=true/LOCK_SCREEN=false/g' -i /etc/default/acpi-support
###################
#Generate a Base Config FIle
cat > mine.sh << EOF
API="--api-port 4028 --api-listen --api-allow 0/0"
POOL="-o #YOURPOOL -u YOURUSER -p YOURWORKERPASS"
GENERAL="--scrypt --no-submit-stale"
CARD="--auto-fan --temp-target 82"
WORK="--worksize 256 -I 13"
export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
cd /home/miner/cgminer/
screen -S miner /home/miner/cgminer/cgminer $API $POOL $GENERAL $CARD $WORK
EOF
chmod +x mine.sh
###################
#To run Miner
#./mine.sh
#To reconnect to miner
#screen -x miner
#To tweak hasrate: It's good to keep a spreadsheet of values and hashrates,
#GPU's are like diamonds, they each have their own unique flaws,
#Literally, silicone chips each perform different
#If you have 2,4,6,128 of the same GPU,
#It is good to run through tuning on each one independendently.
#Step 1
#Start running config, after running, grab the TC numbers from the xxxxx.bin file in the cgminer directory.
#Insert that to config file under work --thread-concurrency
#Start increasing and decreasing TC by a few thousand at a time,
#Find the highest hashrate
#Step 2
#set --gpu-memclock to the default card memory setting +25
#continue running and increasing memclock until you crash, then go by 5mhz
#continue till crash then go by 1mhz
#run with the final number for 10-30 minutes.
#don't worry if the hashrate goes down, just find the max memclock
#Step 3
#add --gpu-engine set it to half the memory speed from above
#add 5Mhz - 100Mhz to engine speed until hashrate drops
#once it drops begin subtracting 1mhz - 5Mhz until you find the max hashrate
#Step 4
#Run through worksize 64,128,256 to see which gives the best hashrate
#Step 5
#Increase -I from 13 to 20 in incriments of one to find the best hasrate
#Step 6
#Profit.