Commands to Configure hostname on CentOS 7 and RHEL 7
|
|
|
Comments (6)
On my Slackware boxes, I just put the hostname in /etc/HOSTNAME and /etc/hosts. No 'hostnamectl' nonsense here.
One more reason that I'm happy to keep my servers on CentOS 6, no hostnamectl nonsense there either.
> I just put the hostname in /etc/HOSTNAME and /etc/hosts.
Does that change the current name, or does it only take effect when the machine is rebooted? I was under the impression you had to use the hostname command to change the current name. But I've never had to change the hostname on a running machine, so I'm not certain.
Does that change the current name, or does it only take effect when the machine is rebooted? I was under the impression you had to use the hostname command to change the current name. But I've never had to change the hostname on a running machine, so I'm not certain.
@jdixon:
You are correct.
$man hostname
/etc/hostname Historically this file was supposed to only contain the hostname and not the full canonical FQDN. Nowadays most software is able to cope with a full FQDN here. This file is read at boot time by the system initialization scripts to set the hostname.
You are correct.
$man hostname
/etc/hostname Historically this file was supposed to only contain the hostname and not the full canonical FQDN. Nowadays most software is able to cope with a full FQDN here. This file is read at boot time by the system initialization scripts to set the hostname.
I just used hostnamectl to change that name 2 days ago and did not reboot. No problem until now. That doesn't seem a nonsense utility. Is it because it's a systemd tool ?
> just used hostnamectl to change that name 2 days ago and did not reboot.
You don't need to reboot if you use the hostname command either. It just that (for Slackware) if you only change /etc/HOSTNAME, it's only read on a reboot.
You don't need to reboot if you use the hostname command either. It just that (for Slackware) if you only change /etc/HOSTNAME, it's only read on a reboot.
Post a comment
A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.
Your message:Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help
Sign up and post (it is free) or Log in and post
