在Debian系统中,主机名可通过以下文件配置:
hostname
/etc/hostname
/etc/hosts
推荐使用 hostnamectl 命令(属于systemd工具),可同时管理临时和永久主机名,无需重启系统。
hostnamectl
注意:修改后需检查网络服务及依赖主机名的应用是否正常。