在使用nexus搭建了私服以后,经常会遇到服务器重启需要再手动启动nexus服务的情况,很不方便。于是搜集了将nexus设置成系统sytemd
服务的方法,可以开机自启。
操作系统版本:CentOS Linux release 7.6.1810 (Core)
首先需要确认nexus的安装目录,这里使用的目录为/home/nexus/nexus-2.13.0-01
,权限配置为nexus用户所有。
在/usr/lib/systemd/system/
目录下,创建nexus.service
文件,文件内容如下:
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
ExecStart=/home/nexus/nexus-2.13.0-01/bin/nexus start
ExecStop=