CentOS 7很多命令较CentOS 6有很大的改变,总结了部分自己可能会用到的,比如启动,关闭,重启,设置自启动等等。
这里以nginx为例:
| 任务 | 旧指令 | 新指令 |
|---|---|---|
| 自动启动 | chkconfig nginx on | systemctl enable nginx.service |
| 不自动启动 | chkconfig nginx off | systemctl disable nginx.service |
| 检查服务状态 | service httpd status | systemctl status nginx.service (服务详细信息) |
| 检查服务状态 | systemctl is-active nginx.service (是否 Active) | |
| 显示所有服务 | chkconfig --list | systemctl list-units --type=service |
| 启动服务 | service nginx start | systemctl start nginx.service |
| 停止服务 | service nginx stop | systemctl stop nginx.service |
| 重启服务 | service nginx restart | systemctl restart nginx.service |