Here are the steps to change (rename) Linux hostname without rebooting:

1. edit /etc/sysconfig/network as follows:  (* change danbrother to whatever your new hostname would be)
    HOSTNAME=danbrother

2. edit /etc/hosts as follows:
    192.168.100.101 danbrother

3. hostname danbrother

4. service network restart
 

PS.
For CentOS 7 , hostname can be renamed by the following command:
hostnamectl set-hostname newhostname


e.g.
hostnamectl set-hostname danbrother

 

文章標籤
全站熱搜
創作者介紹
創作者 DanBrother 的頭像
DanBrother

DanBrother的部落格

DanBrother 發表在 痞客邦 留言(0) 人氣(12)