在CentOS Redhat里设置FQDN和Hostname

http://extr3metech.wordpress.com/2012/12/12/changing-hostname-in-centos-red-hat-linux/
http://www.chenshake.com/linux-foundation-set-fqdn-hostname/


To change host name in Linux from command line, type:

vi /etc/sysconfig/network

Now, you will see a file such as the one shown below:

2

To change the hostname , you can change the highlighted to any thing you want. Press ‘i‘ or INSERT to edit the file. After making necessary changes, you can save the file by pressing ESC followed by :wq and hit ENTER.

Now, restart to make necessary changes. You can reboot by typing the following in the command line:

reboot

After reboot, login and check your hostname by typing the following in the terminal / command line :

hostname

 

Hope this helps!  :)




现在对于Puppet,也是必须设置完整的FQDN 名字。不同的操作系统,有有点不一样。

CentOS

查看

[root@rdo ~]# hostname
rdo
[root@rdo ~]# hostname -f
rdo.test.com

要实现这个效果,需要修改两个文件

编辑 /etc/sysconfig/network ,你需要加入一行,记住HOSTNAME,必须大写。

# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=rdo

编辑 /etc/hosts,增加一行

192.168.178.2   rdo.test.com    rdo

退出ssh,再登陆,就应该生效。



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值