Linux 配置主机名 和 DNS
Linux 主机名
hostname
# 查看:hostname
# 配置:hostname HOSTNAME
# 当前系统有效,重启后无效
hostnamectl命令(CentOS 7)
# hostnamectl status # 显示当前主机名信息
# hostnamectl set-hostname # 设定主机名,永久有效
[root@LeeMumu ~]# hostnamectl status
Static hostname: localhost.localdomain
Transient hostname: LeeMumu
Icon name: computer-vm
Chassis: vm
Machine ID: 4e9d1845d9784f86836aee690f9d98bd
Boot ID: d93be01c3cbd4c75a8034a67d8898dbd
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-957.el7.x86_64
Architecture: x86-64
配置文件
对配置文件# /etc/hostname
进行编辑:
HOSTN