Linux modify the hostname method

[root @ LyX ~] # vim / etc / hosts    vim representatives modifications, enter the hosts file to add 192.168.10.128 hadoop128

[root @ lyx ~] # hostname hostname command View
lyx.wz.com
[root @ LyX ~] # cd /       into the root directory
[root @ lyx /] # vi    / etc / sysconfig / network reason, changes hostname modify this file, but I did not succeed, so Should you do not succeed, read on. . .
[root @ LyX /] # vi / etc / hosts
[root @ LyX /] # hostname
lyx.wz.com
[root @ LyX /] # hostnamectl Status   Detail View the status of a host of
Static hostname: lyx.wz.com
Icon name: VM-Computer
Chassis: VM
Machine ID: 47b6edb5fd7a4c35a718c1eeaa742261
the Boot ID: 6a11fda7a57f4e1094c0dda6639d2bd5
the Virtualization: VMware
the Operating the System: the Linux the CentOS. 7 (Core)
the CPE the OS the Name: CPE: / O: CentOS: CentOS:. 7
Kernel: the Linux 3.10.0-1062.el7 .x86_64
Architecture: x86-64
[root@lyx /]# cat /etc/hosts  
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.19.128 hadoop128
192.168.1.100 hadoop100
192.168.1.101 hadoop101
192.168.1.102 hadoop102
192.168.1.103 hadoop103
192.168.1.104 hadoop104
192.168.1.105 hadoop105
192.168.1.106 hadoop106
192.168.1.107 hadoop107
192.168.1.108 hadoop108
192.168.1.109 hadoop109

[@ LyX the root /] CAT # / etc / hostname
lyx.wz.com
[@ LyX the root /] # hostname
lyx.wz.com
[@ LyX the root /] # hostnamectl hadoop128 hostname SET-  modified host name Hadoop128
[the root @ LyX /] # hostname  
hadoop128           modified successfully
[root @ lyx /] #

Guess you like

Origin www.cnblogs.com/lyxcode/p/11609191.html