[原创实践]redhat linux 5.3搭建Nexus

1:下载安装JDK,配置好环境变量(JAVA_HOME等)

下载linux下64位的jdk-7u45-linux-x64.tar.gz(百度网盘下载,官网的jdk-7u51-linux-x64.tar.gz总是下载失败),上传到/tmp目录下。

cd  /opt/app/jdk/64/

tar -zxvf  jdk-7u45-linux-x64.tar.gz -C /opt/app/jdk/64/

修改`/.bash_profile


export JAVA_HOME=/opt/app/jdk/64/jdk1.7.0_45
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

执行 source ~/.bash_profile

使配置文件立即生效。

验证安装成功可执行echo $JAVA_HOME

java -version

2:Maven安装。

(1)maven官网下载apache-maven-3.1.1-bin.tar.gz,上传到linux服务器的/opt/tmp目录下。

(2)建立/opt/app/maven目录

(3)安装maven,其实就是解压缩到目录
cd /tmp
tar -zxvf  apache-maven-3.1.1-bin.tar.gz -C /opt/app/maven/
hotel用户下配置环境变量,编辑.bash_profile文件,添加如下代码
export MAVEN_HOME=/opt/app/maven/apache-maven-3.1.1
export PATH=${PATH}:${MAVEN_HOME}/bin

执行
source ~/.bash_profile

使配置文件立即生效。

验证安装成功可执行mvn -version

3:nexus的安装

下载nexus-2.7.2-03-bundle.tar.gz

建立/opt/app/nexus目录
cd /tmp
tar -zxvf  nexus-2.7.2-03-bundle.tar.gz -C /opt/app/nexus/
cd /opt/app/nexus/nexus-2.7.2-03/bin/

执行./nexus  start,在日志文件中/opt/app/nexus/nexus-2.7.2-03/logs/wrapper.log发现错误

wrapper  | --> Wrapper Started as Daemon
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    |
jvm 1    | Java HotSpot(TM) Client VM warning: You have loaded library /opt/app/nexus/nexus-2.7.2-03/bin/jsw/lib/libwrapper-linux-x86-32.so which might have disabled stack guard. The VM will try to fix the stack guard now.
jvm 1    | It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
jvm 1    |
jvm 1    | WARNING - Unable to load the Wrapper's native library 'libwrapper-linux-x86-32.so'.
jvm 1    |           The file is located on the path at the following location but
jvm 1    |           could not be loaded:
jvm 1    |             /opt/app/nexus/nexus-2.7.2-03/bin/jsw/lib/libwrapper-linux-x86-32.so
jvm 1    |           Please verify that the file is readable by the current user
jvm 1    |           and that the file has not been corrupted in any way.
jvm 1    |           One common cause of this problem is running a 32-bit version
jvm 1    |           of the Wrapper with a 64-bit version of Java, or vica versa.
jvm 1    |           This is a 32-bit JVM.
jvm 1    |           Reported cause:
jvm 1    |             /opt/app/nexus/nexus-2.7.2-03/bin/jsw/lib/libwrapper-linux-x86-32.so: /opt/app/nexus/nexus-2.7.2-03/bin/jsw/lib/libwrapper-linux-x86-32.so: cannot restore segment prot after reloc: 权限不够 jvm 1    |           System signals will not be handled correctly.
jvm 1    |
jvm 1    | 2014-04-08 17:52:58 INFO  [WrapperListener_start_runner] - org.sonatype.nexus.bootstrap.jsw.JswLauncher - Starting with arguments: [./conf/jetty.xml]
jvm 1    | 2014-04-08 17:52:58 ERROR [WrapperListener_start_runner] - org.sonatype.nexus.bootstrap.jsw.JswLauncher - Failed to start
jvm 1    | java.lang.NullPointerException: null
jvm 1    |  at org.sonatype.nexus.bootstrap.jsw.JswLauncher.doStart(JswLauncher.java:53) ~[nexus-bootstrap-2.7.2-03.jar:2.7.2-03]
jvm 1    |  at org.sonatype.nexus.bootstrap.jsw.WrapperListenerSupport.start(WrapperListenerSupport.java:37) ~[nexus-bootstrap-2.7.2-03.jar:2.7.2-03]
jvm 1    |  at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788) [wrapper-3.2.3.jar:3.2.3]
wrapper  | <-- Wrapper Stopped

root用户下

/etc/selinux/config SELINUX=enforcing 改成 SELINUX=disabled

hotel用户执行

chcon -t texrel_shlib_t /opt/app/nexus/nexus-2.7.2-03/bin/jsw/lib/libwrapper-linux-x86-32.so

./nexus  start

验证启动是否成功:

lsof -i:8081

访问地址:

http://172.22.15.113:8081/nexus

admin /admin123

 

修改端口号

 /opt/app/nexus/nexus-2.7.2-03/conf/nexus.properties

application-port=8081改成

application-port=9002

./nexus  stop

./nexus  start

http://172.22.15.113:9002/nexus

原文地址:https://www.cnblogs.com/tbyang/p/3654043.html