Cent OS 7.x 下 Nexus 3.x 添加开机启动

  • 安装nexus,这里就不赘述,本文主要讲述开机启动项配置
    1.vim 打开 nexus 入口程序文件
    Cent OS 7.x 下 Nexus 3.x 添加开机启动
    2.配置JDK目录,原本是注释了的,需要放开进行配置,保存退出
    Cent OS 7.x 下 Nexus 3.x 添加开机启动
    3.创建nexus服务配置文件
    vim /etc/systemd/system/nexus.service
    Cent OS 7.x 下 Nexus 3.x 添加开机启动
    输入以下内容,红色部分自行调整
    Cent OS 7.x 下 Nexus 3.x 添加开机启动
    [Unit]
    Description=nexus service
    After=network.target

    [Service]
    Type=forking
    LimitNOFILE=65536
    ExecStart=/usr/local/nexus/nexus-3.9.0-01/bin/nexus start
    ExecStop=/usr/local/nexus/nexus-3.9.0-01/bin/nexus stop
    User=nexus
    Restart=on-abort

    [Install]
    WantedBy=multi-user.target

4.刷新 系统配置文件,开启自启动

sudo systemctl daemon-reload // 刷新配置
sudo systemctl enable nexus.service //设置自启动
sudo systemctl start nexus.service //启动服务