Centos系统如何启动/关闭某项服务?如何设置服务自动启动?本文将主要列举CentOS系统服务器中常用的服务相关命令。
因系统命令不同,命令也不同;一般Centos5.x/6.x使用旧命令、Centos7.x/8.x使用新命令:
任务 | 旧命令 | 新命令 |
---|---|---|
使某服务开机自动启动 | 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-unit-files 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 |
Copyright © 2013-2021 8a.hk All Rights Reserved. 八艾云 版权所有 中山市八艾云计算有限公司 粤ICP备14095776号