2

I am trying to set up HOSTNAME to a machine , but I am unable to find the HOSTNAME field in the /etc/sysconfig/network file

all I can see is this below

# Generated by anaconda
NETWORKING=yes
NTPSERVERARGS=iburst

Can anyone let me know how can I change the HOSTNAME in this scenario ?

1
  • Welcome on SuperUser user614762. Register yourself, so you can upvote the answer they give you (and choose as the one that you prefer)... Moreover you could really start to like and enjoy this site ;)
    – Hastur
    Commented Jul 8, 2016 at 8:06

1 Answer 1

3

There is a utility available in RHEL to permanently set the hostname:

sudo hostnamectl set-hostname newhostname

Alternatively on RHEL 7 you can simply edit (or create if needed) the file /etc/hostname and add the desired hostname as the only content in the file.

I believe the method you are using is only applicable to RHEL 6 and earlier. If that applies to you, then simply add a hostname field in the format below to that file and reboot:

HOSTNAME=newhostname

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .