CentOS

  1. Open the server’s network file
    • vim /etc/sysconfig/network
    • Replace the old hostname with the new hostname
      • HOSTNAME=NewHostName
  2. Edit the hosts file
    • vim /etc/hosts
    • Replace any occurrence of the old hostname with the new
  3. Set the hostname via command line so that you do not have to reboot the server
    • hostname [Enter Hostname]

Ubuntu

  1. Edit the hostname file
    • vim /etc/hostname
    • Replace the old hostname with the new
  2. Edit the hosts file
    • vim /etc/hosts
    • Replace any occurrence of the old hostname with the new
  3. Set the hostname via command line so that you do not have to reboot the server
    • hostname [Enter Hostname]

Leave a Reply

Your email address will not be published. Required fields are marked *