3.4. 为系统设置主机名(Hostname)
director 的安装和配置过程需要一个完全限定域名(FQDN),这意味着您必须为 director 的主机设置主机名。使用以下命令检查主机的主机名:
hostname # Checks the base hostname hostname -f # Checks the long hostname (FQDN)
$ hostname # Checks the base hostname
$ hostname -f # Checks the long hostname (FQDN)
如果需要,使用
hostnamectl 设置主机名:
sudo hostnamectl set-hostname manager.example.com sudo hostnamectl set-hostname --transient manager.example.com sudo export HOSTNAME=manager.example.com
$ sudo hostnamectl set-hostname manager.example.com
$ sudo hostnamectl set-hostname --transient manager.example.com
$ sudo export HOSTNAME=manager.example.com
另外,director 还需要在
/etc/hosts 文件中包括一个带有系统主机名和基本名的项。例如,您系统的名称是 manager.example.com,/etc/hosts 则需要包括一个和以下类似的项:
127.0.0.1 manager.example.com manager
127.0.0.1 manager.example.com manager