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 22:59
下一篇 2018-04-24 10:54

相关推荐

  • 新开始,新航程

           每一个夏天都是变动的季节,这个夏季我毕业了。大学最后的时光是在实验室度过的,每天都被瓶瓶罐罐所包围,鼻子里不时的飘进乙酸乙酯的香味,研究完了生物柴油的催化,是时候该为自己的未来找一条出路了。         大二的时候出于对计算机的着迷,一不小心点进了51cto,从此就走上了不归路。从计算机网络到linux,再到mysql,我在这个世界里乐此不…

    Linux笔记 2018-07-21
  • iptables/netfilter、 tcp_wrapper

    iptables/netfilter: Firewall:防火墙,隔离工具;工作于主机或网络边缘,对于进出本主机或本网络的报文根据事先定义的检查规则作匹配检测,对于能够被规则匹配到的报文作出相应处理的组件; 主机防火墙 网络防火墙 软件防火墙(软件逻辑): 硬件防火墙(硬件和软件逻辑):NetScreen,CheckPoint,。。。 iptables(ne…

    Linux笔记 2018-06-05
  • centOS7.4启动流程

    本文主要介绍:centos7.4启动流程、Unit介绍、服务管理和查看、启动排错、破解口令及修复grub2

    2018-05-15
  • linux sed用法总结

    处理文本的工具sedStream EDitor, 行编辑器sed是一种流编辑器,它一次处理一行内容。处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的内容送往屏幕。然后读入下行,执行下一个循环。如果没有使诸如‘D’的特殊命令,那会在两个循环之间清空模式空间,…

    Linux笔记 2018-04-15