CentOS 6.5
[1] Change hostname with a commnad (but if rebooting, it will be back).
[root@vpsmate ~]# hostname # show current hostname srv1.vpsmate.net [root@vpsmate ~]# hostname srv2.vpsmate.net # change hostname [root@vpsmate ~]# hostname srv2.vpsmate.net
[2] Change hostname permanently.
[root@vpsmate ~]# vi /etc/sysconfig/network # change HOSTNAME=srv2.vpsmate.net [root@vpsmate ~]# exit CentOS release 6.5 Kernel xxx srv2.vpsmate.net login: # changed
CentOS 7
[1]Change hostname with a commnad (but if rebooting, it will be back).
[root@vpsmate ~]# hostname # show current hostname srv1.vpsmate.net [root@vpsmate ~]# hostname srv2.vpsmate.net # change hostname [root@vpsmate ~]# hostname srv2.vpsmate.net
[2] Change hostname permanently.
[root@vpsmate ~]# vi /etc/hostname # change srv1.vpsmate.net [root@vpsmate ~]# exit CentOS Linux 7 Kernel 3.10.0-123.4.2.el7.x86_64 on an x86_64 srv1 login: # just changed
Comments