本文共 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.service2.设置开机自启动
systemctl enable nfs-server.service3.停止开机自启动
systemctl disable nfs-server.service4.查看服务当前状态
systemctl status nfs-server.service5.重新启动某服务
systemctl restart nfs-server.service6.查看所有已启动的服务
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/