4、linux设置主机名
linux设置主机名
1、查看主机名
hostname
默认:localhost.localdomain
2、更改主机名
编辑/etc/hostname,修改成自己需要的主机名
vi /etc/hostname
3、设置hosts
编辑/etc/hosts,将修改的主机名增加一个映射
vi /etc/hosts
/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 appserver
重新加载hosts
systemctl restart network.service
4、重启
reboot

浙公网安备 33010602011771号