nexus3 配置systemd
时间: 2023-12-13 07:04:59 浏览: 208
nexus3-linux安装配置.zip
要将 Nexus3 配置为 systemd 服务,请按照以下步骤进行操作:
1. 编写 Nexus3 的 systemd 配置文件 `/etc/systemd/system/nexus.service`,内容如下:
```
[Unit]
Description=Nexus3 Service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Group=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
```
请注意,您需要将 `ExecStart` 和 `ExecStop` 中的 `/opt/nexus` 替换为您实际的 Nexus3 安装位置。
2. 执行以下命令启动 Nexus3 服务并设置开机自启:
```
systemctl daemon-reload
systemctl start nexus
systemctl enable nexus
```
3. 验证 Nexus3 是否已正常启动:
```
systemctl status nexus
```
如果 Nexus3 正常运行,则该命令的输出应该类似于下面的内容:
```
● nexus.service - Nexus3 Service
Loaded: loaded (/etc/systemd/system/nexus.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-09-10 16:18:14 UTC; 2min 14s ago
Process: 2363 ExecStop=/opt/nexus/bin/nexus stop (code=exited, status=0/SUCCESS)
Process: 2370 ExecStart=/opt/nexus/bin/nexus start (code=exited, status=0/SUCCESS)
Main PID: 2373 (java)
Tasks: 79 (limit: 1074)
CGroup: /system.slice/nexus.service
└─2373 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Dinstall4j.jvmDir=/usr/lib/jvm/java-8-openjdk-amd64/jre -Dexe4j.moduleName=/opt/nexus/bin/nexus -Dexe4j...
Sep 10 16:18:17 ubuntu1804 nexus[2370]: WrapperManager: Initializing...
Sep 10 16:18:17 ubuntu1804 nexus[2370]: --> Wrapper Started as Daemon
Sep 10 16:18:18 ubuntu1804 nexus[2370]: Java Service Wrapper Standard Edition 64-bit 3.5.43
Sep 10 16:18:18 ubuntu1804 nexus[2370]: Copyright (C) 1999-2016 Tanuki Software, Ltd. All Rights Reserved.
Sep 10 16:18:18 ubuntu1804 nexus[2370]: http://wrapper.tanukisoftware.com
Sep 10 16:18:18 ubuntu1804 nexus[2370]: Licensed to Sonatype Inc. for Nexus Repository Manager
Sep 10 16:18:18 ubuntu1804 nexus[2370]: WrapperManager: JVM #1
Sep 10 16:18:18 ubuntu1804 nexus[2370]: Running a 64-bit JVM.
Sep 10 16:18:18 ubuntu1804 nexus[2370]: WrapperManager: Registering shutdown hook
```
这样,您就已经成功地将 Nexus3 配置为 systemd 服务了。
阅读全文