操作系统:CentOS Linux release 7.8
任务:修改主机名为sky9899
操作步骤如下:
[root@146 ~]# hostname
*.*.*.*.adsl-pool.jx.chinaunicom.com
[root@146 ~]# hostnamectl
Static hostname: localhost.localdomain
Transient hostname: *.*.*.*.adsl-pool.jx.chinaunicom.com
Icon name: computer-server
Chassis: server
Machine ID: 3bd1b96900b8403b8c8d3405d6ad99af
Boot ID: ba99cb9810f5449f9f7509e0c5e241e5
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1062.el7.x86_64
Architecture: x86-64
[root@146 ~]# hostname
*.*.*.*.adsl-pool.jx.chinaunicom.com
[root@146 ~]# hostnamectl --static set-hostname sky9899
[root@146 ~]# hostname
sky9899
来源:oschina
链接:https://my.oschina.net/u/4383691/blog/4260605