1.[root@www ~]# vim /etc/sysconfig/network
NETWORKING=yes whether to use the network function
HOSTNAME=www hostname
2.[root@www ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.146.128 www
Restart after modification, permanent modification
Temporary modifications can also be made using the hostname hostname
man hostname
hostname - show or set the system's host name to query or modify the host name
[root@www ~]# hostname
www