ubuntu修改hostname

ubuntu安装以后缺省的hostname是ubuntu,安装的机器多了,容易产生混淆,直接用命令#hostname newname,重启后失效。
  

修改/etc/hostname文件就可以了,
  root@ubuntuServer:/etc# more hostname
  #ubuntu
  newname
  
  但是这样一来在X下面,很多命令不正常,比如打开terminal出不来,原来还需要修改
  /etc/hosts文件,
  127.0.0.1 localhost.localdomain localhost newname
  #
  # The following lines are desirable for IPv6 capable hosts
  ::1 ip6-localhost ip6-loopback
  fe00::0 ip6-localnet
  ff00::0 ip6-mcastprefix
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  ff02::3 ip6-allhosts

posted @ 2011-11-08 08:53  Jonson Li  阅读(2206)  评论(0编辑  收藏  举报