首页

在linux系统centos环境下安装nexus服务并配置开机自动启动详情步骤

标签:nexus安装,配置nexus,RUN_AS_USER,wrapper.conf     发布时间:2018-10-21   

一、前言

centos系统linux环境下安装部署nexus-2.4.0-09,并设置为开机自动启动服务,详细安装配置参见下面操作步骤,另外两方面注意点:

1. ./nexus start启动提示"If you insist running as root, then set the environment variable RUN_AS_USER=root"(参见操作步骤4)

[root@centos6 bin]# ./nexus start@b@****************************************@b@WARNING - NOT RECOMMENDED TO RUN AS ROOT@b@****************************************@b@If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.

2. chkconfig添加nexus服务提示"nexus 服务不支持 chkconfig"(步骤6,粘贴/etc/init.d/nexus内容中必须"#chkconfig:2345 20 90")

[root@centos6 conf]# chkconfig  --add  nexus@b@nexus 服务不支持 chkconfig @b@[root@centos6 conf]# chkconfig --add /etc/init.d/nexus@b@nexus 服务不支持 chkconfig

二、操作步骤

1. 下载解压nexus-2.4.0-09版本

2. 确认是否安装java环境(参见其他文章进行安装配置jdk

3. 修改nexus/bin/jsw/conf/wrapper.conf 配置为安装路径指定具体java路径(wrapper.java.command=/home/app/jdk7/bin/java)

[root@centos6 init.d]# vi  /home/app/nexus/nexus-2.4.0/bin/jsw/conf/wrapper.conf @b@...@b@# Set the JVM executable @b@# (modify this to absolute path if you need a Java that is not on the OS path)@b@#wrapper.java.command=java@b@wrapper.java.command=/home/app/jdk7/bin/java @b@...

4. 修改nexus/bin/nexus的RUN_AS_USER=root(否则提示"If you insist running as root.. RUN_AS_USER=root ...")

vi  /home/app/nexus/nexus-2.4.0/bin/nexus@b@...@b@@b@# NOTE - This will set the user which is used to run the Wrapper as well as@b@#  the JVM and is not useful in situations where a privileged resource or@b@#  port needs to be allocated prior to the user being changed.@b@#RUN_AS_USER=@b@RUN_AS_USER=root@b@@b@...

5. 启动测试

[root@centos6 init.d]# cd /home/app/nexus/nexus-2.4.0/bin@b@[root@centos6 bin]# ./nexus  start@b@****************************************@b@WARNING - NOT RECOMMENDED TO RUN AS ROOT@b@****************************************@b@Starting Nexus OSS...@b@Started Nexus OSS.@b@[root@centos6 bin]#

6. 配置开机启动

[root@centos6 etc]#vi  /etc/init.d/nexus

粘贴下面内容(export JAVA_HOME=、/home/app/nexus/nexus-2.4.0根据实际环境进行替换)

#!/bin/sh@b@#chkconfig:2345 20 90@b@#description:nexus@b@#processname:nexus@b@@b@export JAVA_HOME=/home/app/jdk7@b@@b@case $1 in@b@        start) su root /home/app/nexus/nexus-2.4.0/bin/nexus start;;@b@        stop) su root /home/app/nexus/nexus-2.4.0/bin/nexus stop;;@b@        status) su root /home/app/nexus/nexus-2.4.0/bin/nexus status;;@b@        restart) su root /home/app/nexus/nexus-2.4.0/bin/nexus restart;;@b@        dump) su root /home/app/nexus/nexus-2.4.0/bin/nexus dump ;;@b@        console) su root /home/app/nexus/nexus-2.4.0/bin/nexus console ;;@b@        *) echo "require console | start | stop | restart | status | dump " ;;@b@esac
[root@centos6 init.d]# chmod +x  nexus@b@[root@centos6 init.d]# chkconfig  --add  nexus@b@[root@centos6 init.d]# chkconfig  --list  nexus@b@nexus           0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭@b@[root@centos6 init.d]# service  nexus  status@b@****************************************@b@WARNING - NOT RECOMMENDED TO RUN AS ROOT@b@****************************************@b@Nexus OSS is running (11890).@b@[root@centos6 init.d]# service  nexus  stop@b@****************************************@b@WARNING - NOT RECOMMENDED TO RUN AS ROOT@b@****************************************@b@Stopping Nexus OSS...@b@Stopped Nexus OSS.@b@[root@centos6 init.d]# service  nexus  start@b@****************************************@b@WARNING - NOT RECOMMENDED TO RUN AS ROOT@b@****************************************@b@Starting Nexus OSS...@b@Started Nexus OSS.

7. 访问效果如下图

在linux系统centos环境下安装nexus服务并配置开机自动启动详情步骤

  • ◆ 相关内容