首页 RHEL5.4系统服务的管理

RHEL5.4系统服务的管理

举报
开通vip

RHEL5.4系统服务的管理RHEL5.4系统服务的管理 关于linux下面系统服务的管理的讨论, Linux系统服务可以分为三类: 1、由init控制的服务 2、由System V启动脚本启动的服务 3、由xinetd管理的服务 下面我们来介绍这三种系统服务: 一.Init控制的服务 Init的配置文件在/etc/inittab这个文件中。 二.System V服务 经常使用几个配置文件,大多数服务启动一个或多个进程。都是独立启动服务。在/etc/init.d/下面的脚本都是system V服务。 [root@loc...

RHEL5.4系统服务的管理
RHEL5.4系统服务的管理 关于linux下面系统服务的管理的讨论, Linux系统服务可以分为三类: 1、由init控制的服务 2、由System V启动脚本启动的服务 3、由xinetd管理的服务 下面我们来介绍这三种系统服务: 一.Init控制的服务 Init的配置文件在/etc/inittab这个文件中。 二.System V服务 经常使用几个配置文件,大多数服务启动一个或多个进程。都是独立启动服务。在/etc/init.d/下面的脚本都是system V服务。 [root@localhost ~]# cd /etc/init.d/ [root@localhost init.d]# ls acpid functions kudzu nscd setroubleshoot anacron gpm libvirtd ntpd single apmd haldaemon lvm2-monitor pand smartd atd halt mcstrans pcscd sshd auditd hidd mdmonitor portmap syslog autofs hplip mdmpd psacct vmware-tools avahi-daemon ip6tables messagebus rawdevices vncserver avahi-dnsconfd ipmi microcode_ctl rdisc vsftpd bluetooth ipmievd multipathd readahead_early wdaemon conman iptables named readahead_later winbind cpuspeed irda netconsole restorecond wpa_supplicant crond irqbalance netfs rhnsd xend cups iscsi netplugd rpcgssd xendomains cups-config-daemon iscsid network rpcidmapd xfs dnsmasq kdump NetworkManager rpcsvcgssd xinetd dund killall nfs saslauthd ypbind firstboot krb524 nfslock sendmail yum-updatesd [root@localhost init.d]# 在这个里面的所有脚本都是system V的服务, 如果想运行这些服务,可以使用两种方式, #/etc/init.d/vsftpd restart [root@localhost ~]# [root@localhost ~]# /etc/init.d/vsftpd restart Shutting down vsftpd: [ OK ] Starting vsftpd for vsftpd: [ OK ] [root@localhost ~]# 直接使用脚本的方式来运行,还有一种方式, #service vsftpd restart [root@localhost ~]# [root@localhost ~]# service vsftpd restart Shutting down vsftpd: [ OK ] Starting vsftpd for vsftpd: [ OK ] [root@localhost ~]# 使用service命令来调用脚本。 如何控制系统服务呢? 我们一般使用chkconfig工具来管理, 我们可以使用chkconfig工具来定义那个服务运行在那个级别上面。 #chkconfig --list 这条命令会显示系统中所有的系统服务,输出很多。后面可以跟查询的服务。# Chkconfig --list vsftpd [root@localhost ~]# [root@localhost ~]# chkconfig --list vsftpd vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@localhost ~]# 通过chkconfig工具可以查询到vsftpd这个服务在下次启动的时候在2,3,4,5这四个级别上面是启动的。 如何定义系统服务在下次启动的时候在那个级别启动呢? 现在我们定义vsftpd服务在下次启动的时候在3,5级别启动。 # chkconfig --level 35 vsftpd on [root@localhost ~]# [root@localhost ~]# chkconfig --level 35 vsftpd on [root@localhost ~]# [root@localhost ~]# chkconfig --list vsftpd vsftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off [root@localhost ~]# 现在我们的vsftpd服务在下次启动的时候就会在3和5的级别启动。 如果我们不加任何级别,直接将vsftpd服务给off。 #chkconfig vsftpd off [root@localhost ~]# [root@localhost ~]# chkconfig vsftpd off [root@localhost ~]# [root@localhost ~]# chkconfig --list vsftpd vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@localhost ~]# 现在在所有的级别上面,vsftpd服务就off了。 将vsftpd服务直接给on呢。 #chkconfig vsftpd on [root@localhost ~]# [root@localhost ~]# chkconfig vsftpd on [root@localhost ~]# [root@localhost ~]# chkconfig --list vsftpd vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@localhost ~]# 那么就会在2,3,4,5级别上面启动。因为在0,1,6级别启动没有意义。这条命令也是我们最长用到的。 我们可以添加服务或者删除服务在chkconfig的管理程序里面。 删除一个服务在chkconfig的管理程序里面, #chkconig --del vsftpd [root@localhost ~]# [root@localhost ~]# chkconfig --del vsftpd [root@localhost ~]# [root@localhost ~]# chkconfig --list vsftpd service vsftpd supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add vsftpd') [root@localhost ~]# Vsftpd这个服务就从chkconfig的管理程序里面删除了,通过chkconfig --list命令也查询不到了。 添加一个服务到chkconfig的管理程序里面。 #chkconfig --add vsftpd [root@localhost ~]# [root@localhost ~]# chkconfig --add vsftpd [root@localhost ~]# [root@localhost ~]# chkconfig --list vsftpd vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@localhost ~]# OK,vsftpd服务就被成功的添加到了chkconfig的管理程序里面。 注意:service vsftpd restart这条命令是使vsftpd服务在当前生效,下次启动不生效。而chkconfig工具开启的服务是在下次生效。 Chkconfig vsftpd on这条命令一定要敲。 关于/etc/sysconfig下面的文件, /etc/sysconfig这个目录我们并不陌生了,这个目录下面的所有文件都是全局配置文件。我们很多的服务都在/etc/sysconfig下面有全局的配置文件。 三.Xinetd管理的服务。 我们由xinetd管理的服务都在/etc/xinetd/下面。 [root@localhost ~]# [root@localhost ~]# cd /etc/xinetd.d/ [root@localhost xinetd.d]# ls chargen-dgram discard-stream gssftp rsync time-stream chargen-stream echo-dgram klogin tcpmux-server daytime-dgram echo-stream krb5-telnet telnet daytime-stream eklogin kshell tftp discard-dgram ekrb5-telnet rmcp time-dgram [root@localhost xinetd.d]# 这个目录下面的服务都是由Xinetd来管理的。 可以看到,在这个目录下面有个telnet。也就是说telnet是由xinetd来管理的。现在我们打开这个文件来看看。 # default: on # description: The telnet server serves telnet sessions; it uses \ # unencrypted username/password pairs for authentication. service telnet { flags = REUSE socket_type=stream wait = no user =root server = /usr/sbin/in.telnetd log_on_failure+= USERID disable = yes } 在telnet的配置文件里面有个disable = yes,是不是关闭这个服务呢,yes。 现在我们将它改成no,不关闭。 那么我们如何重新启动这个服务呢。 使用service telnetd restart来试试, [root@localhost ~]# [root@localhost ~]# service telnetd restart telnetd: unrecognized service [root@localhost ~]# 好像不行,因为telnet不是system V的服务,不可能会调用/etc/init.d下面的脚本。 telnet服务是属于xinetd服务的,我们重启下xinetd服务,试试。 [root@localhost ~]# [root@localhost ~]# service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ] [root@localhost ~]# OK,xinetd服务启动成功。 因为xinetd服务也是属于system V服务,所以可以用service来启动。 我们知道telnet的端口号是23,我们来查询这个端口有没有监听。 [root@localhost ~]# [root@localhost ~]# netstat -tulnp | grep 23 tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN 14854/xinetd [root@localhost ~]# 可以看到,telnet服务的确是监听在23号端口的。并且是由xinetd来管理的。现在我们来测试一下, [root@localhost ~]# [root@localhost ~]# telnet 192.168.0.254 Trying 192.168.0.254... Connected to 192.168.0.254 (192.168.0.254). Escape character is '^]'. Red Hat Enterprise Linux Server release 5.4 (Tikanga) Kernel 2.6.18-164.el5xen on an i686 login: user1 Password: Last login: Mon Mar 8 14:22:29 from 192.168.0.2 [user1@localhost ~]$ ls [user1@localhost ~]$ 同样的,我们也可以使用chkconfig来管理telnet。 [root@localhost ~]# [root@localhost ~]# chkconfig telnet on [root@localhost ~]# chkconfig --list telnet telnet on [root@localhost ~]# chkconfig telnet off [root@localhost ~]# chkconfig --list telnet telnet off [root@localhost ~]# 关于system V服务和xinetd管理的服务, System V 占用资源,反应速度快。 Xinted 占用资源少,反应速度慢。 Xinetd的全局配置文件在/etc/xinetd.conf文件, /etc/xinetd.d/service这个是xinetd服务的配置文件。 继续阅读
本文档为【RHEL5.4系统服务的管理】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_562397
暂无简介~
格式:doc
大小:31KB
软件:Word
页数:0
分类:互联网
上传时间:2019-03-27
浏览量:0