DHCP to Static IP and hostname

For some reason whenever I install Ubuntu or a derivative it finds my DHCP server and automatically configures a DHCP client. This is great but usually not what I want so I end up going back and changing to a static IP. I’m sure if I did an advanced install, I could get these options at install time, but it is easy enough to change afterwards so I just do it then. However, I usually forget what files I need to edit to make the change. Luckily, there is a good post about Ubuntu Networking Configuration Using Command Line on Ubuntu Geek. For details, follow the above links, but in short you need to edit:

/etc/network/interfaces (for IP Address, Gateway, etc.)
/etc/resolv.conf (for DNS)

Also, you may have to change the hostname using the following command:

sudo /bin/hostname newname

After this you can restart networking using:

sudo /etc/init.d/networking restart

However, I prefer to just reboot to make sure the changes stick.