CentOS 7 启动、重启、chkconfig等命令已经合并为systemctl

时间:2023-11-16 16:44:56

CentOS 7系统服务启动、重启、设置服务启动项命令以合并为,systemctl . 现在用service 或/etc/init.d/命令,重启,重新启动,停止等没效果,因为命令合并为systemctl. 新命令具体内容如下:

以启动httpd和设置Apache httpd为服务启动为例子:
centos7之前的命令是这样:

service httpd start 启动Apache httpd

service httpd restart 重新启动

service httpd stop 停止服务

chkconfig –levels 235 httpd on 开机启动httpd

或是:

/etc/init.d/ httpd start 启动

/etc/init.d/ httpd restart 重新启动

/etc/init.d/ httpd stop 停止服务

centos7吧这些命令全部合并了,使用也更加方便,当然也是习惯问题,如果习惯了之前命令,centos新命令还得适应适应,其实很简单,只要这样记忆,使用就比较方便了.
systemctl 动作 服务名.service

一些centos7 systemctl命令简单实用实例:

systemctl start httpd.service /启动Apache httpd

systemctl restart httpd.service /重新启动

systemctl stop httpd.service /停止服务

systemctl enable httpd.service /开机启动httpd

systemctl disable httpd.service /禁止开机启动httpd