linux基础(35)--服务管理--RHEL7

来源:互联网 发布:网络安全保密责任书 编辑:程序博客网 时间:2024/06/01 08:59

1. systemd简介

  RHEL6中使用systemv对服务进行管理,主要的管理工具是service。

  RHEL7中使用systemd对服务进行管理,主要的管理工具是systemctl

  systemd特性:

  (1)降低对服务脚本的依赖性

  (2)可以自动处理服务之间的依赖性,REHL6中服务之间的依赖性需要自己进行处理。

 依赖处理:软件之间的依赖:yum,服务之间的依赖:systemd,模块之间的依赖:modprobe

 RHEL6中服务的管理脚本在/etc/init.d/下,RHEL7服务启动文件在/usr/lib/systemd/system中。

  systemctl融合了REHL6的service和chkconfig的功能。

2. 服务管理

  以下以sshd服务为例说明RHEL7的服务管理

  查看服务状态:

  systemctl status sshd

  开启服务:

  systemctl start sshd

  关闭服务:

  systemctl stop sshd

  重启服务:

  systemctl restart sshd

  服务开机启动:

  systemctl enable sshd

  服务开机不启动:

  systemctl disable sshd

  查看服务是否开机启动:

  systemctl is-enabled sshd

  查看所有服务的状态:

  systemctl list-unit-files

  锁定服务:

  systemctl mask sshd   #此时这个服务不可以进行操作

  解除服务的锁定:

  systemctl unmask sshd

  列出服务间的依赖关系:

  systemctl list-dependencies

3. 防火墙服务

  firewalld

  systemctl start/stop/restart  firewalld

  为http服务添加防火墙规则:

  firewall-cmd --permanent --add-service=http

  使配置生效:

  firewall-cmd --reload

  图形化配置防火墙:

  firewall-config

  

   

  

0 0
原创粉丝点击