我有一个运行Debian Squeeze的虚拟服务器。 我可以通过运行hostname new.host.name命令或通过编辑/etc/hostname然后运行/etc/init.d/hostname.sh来更改主机名,但在重新启动后,主机名将被重置为所选的预configuration主机名由服务器主机。 我不知道使用了哪个虚拟化解决scheme,我无法访问pipe理界面来更改主机名。
hostname new.host.name
/etc/hostname
/etc/init.d/hostname.sh
每次服务器启动时,如何使用脚本更改主机名?
一个简单的,虽然稍微脏的方法是将hostname yourhostname放入/etc/rc.local 。
hostname yourhostname