Centos6和Centos7开机自动启动服务方法

    xiaoxiao2023-08-23  156

    说下Centos6和Centos7开机自动启动服务简单方法,我是采用yum install直接安装的,所以和自编译的方法有所不同,在这里只说rpm包安装后的自启动服务的方法;

    Centos6:对于Centos6系统来说,直接使用chkconfig命令即可。

    例如我们以nginx服务为例:

    #chkconfig --add nginx 添加nginx服务

    #chkconfig nginx on 开机自启nginx服务

    #chkconfig nginx off 关闭开机自启

    #chkconfig --list | grep nginx 查看

    Centos7:对于Centos7系统来说,直接使用enable即可。

    示例:

    #systemctl enable nginx.service 开机自启nginx服务

    #systemctl disable nginx.service 关闭开机自启

    这里只是以nginx作为一个例子,当然也适用于其他服务。
    最新回复(0)