You are probably going to want to do this to make your initial exploit examples easier to work with and understand.
Turn off ASLR:
$ sudo echo 0 > /proc/sys/kernel/randomize_va_space
$ sudo sysctl -w kernel.randomize_va_space=0
Turn off NX (compile option to GCC)
Turn off stack smashing detection.
Turn off all other optimizations: