Change my hostname or the machine name in Red Hat Linux.
There are several ways to change the hostname on Red Hat or a Red Hat clone:
-
Use hostname (no network service restart required).
Type hostname followed by the machine name. For example, to change it to hostname.example.com:
#hostname hostname.example.com -
Use system-config-network (network service restart required).
-
Edit /etc/sysconfig/network (network service restart required).
Edit HOSTNAME. For example, to change the hostname to hostname.example.com:
cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=hostname.example.com