To add static IP address to your server first you need to log into your server with root privileges. By default Ubuntu server sets the interface to use DHCP. To assign a static IP you need to edit
# /etc/network/interfaces
Here you will find here something like this:
auto eth0 iface eth0 inet dhcp
Edit that file accordingly and replace with your own IP configuration. (If you don’t know your own ISP’s DNS servers you can use Google’s DNS):
auto eth0 iface eth0 inet static address 192.168.10.10 netmask 255.255.255.0 gateway 192.168.10.1 dns-nameservers 8.8.8.8 8.8.4.4
Save and exit:
:wq
Reload (start and stop) network:
# sudo ifdown eth0 && sudo ifup eth0