Is production: true
#migrated

How to change server hostname

Created: 19 Mar 2023 Modified: 19 Mar 2023 Lang: English



[Legacy Link]

[Link]

Instructions

Five part to setup

  1. Edit network file

    1
    2
    3
    
    sudo vim /etc/sysconfig/network
    #Edit hostname
    HOSTNAME={hostname}
    
  2. Edit hosts

    1
    2
    3
    
    sudo vim /etc/hosts
    ####################
    add hostname to 127.0.0.1 and ::1
    
  3. use hostnamectl command

    1
    
    hostnamectl set-hostname hostname.domain.com
    
  4. Restart network service

    1
    
    /etc/init.d/network restart