If you’ve gotten this error: hostname: Name or service not known when typing hostname -f, then here is a solution. I got this error while trying to install Plesk.
I couldn’t find a single clear response, most people spent their time showing how smart they are by explaining how host names work, and what it means to linux, who cares. This is how I fixed the problem, maybe it will help you:
This is on Ubuntu 10.4, don’t know how will this will transfer over to other distros, but I don’t imagine it will be much different.
$ nano /etc/hosts
Add this, replacing mysite with your actual site/domain
127.0.0.1 mysite.com mysite
$ echo "mysite" > /etc/hostname
$ hostname -F /etc/hostname
$ domainname -F /etc/hostname