安装Sonatype Nexus 2即服务

时间:2017-01-04 09:54:32

标签: linux centos debian redhat nexus

我想知道如何在GNU / Linux上安装Sonatype Nexus 2作为服务,以便正确配置并在启动时自动启动。

2 个答案:

答案 0 :(得分:5)

创建具有足够访问权限的nexus用户来运行服务

useradd nexus

将$ NEXUS_HOME / bin / nexus复制到/etc/init.d/nexus 使/etc/init.d/nexus脚本可执行并由root用户拥有:

chmod 755 /etc/init.d/nexus
chown root /etc/init.d/nexus

编辑此脚本,更改以下变量:

  • 将NEXUS_HOME更改为绝对文件夹位置(例如, NEXUS_HOME ="在/ usr /本地/关系&#34)
  • 将RUN_AS_USER设置为nexus或any 具有您想要用来运行的受限权限的其他用户 服务。您不应该以root身份运行存储库管理器。
  • 将PIDDIR更改为此用户具有读/写权限的目录(例如,PIDDIR =" / home / nexus /")。如果它不存在,请创建它。

- 将存储库管理器使用的目录的所有者和组(包括在nexus.properties中配置的nexus-work默认为sonatype-work / nexus)更改为将运行该应用程序的nexus用户。

chown nexus:nexus NEXUS_HOME -R

- 如果Java不在运行存储库管理器的用户的默认路径上,请添加一个指向本地Java安装的JAVA_HOME变量,并将$ JAVA_HOME / bin添加到PATH。

在Red Hat,Fedora和CentOS上作为服务运行

此脚本具有相应的chkconfig指令,因此您需要做的就是添加存储库管理器作为服务运行以下命令:

cd /etc/init.d
chkconfig --add nexus
chkconfig --levels 345 nexus on
service nexus start
    Starting Nexus Repository Manager Pro...
tail -f NEXUS_HOME/logs/wrapper.log

第二个命令将nexus添加为要使用service命令启动和停止的服务。 chkconfig管理/etc/rc[0-6].d中的符号链接,它控制在操作系统重新启动或在运行级别之间转换时要启动和停止的服务。第三个命令将nexus添加到运行级别3,4和5. service命令启动存储库管理器,最后一个命令将wrapper.log用于验证它是否已成功启动。如果存储库管理器已成功启动,您应该会看到一条消息,通知您正在侦听HTTP。

在Ubuntu和Debian上作为服务运行

在Ubuntu上将存储库管理器设置为服务的过程与Red Hat变体上使用的过程略有不同。在/etc/init.d中配置启动脚本后,应该运行以下命令序列,而不是运行chkconfig。

cd /etc/init.d
update-rc.d nexus defaults
service nexus start
    Starting Nexus Repository Manager Pro...
tail -f NEXUS_HOME/logs/wrapper.log

答案 1 :(得分:0)

对于Nexus 2,文档位于

https://books.sonatype.com/nexus-book/reference/install-sect-service.html

对于Nexus 3,它位于

https://books.sonatype.com/nexus-book/reference3/install.html#service-linux

建议有所不同。一个例子是使用sym link

而不是复制nexus启动脚本
sudo ln -s $NEXUS_HOME/bin/nexus /etc/init.d/nexus