Description

This article explains how to change the hostname of a Linux machine.

Content / Solution:

The default hostname is deployed based on the IP address of the machine. 

Changing the hostname requires the modification of a single file, /etc/sysconfig/network and an examination of the system-wide hosts file, /etc/hosts is also recommended.  After changing the hostname, a reboot of the system will be required to commit the change. 


/etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=example.mydomain.com  # Your FQDN goes here
GATEWAY=192.168.1.2
    


/etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       example example.mydomain.com localhost
::1     localhost6.localdomain6 localhost6