我想知道必须编辑哪些文件才能在 RHEL7 计算机上添加域?
例子:
Hostname: Server1
Domain Name: qwer.tyu.iop
结果:
Server1.qwer.tyu.iop
答案1
我会通过hostnamectl
命令来做到这一点。
$ hostnamectl
Static hostname: centos7
Icon name: computer-vm
Chassis: vm
Machine ID: 1ec1e304541e429e8876ba9b8942a14a
Boot ID: 1fccc9bc187646549c942457b95ed299
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.21.1.el7.x86_64
Architecture: x86-64
要设置您的主机名:
$ hostnamectl set-hostname blah.blah.com
确认:
$ hostnamectl
Static hostname: blah.blah.com
Icon name: computer-vm
Chassis: vm
Machine ID: 1ec1e304541e429e8876ba9b8942a14a
Boot ID: 1fccc9bc187646549c942457b95ed299
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.21.1.el7.x86_64
Architecture: x86-64
笔记:这样做,它会在重新启动等之间持续存在。