博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
systemctl命令
阅读量:4035 次
发布时间:2019-05-24

本文共 1201 字,大约阅读时间需要 4 分钟。

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

(1)任务:使某服务自动启动

旧指令:chkconfig –level 3 httpd on
新指令:systemctl enable httpd.service
(2)任务:使某服务不自动启动
旧指令:chkconfig –level 3 httpd off
新指令:systemctl disable httpd.service
(3)任务:检查服务状态
旧指令:service httpd status
新指令:systemctl status httpd.service (服务详细信息)
systemctl is-active httpd.service (仅显示是否 Active)
(4)任务:显示所有已启动的服务
旧指令:chkconfig –list
新指令:systemctl list-units –type=service
(5)任务:启动某服务
旧指令:service httpd start
新指令:systemctl start httpd.service
(6)任务:停止某服务
旧指令:service httpd stop
新指令:systemctl stop httpd.service
(7)任务:重启某服务
旧指令: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://vubdi.baihongyu.com/

你可能感兴趣的文章
Android2.1消息应用(Messaging)源码学习笔记
查看>>
Phone双模修改涉及文件列表
查看>>
android UI小知识点
查看>>
Android之TelephonyManager类的方法详解
查看>>
android raw读取超过1M文件的方法
查看>>
ubuntu下SVN服务器安装配置
查看>>
MPMoviePlayerViewController和MPMoviePlayerController的使用
查看>>
CocoaPods实践之制作篇
查看>>
[Mac]Mac 操作系统 常见技巧
查看>>
苹果Swift编程语言入门教程【中文版】
查看>>
捕鱼忍者(ninja fishing)之游戏指南+游戏攻略+游戏体验
查看>>
iphone开发基础之objective-c学习
查看>>
iphone开发之SDK研究(待续)
查看>>
计算机网络复习要点
查看>>
Variable property attributes or Modifiers in iOS
查看>>
NSNotificationCenter 用法总结
查看>>
C primer plus 基础总结(一)
查看>>
剑指offer算法题分析与整理(一)
查看>>
剑指offer算法题分析与整理(三)
查看>>
Ubuntu 13.10使用fcitx输入法
查看>>