hostname - alex-aleyan/linux_wiki GitHub Wiki

  1. Modify the /etc/sysconfig/network file:

    NETWORKING=yes
    HOSTNAME=z_book_vm
    
  2. Replace the old hostname with the new one in /etc/hosts file:

    vim /etc/hosts
    
  3. Finally, use the hostname command to set your hostname:

    hostname z_book_vm
    
  4. Restart the network:

    service network restart
        OR
    /etc/init.d/network restart # <-Equivalently you can use
    
  5. Verify that the hostname has changed:

    hostname