How to set domainname in RHEL7.3 machine

5,299

Are you sure you want the domainname and not hostname or hostname -d? The domainname is used on hosts with NIS(YP).

If you want to set just the hostname in FQDN form, use following command:

hostnamectl set-hostname hostname.example.com

And yes, don't forget to put it into /etc/hosts.

Share:
5,299

Related videos on Youtube

Subodh Joshi
Author by

Subodh Joshi

A Developer from India . I convert caffeine into code. Trying to Select * from life; if (FAIL) { keepTrying(); } else{ keepTrying(); }

Updated on September 18, 2022

Comments

  • Subodh Joshi
    Subodh Joshi over 1 year

    I have to setup domainname right now when i am typing below command i am getting nonne

    [root@username ~]# domainname
    (none)
    

    But hostname command giving proper result

    [root@username ~]# hostname
    username
    

    I try to add below in vim /etc/hosts

    <Server IP> example.com
    

    but even this change wont help me.

    I am trying to resolve this issue

    https://stackoverflow.com/questions/47454271/olcrootpw-can-only-be-set-when-rootdn-is-under-suffix

  • Subodh Joshi
    Subodh Joshi over 6 years
    Thanks for your reply but hostname command already giving the result .
  • Jaroslav Kucera
    Jaroslav Kucera over 6 years
    And are you using NIS?
  • Subodh Joshi
    Subodh Joshi over 6 years
    Sorry but i am newbie in this what is NIS?
  • Jaroslav Kucera
    Jaroslav Kucera over 6 years
    That's the why I'm asking. domainname returns the NIS domain. The NIS is described here: en.wikipedia.org/wiki/Network_Information_Service
  • Subodh Joshi
    Subodh Joshi over 6 years
    FYI..this is a virual machine inside a organization but i raised this issue due to i am getting issue in the Ldap Configuration .