0

Set Static Hostname in Fedora 18

This is always a quirky challenge when it comes to Linux.  The hostname command is used to display and set the hostname… sort of.  As you probably know (if you're reading this), typically this command only temporarily sets the hostname and once you reboot, it's gone.

On most systems this involves editing the /etc/hosts and /etc/hostname file and sometimes files in /etc/sysconfig/ and while this is still a plausible way to accomplish a permanent hostname change, it is not the approved way in Fedora any longer.

While I don't like Fedora and find it quite clunky, for once Fedora/Red Hat has made something worthwhile that I thought I'd share.  They've shortened and simplified the process to the following command:

hostnamectl set-hostname hostname.domain --static

This will set it so that the hostname persists through reboots.  You can also check on the hostname configuration by issuing a status command:

hostnamectl status

Torry Crass

Leave a Comment