Linux基础(八):设置主机名、chkconfig、ntp服务

设置主机名

1、临时设置主机名

#hostname 设置的主机名

需要切换用户,使之生效

2、永久设置主机名(需要重启)

配置文件:/etc/sysconfig/network

3、修改linux服务器的hosts文件,将设置的主机名指向本地(设置FQDN)

hosts文件位置:/etc/hosts

不设置FQDN的影响:

1、开源服务器软件(Apache等)无法启动,或出现报错

2、影响本地域名解析(本地访问)

chkconfig

提供“开机启动项”的一个管理服务

1、查询开机启动服务

#chkconfig --list

查询出来的结果,06代表运行级别06是开启(on)或关闭(off)

2、删除服务

#chkconfig --del 服务名

3、添加服务

#chkconfig --add 服务名

必须要保证服务能正常运行,才可以添加

4、设置服务在某个级别下开机启动/不启动(重点)

#chkconfig --level 连在一起的启动级别 服务名 on/off

举例:#chkconfig --level 35 httpd on

ntp服务

对计算机时间同步管理操作

1、手动同步

#ntpdate 时间服务器域名或ip
#service ntpd start/restart/stop
#/etc/init.d/ntpd start/restart/stop

2、设置开机启动

#chkconfig --level 35 ntpd on

版权声明:本文为ailll123原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。