Setting Static IP in Ubuntu Server 12.04.1

from the command line as root or su

nano /etc/network/interfaces

iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8

First change your adapter from dhcp to static.
Enter the information as above with your ip address settings.
crtl-x in nano and overwrite interfaces file.

restart networking with this command. (if over ssh make sure to adjust your ssh connection to the new ip address)

/etc/init.d/networking restart