http://os.51cto.com/art/200912/166663.htm
帖子一的三个方法,只有yast2可行。
方法1. 通过yast2管理工具进行配置-测试可行在console中运行yast2工具修改主机名(hostname)
# yast2 network
"Network Configuration"中选择"Network Card"点击“Launch”,在“Network Setup Method”中选择“User Controlled
with NetworkManager”,点击“Next”,在“Network Card Configuration Overview”中选择“AMD PCnet-Fast79C971”
,点击“Edit”,在“Network Address Setup”中点击“Address”下面的“Hostname and Name Server”,在弹出的对话
框中点击“Modify”,然后在“Hostname and Domain Name(Global)”下面进行修改就可以了。
方法2. 通过修改配置文件的方式并运行命令修改主机名-测试不通过,找不到此项信息修改/etc/HOSTNAME文件,在此文件中保存主机名,例如:
SLES-1
然后运行命令设置主机名
# /etc/rc.d/boot.localnet start
方法3. 运行 sysctl 动态改变主机名-测试不通过,重启服务器后配置清除# sysctl -w kernel.hostname=SLES-1
通过这三种方法,你就轻松在Suse修改主机名了。
帖子3方法可行
http://blog.youkuaiyun.com/csuzhaobo/article/details/6924057
#export HOSTNAME=主机名
# echo $HOSTNAME>/etc/HOSTNAME
# /etc/rc.d/boot.localnet stop
# /etc/rc.d/boot.localnet start