临时修改host这里就不说了,没意义.
永久修改host名,需要在系统里修改两处.
1.[root@sh150 ~]#vim /etc/hosts(vim后面有个空格)
按“i”编辑:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomainsh150(需要修改的主机名)
::1 localhost6.localdomain6 localhost6
按“esc”退出编辑,按“:wq!”保存并退出.
2.[root@sh150 ~]#vim /etc/sysconfig/network(vim后面有个空格)
按“i”编辑:
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=sh150(需要修改的主机名)
GATEWAY=192.168.10.254
按“esc”退出编辑,按“:wq!”保存并退出.
[root@sh150 ~]#reboot(重启生效.大功告成)