您的位置:首页 > 运维架构 > Linux

在CentOS Redhat里设置FQDN和Hostname

2013-12-15 13:59 405 查看
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:



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,再登陆,就应该生效。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: