When the name inux system host name is displayed, commonly used in server mapping, and other related IP applications, if we are not explicitly specified when creating a virtual machine or server, will automatically generate a bunch of us do not want, or we want to change a host name this time we need to change the host name of the operation
A temporary change
to use the command hostname
[root@xxxx ~]# hostname yourname
Two permanent
1. Modify the linux host configuration file / etc / sysconfig / network and / etc / hosts in the host name
vim / etc / sysconfig / Network
NETWORKING = yes
HOSTNAME = hostname yourname # In this modification
vim /etc/hosts
Localhost.localdomain localhost 127.0.0.1
xx.xx.xx.xx yourname # In this modification hostname, if not this line, add
2. Let the name change to take effect at the
Restart
# reboot
Or not to restart
Hostname yourname #
# su
----------------
Disclaimer: This article is the original article CSDN bloggers "Mochou_liqb", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/mochou111/article/details/100560109