Ubuntu更改主机名

 Ubuntu更改主机名跟RedHat不一样,有两处需要修改,小记一下,以免以后忘掉

首先编辑 /etc/hosts文件,这个跟RedHat一样,不过略有不同

 

  
  
  
  
  1. root@node1:~# cat /etc/hosts 
  2. #127.0.0.1      localhost 
  3. 127.0.1.1       node1.ttpod.com 
  4. 192.168.0.2     node1.ttpod.com 
  5. 192.168.0.128   node2.ttpod.com 
  6.  
  7. # The following lines are desirable for IPv6 capable hosts 
  8. ::1     ip6-localhost ip6-loopback 
  9. fe00::0 ip6-localnet 
  10. ff00::0 ip6-mcastprefix 
  11. ff02::1 ip6-allnodes 
  12. ff02::2 ip6-allrouters 

RedHat可以在主机名后跟一个短的名称,Ubuntu不可以。

第二处要改的地方是/etc/hostname

 

  
  
  
  
  1. root@node1:~# cat /etc/hostname 
  2. node1.ttpod.com 

里面的内容很简单,就一个主机名。

 

 

 

你可能感兴趣的:(ubuntu,更改主机名)