加入收藏 | 设为首页 | 会员中心 | 我要投稿 应用网_丽江站长网 (http://www.0888zz.com/)- 科技、建站、数据工具、云上网络、机器学习!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Ubuntu中如何更改主机名

发布时间:2016-09-10 02:37:14 所属栏目:Linux 来源:站长网
导读:Ubuntu更改主机名跟RedHat不一样,有两处需要修改,小记一下,以免以后忘掉 首先编辑 /etc/hosts文件,这个跟RedHat一样,不过略有不同 root@node1:~# cat /etc

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

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

root@node1:~# cat /etc/hosts 
#127.0.0.1      localhost 
127.0.1.1       node1.ttpod.com 
192.168.0.2     node1.ttpod.com 
192.168.0.128   node2.ttpod.com 
     
# 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

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

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

root@node1:~# cat /etc/hostname

node1.ttpod.com

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

URL:http://www.bianceng.cn/OS/Linux/201410/46056.htm

(编辑:应用网_丽江站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读