By default, the Ubuntu installer has configured our system to get its IP address and other network settings via DHCP. This is not what we want so we have to change the server to have a static IP address. Edit /etc/network/interfaces and adjust it per your requirements. For this example we are using an IP address of 192.168.167.210 for this server.
Now, there are a myriad of examples on the web and I am including a few links to them for convenience sake in case they explain this better. (they probably do) ;o)
vi /etc/network/interfaces
# This file describes the network interfaces available on your system |
Now, restart your network:
/etc/init.d/networking restart
Then edit /etc/hosts. We are telling the server what names it is going to answer to and to which IP addresses those names belong. This is somewhat analogous to the Windows hosts file if you are familiar with Windows:
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost |
Now execute the following commands.
hostname
hostname -f
The results from both commands should show server1.example.com. If they do not, reboot the system:
shutdown -r now
Log back into your server and try the hostname commands again.
hostname
hostname -f
Now for those links I promised:
Link 1 on cyberciti.biz
Link 2 on howtogeek.com
Link 3 on howtoforge.com
Blessings