linux setting a server to static ip and server name
Static IP
This is how to set up a static IP in Ubuntu if I recall correctly, it should also work in Debian and likely other Debian based distros:
You need to edit the network interfaces file located at /etc/network/interfaces, e.g.
nano /etc/network/interfaces
You should see a line like
iface eth0 inet dhcp
Comment this out with # and instead add:
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
EDIT: Explanation of network parameters
Address - Just the IP address of the server, this can be whatever you want as long as it's in the right subnet and not already used on your network
Netmask - This affects just what addresses you can use, for a home network this is almost certainly 255.255.255.0
Network - the address of the entire network, this is the first address in your subnet and will be the same first three sections as address and end with 0 on a typical home configuration
Broadcast - this one is the last address in the subnet, usually has the same first three sections as the address and ends with a 255 on a typical home network
Gateway - the address of the route, on a typical home network this is usually the second on the subnet (e.g. 192.168.0.1 or 192.168.1.1)
Alter with your own network parameters if they differ. Now, for DNS, edit /etc/resolv.conf and add a nameserver, e.g.:
nameserver 8.8.8.8
You might be able to change the nameservers in the interfaces as well, but I can't remember for sure.
After you've done this, you'll need to restart the networking service:
/etc/init.d/networking restart
Setting a Host on Your Local Machine to Access a Dev Web Address
This is the easiest way to access your dev server at an address, but it'll only work for the machines you specifically set it for. I hope that's okay. You just need to edit the /etc/hosts file. Like so:
192.168.0.10 mytestserver.test
Replace the IP address with the one for your server if different.
If you're on Windows the hosts file is at C:\windows\system32\drivers\etc. I think the syntax is the same.