[CentOS] Really changing the hostname

Thu Feb 14 18:26:35 UTC 2013
Mike Burger <mburger at bubbanfriends.org>

> On Thu, Feb 14, 2013 at 12:15 PM, Digimer <lists at alteeve.ca> wrote:
>> On 02/14/2013 01:13 PM, Digimer wrote:
>>> On 02/14/2013 01:11 PM, Robert Moskowitz wrote:
>>>> I need to change the host name on a test server, and in the past when
>>>> I
>>>> used hostname to change the hostname, it did not seem to change it
>>>> everywhere.
>>>>
>>>> I really don't want to do a rebuild just yet, but I have to feel
>>>> confident that hostname is really changed (reboot is not too much of
>>>> an
>>>> issue).
>>>>
>>>> What is the recommened practice?  Other than get it right the first
>>>> time.
>>>
>>> To make the change permanent, edit /etc/ssyconfig/network and set the
>>> desired hostname after HOSTNAME=.
>>>
>>
>> Sorry, I typo'd that;
>>
>> # cat /etc/sysconfig/network
>> NETWORKING=yes
>> HOSTNAME=<your.new.hostname>
>
>
> This will get picked up on the next reboot.  You will have to use the
> hostname command to make it take effect immediately, but some
> applications only pick it up when they start so things like your login
> prompt won't change until the next login.

One could also run "service network restart" to have it take a more
immediate effect.

The disconnect from the network is momentarily, and one's session isn't
even severed.