1. 执行命令 hostname,修改当前系统的主机名
hostname newhost
2. 修改 /etc/sysconfig/network,使得下次启动时使用新的主机名
hostname=newhost
在使用VI编辑这后报“etc/sysconfig/network”E212:不能以写入模式打开。我查了一个资料是这样说的:
When you get error "E138: Can't write viminfo file" check that no old temp files were left behind (e.g. ~/.viminf*) and that you can write in the directory of the .viminfo file. {not in Vi}I have removed the .viminf*.tmp files from /root directory. There was no error or annoying message while editing in VI Editor.
只要删除用户目录下的.viminf*.tmp,此问题就可解决。
3. 修改 /etc/hosts。不修改的话,apache等需要解析主机名的服务将不能启动
127.0.0.1 newhost localhost
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7765999/viewspace-979607/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7765999/viewspace-979607/