Red Hat Change hostname without rebooting
id : zg9yxgjboj
category : computer
blog : unixlinux
created : 04/27/10 - 09:57:02

/etc/sysconfig/network
  • Modify your /etc/sysconfig/network
...
HOSTNAME=<new_hostname>


/etc/hosts
  • Modify your /etc/hosts :
# sed -i 's/<old_hostname>/<new_hostname>/' /etc/hosts


hostname command
  • Modify hostname with hostname command
# hostname <new_hostname>
# hostname
<new_hostname>


Network
  • At least restart your networking service to commit your modifications
# service network restart


  • Login and logout to check if hostname was changed