Linux – setting server hostname

hostnamelinuxUbuntuubuntu-10.04

I'm using ubuntu 10.04 on my server and I'm looking to set the hostname.

Looking around it seems I have to set this in the /etc/hostname file, but on my system I do not have one.

Typing hostname does return a value

Is there anywhere else this could be set?

Thanks

Best Answer

On Ubuntu server that is the correct location. You just need to add the hostname string only to the file, example:

echo my-ubuntu-server-name > /etc/hostname and reboot.