CentOS 7这都出来一两年了,虽然当初只是在虚拟机里面玩儿了一下,而如今想在服务器上玩玩儿,才发现很多命名都已经不尽相同了,搞得我还有点措手不及。

CentOS LOGO

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

以启动httpd和设置Apache httpd为服务启动为例子:

CentOS 7之前的命令是这样:

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 停止服务

CentOS 7吧这些命令全部合并了,使用也更加方便,当然也是习惯问题,如果习惯了之前命令,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

systemctl status httpd.service /httpd当前状态

部分内容参考自互联网

除非注明,否则均为泪雪博客原创文章,禁止任何形式转载

本文链接:https://zhangzifan.com/centos-systemctl.html

留言评论

登录 后留言