1. Login to your Ubuntu Server and check your networking

ifconfig
eth0 Link encap:Ethernet         HWaddr 00:0c:29:7c:05:22 
     inet addr:192.168.1.123     Bcast:192.168.1.255  Mask:255.255.255.0
     inet6 addr: fe80::20c:29ff:fe7c:522/64 Scope:Link

2. Edit the network config file »interfaces«

sudo nano /etc/network/interfaces

3. You will see these two lines

auto eth0 
iface eth0 inet static

4. Change the lines to this configuration (don't mind the comments)

auto eth0 
iface eth0 inet static            #dynamic is changed to static
address 192.168.1.100            #your custom local IP
netmask 255.255.255.0             #same as on ifconfig Mask
gateway 192.168.1.1               #default local network IP
broadcast 192.168.1.255           #same as on ifconfig Bcast
dns-nameservers 8.8.8.8 8.8.4.4   #Google's DNS servers

5. Save the file and restart networking

sudo /etc/init.d/networking restart

6. Check your local static IP

ifconfig
eth0 Link encap:Ethernet          HWaddr 00:0c:29:7c:05:22 
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7c:522/64 Scope:Link

7. Important: if you're doing this on virtual machine (VirtualBox, VMware), you may have to reboot

sudo reboot