【永久修改】
编辑:/etc/hosts
127.0.0.1 localhost localhost.localdomain Amon
编辑:/etc/hostname
Amon
然后重启:
reboot
【测试】
输入命令:
hostname
输出:
Amon
【报错】
报错:My unqualified host name (Amon) unknown; sleeping for retry
在为 fail2ban 安装 sendmail ,启动 fail2ban 后出现的报错。
因为:“Sendmail looks for a fully qualified domain (FQDN) name and will use the localhost.localdomain in the single line version.”
所以需要 /etc/hosts 规范写为:
127.0.0.1 localhost localhost.localdomain Amon
【参考】
参考:https://www.digitalocean.com/community/questions/how-do-i-change-hostname
参考:https://www.vultr.com/docs/how-to-change-your-hostname-on-centos
参考:http://www.cnblogs.com/kerrycode/p/3595724.html