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
全站熱搜