19 - Change Linux Hostname Redhat / CentOS / Fedora

  • 1- Find and edit the following file "/etc/hosts"
  • 127.0.0.1               localhost.localdomain localhost --new_hostname--
    ::1             localhost6.localdomain6 localhost6
    10.111.1.111 xxxx1
    10.111.2.111 xxxx2
    
    
     
  • 2- Edit /etc/sysconfig/network
  • NETWORKING=yes
    NETWORKING_IPV6=no
    HOSTNAME=localhost.localdomain   <<- replace here with the new_hostname

    Save and close the file.

  • 3- Type the following command:
  •  hostname --your new hostname--
     hostname

    Your new host name should be set now.