I recently purchased a VPS from OVH with Centos 7 preinstalled. I want to make sure my hostname is correctly set.

According to some tutorials:

hostname returns the hostname
hostname -f returns the FQDN

After executing these commands, I got the same result: vpsxxxxxxxx.ovh.net I thought hostname and FQDN are different!

cat /etc/hosts - localhost
IP - vpsxxxxxxxx.ovh.net - vpsxxxxxxxx

I am confused, I have linked a domain name that I have purchased separately to my VPS, I am also planning to add another domain name to run two sites in my VPS.

Is my hostname correct?
How can we call vpsxxxxxxxx.ovh.net? An external domain name, an internal domain, a hostname, a subdomain of ovh.net?
What about the two domains names that I have linked to the VPS? Do they need some configurations in /etc/hosts?

I have to fix these issues to enable postfix mail server.

1 Answer 1


The hostname should always be set to the FQDN in CentOS 7, according to Red Hat's recommendations.

A host name can be a free-form string up to 64 characters in length. However, Red Hat recommends that both static and transient names match the fully-qualified domain name (FQDN) used for the machine in DNS, such as host.example.com. It is also recommended that the static and transient names consists only of 7 bit ASCII lower-case characters, no spaces or dots, and limits itself to the format allowed for DNS domain name labels, even though this is not a strict requirement. Older specifications do not permit the underscore, and so their use is not recommended.

If you're running email on the server, then the hostname should be set to one in a domain that you control, rather than one controlled by your service provider. You do not need to place it in /etc/hosts, provided that the appropriate DNS entries exist for the name.

  • Thank you for your answer, it's also interesting you mentioned something new for me, I mean transient/static hostnames, however I couldn't grasp everything, servers administration is a new domain for me. Could you please show me, what do I have to modify and where if my new domain name is exemple.com.
    – AFA Med
    Jan 15, 2016 at 16:34
  • 1
    Read the next sections of the linked documentation. Jan 15, 2016 at 16:36
  • Finally I executed > hostnamectl set-hostname random.domain-name.com, I am not sure if I had to add the leading part before first point.
    – AFA Med
    Jan 15, 2016 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.