Re: Changing Hostname?
Hi
On Sat, Dec 21, 2013 at 01:45:11PM -0500, Jon N wrote:
> I recently installed Jessie on a new computer. Now that I have the
> system up and running I decided that I would like to have a different
> hostname than the rather unimaginative 'localhost-01' I picked during
> install. I used the "mate-network-admin" utility to change it, and
> checked /etc/hostname and saw that the change was reflected there
> also.
>
> Then I rebooted. The display manager wouldn't load, leaving me with
> an almost blank screen (there was a blinking cursor in the upper left
> corner). I switched to another virtual terminal, edited /etc/hostname
> back and was able to boot normally. Although when I just opened
> "mate-network-admin" again it still had the new name in there.
> Apparently mate-network-manager changes /etc/hostname, but changing
> /etc/hostname doesn't reverse it completely??? (I'm thinking I must
> have done something wrong, because that doesn't make sense).
>
> Anyway, the main question is, how do i change the hostname for my system?
>
> I did do some searching online, and so far I found that I have to change:
>
> /etc/hostname
> /etc/hosts
>
> then run the command
>
> sysctl kernel hostname=NEW_HOSTNAME.
>
> There were also directions on how to change config files for some
> specific packages. Am I missing anything?
In general, if you're changing host name, *ALL* references to the old
name should be tweaked.
I would recommend:
# sed --in-place=.bak -e 's/localhost-01/yournewname/g' $(grep -lr localhost-01 /etc)
(followed by a reboot to completely eradicate all memory of the old name).
Some packages, e.g. require additional attention here.
Hope this helps
--
Karl E. Jorgensen
Reply to: