centos 为什么“hostname”和“hostname -f”返回彼此的值?

laawzig2  于 2022-11-07  发布在  其他
关注(0)|答案(1)|浏览(643)

我正在使用Centos 8虚拟机学习puppet。一开始,我只为我的虚拟机设置了一个短主机名puppet-mst。在一些故障之后--有人告诉我puppet需要FQDN才能继续。所以我为我的虚拟机设置了一个长主机名--

hostnamectl set-hostname puppet-mst.eisen

然后我发现了一件奇怪的事

[root@puppet-mst yum.repos.d]# hostname -f
puppet-mst
[root@puppet-mst yum.repos.d]# hostname
puppet-mst.eisen

"hostname" and "hostname -f" just return each other's values-- "hostname" return the long name while "hostname -f" returns the short one...
 So now -- I can't install foreman on this centos VM -- as it will return error --

[root@puppet-mst yum.repos.d]# foreman-installer -i
2021-11-01 00:22:04 [NOTICE] [root] Loading installer configuration. This will take some time.
2021-11-01 00:22:08 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2021-11-01 00:22:08 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
Output of 'facter fqdn' is different from 'hostname -f'

请帮助--如何设置主机名,然后使“主机名”和“主机名-f”都返回正确的一个--特别是“主机名-f”应该返回长域名?提前感谢。

a2mppw5e

a2mppw5e1#

经过一些研究,我发现这是由于/etc/hosts。
当它...

192.168.160.131 puppet-mst puppet-mst.eisen

“hostname -f”将返回puppet-mst,当它--

192.168.160.131 puppet-mst.eisen puppet-mst

主机名-f”将返回puppet-mst.eisen

相关问题