systemctl命令

systemctl

systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。

任务 旧指令 新指令
使某服务自动启动 chkconfig –level 3 httpd on systemctl enable httpd.service
使某服务不自动启动 chkconfig –level 3 httpd off systemctl disable httpd.service
检查服务状态 service httpd status systemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active)
显示所有已启动的服务 chkconfig –list systemctl list-units —type=service
启动某服务 service httpd start systemctl start httpd.service
停止某服务 service httpd stop systemctl stop httpd.service
重启某服务 service httpd restart systemctl restart httpd.service

实例

1.启动nfs服务

systemctl start nfs-server.service

2.设置开机自启动

systemctl enable nfs-server.service

3.停止开机自启动

systemctl disable nfs-server.service

4.查看服务当前状态

systemctl status nfs-server.service

5.重新启动某服务

systemctl restart nfs-server.service

6.查看所有已启动的服务

systemctl list -units --type=service

开启防火墙22端口

iptables -I INPUT -p tcp --dport 22 -j accept

如果仍然有问题,就可能是SELinux导致的

关闭SElinux:

修改/etc/selinux/config文件中的SELINUX=””为disabled,然后重启。

彻底关闭防火墙:

sudo systemctl status firewalld.service
sudo systemctl stop firewalld.service          
sudo systemctl disable firewalld.service
原文地址:http://man.linuxde.net/systemctl

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/96942

(2)
小孜然小孜然
上一篇 2018-04-23
下一篇 2018-04-24

相关推荐

  • 第五周作业

    1、简述rpm与yum命令的常见选项,并举例
    2、自建yum仓库,分别为网络源和本地源
    3、简述at和crontab命令,制定 每周三凌晨三、五点10分执行某个脚本,输出当前时间,时间格式为 2017-12-28 10:00:00
    4、简述sed常用操作命令,并举例

    Linux笔记 2018-06-11
  • 第八周

    总结

    Linux笔记 2018-05-20
  • DNS服务、BIND

    DNS:domain name service,协议(C/S,udp53,tcp53) BIND:bekerley internat name domain 注意:named程序的启动用户是named用户,非root用户,因此需要注意权限和属主。 本地名称解析配置文件:hosts linux:/etc/hosts windows:%WINDOWS%/syst…

    2018-03-26
  • SSH端口转发实验

      本节索引: 一、SSH端口转发相关概念 二、实验:模拟SSH本地端口转发 三、实验:模拟SSH远程端口转发 四、实验:模拟SSH动态端口转发   一、SSH端口转发相关概念 在上一节我们知道,SSH会自动加密和解密所有SSH客户端和服务器之间的网络数据。但是,SSH还同时 提供了一个非常有用的功能,这就是端口转发。它能够将其他TCP端…

    Linux笔记 2018-05-22
  • lvm

    。。

    Linux笔记 2018-05-02
  • 第一周作业笔记

    1、描述计算机的组成及其功能。
    2、按系列罗列Linux的发行版,并描述不同发行版之间的联系与区别。
    3、描述Linux的哲学思想,并按照自己的理解对其进行解释性描述。
    4、说明Linux系统上命令的使用格式;详细介绍ifconfig、echo、tty、startx、export、pwd、history、shutdown、poweroff、reboot、hwclock、date命令的使用,并配合相应的示例来阐述。
    5、如何在Linux系统上获取命令的帮助信息,请详细列出,并描述man文档的章节是如何划分的。
    6、请罗列Linux发行版的基础目录名称命名法则及功用规定

    Linux笔记 2018-06-21