I found this tip on the Ubuntu Forums and think it’s worth sharing.
Open up the file /etc/hosts with root privileges, e.g. by typing
sudo gedit /etc/hosts
The file will look like this (instead of hostname it will include your host name):
127.0.0.1 localhost
127.0.1.1 hostname
Now add you host name to the first line [...]