如何修改linux计算机名

来源:互联网 发布:知乎live入口 编辑:程序博客网 时间:2024/05/16 18:13

 如何修改linux计算机名

1)open a shell, tpye the command below:
 
[root@kcn-110]#hostname kcn-110mw

 
2)edit the file:/etc/sysconfig/network, change the value of 'HOSTNAME':
 
[root@kcn-110]#vi /etc/sysconfig/network
 
=======================================================================
 
NETWORKING=yes
HOSTNAME=kcn-110mw
 
=======================================================================


3)edit the file:/etc/hosts, change the ip address and your hostname
 
[root@kcn-110]#vi /etc/hosts
 
====================================================================
 
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1      localhost.localdomain   localhost
192.168.0.110   kcn-110mw       kcn-110mw
 
====================================================================


4)reboot network
/etc/sysconfig/network文件
改了以后要重启网络
/etc/init.d/network restart
service network restart