在CentOS(5.x)上我有一个主机名设置为“olddomain.com”的VPS,至少这是我在输入“hostname”命令时得到的域名.
原文链接:https://www.f2er.com/centos/373801.html我想将其更改为“localhost.localdomain”,因为我认为它更通用,更可靠.
localhost.localdomain已存在于以下文件中:/ etc / sysconfig / network AND / etc / hosts
NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=localhost.localdomain GATEWAY=95.xx.xx.xx
和
# Do not remove the following line,or varIoUs programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6
接下来我尝试了这些命令:
hostname localhost.localdomain
和
hostname -v localhost.localdomain
“hostname”命令现在返回此新值.但重新启动后它会更改回olddomain.com或至少这是“hostname”命令返回.
还有别的东西要编辑吗?