1修改主机名
在SLES中如何修改主机名(hostname)
A: SLES8中可以用yast network来修改主机名(hostname),也可以通过修改配置文件的方式并运行命令
实现这个目的
方法1. 通过yast2管理工具进行配置
在console中运行yast2工具修改主机名(hostname)
# yast2 network
对于配置未经配置的网卡
"Network cards configuration"中"Network cards configuration"中“Configure...”
对于修改已配置网卡的设置
"Network cards configuration"中"Network cards configuration"中“Changev...”
“Network address setup”中“Detailed settings”单击“Host name and name server”
在“Host name”输入框中输入主机名,在“Domain name”中数入域名,如果没有域名,接受缺省的
“local”
方法2. 通过修改配置文件的方式并运行命令修改主机名
修改/etc/HOSTNAME文件,在此文件中保存主机名,例如:
linuxserv1
然后运行命令设置主机名
# /etc/rc.d/boot.localnet start
方法3. 运行 sysctl 动态改变主机名
# sysctl -w kernel.hostname=linuxserv1
在redhat中修改主机名
方法1:通过修改/etc/sysconfig/network文件,修改HOSTNAME="**" 然后重启/etc/init./network服务就可以了。
方法2:. 运行 sysctl 动态改变主机名
# sysctl -w kernel.hostname=linuxserv1
.bash_profile和.profile的问题
在suse里面root用户自己没有.profile .bash_profile,在建立新用户的时候里面会生成.profile文件,
如果在用户的主目录里面有.profile和.bash_profile同时存在的话,只执行.bash_profile里面的,后面的.profile不执行。如果里面只有.bash_profile和.profile两者之一的话,他里面的内容都可以执行。
Redhat里面无论是root用户还是普通用户都会生成.bash_profile。