沃梦达 / 编程技术 / 服务器 / 正文

CentOS下Maven私服nexus搭建

环境版本:OS:CentOS release 6.5 (Final)Jdk:jdk-7u79-linux-x64.tar.gzMaven:apache-maven-3.5.0-bin.tar.gzNexus:nexus-2.14.4-03-bundle.tar.gz1.安装jdk# tar zxf jdk-7u79-linux-x64.tar.gz # mkdir -pv /...

环境版本:

OS:CentOS release 6.5 (Final)

Jdk:jdk-7u79-linux-x64.tar.gz

Maven:apache-maven-3.5.0-bin.tar.gz

Nexus:nexus-2.14.4-03-bundle.tar.gz

1.安装jdk

# tar zxf jdk-7u79-linux-x64.tar.gz

# mkdir -pv /usr/local/java

# mv jdk1.7.0_79 /usr/local/java

# java -version

java version "1.7.0_45"

OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)

OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

# alternatives --install /usr/bin/java java /usr/local/java/jdk1.7.0_79/bin/java 2

# alternatives --config java

 

There are 3 programs which provide 'java'.

  Selection    Command

-----------------------------------------------

*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java

   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

   3           /usr/local/java/jdk1.7.0_79/bin/java

Enter to keep the current selection[+], or type selection number: 3   

 

# alternatives --install /usr/bin/jar jar /usr/local/java/jdk1.7.0_79/bin/jar 2

# alternatives --install /usr/bin/javac javac /usr/local/java/jdk1.7.0_79/bin/javac 2

# vi /etc/profile

export JAVA_HOME=/usr/local/java/jdk1.7.0_79

export JRE_HOME=/usr/local/java/jdk1.7.0_79/jre

export PATH=$PATH:/usr/local/java/jdk1.7.0_79/bin:/usr/local/java/jdk1.7.0_79/jre/bin

# source /etc/profile

# java -version

java version "1.7.0_79"

2.安装maven

# tar zxvf apache-maven-3.5.0-bin.tar.gz

# mkdir /usr/local/maven

# cp -ar apache-maven-3.5.0/. /usr/local/maven

# vi /etc/profile

export MAVEN_HOME=/usr/local/maven

export PATH=${MAVEN_HOME}/bin:${PATH}

# source /etc/profile

# mvn -v

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)

Maven home: /usr/local/maven

Java version: 1.7.0_79, vendor: Oracle Corporation

Java home: /usr/local/java/jdk1.7.0_79/jre

Default locale: en_US, platform encoding: UTF-8

OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"

3.安装nexus

# mkdir -pv /usr/local/nexus

# tar -xzvf nexus-2.14.4-03-bundle.tar.gz -C /usr/local/nexus

# cp /usr/local/nexus/nexus-2.14.4-03/bin/nexus /etc/init.d/nexus2

# chkconfig --add nexus2

# chkconfig nexus2 on

# vi /etc/init.d/nexus2

修改NEXUS_HOME值:

NEXUS_HOME=/usr/local/nexus/nexus-2.14.4-03

修改RUN_AS_USER值:

RUN_AS_USER=root

# vi nexus.properties  //查看配置是否需要修改<参见附录2>

# /etc/init.d/nexus2 start

# /etc/init.d/nexus2 stop

附录:

1.确认Nexus2启动时候的jdk版本:wrapper.java.command 设置为 java的真实路径

vi /usr/local/nexus/nexus-2.14.4-03/bin/jsw/conf/wrapper.conf

2.确认Nexus2监听的端口以及仓库存储位置:application-port设置为8081,nexus-work设置为${bundleBasedir}/../sonatype-work/nexus

vi /usr/local/nexus/nexus-2.14.4-03/conf/nexus.properties

3.Nexus私服仓库备份:

名称

目录名

重要配置文件

nexus主目录

/usr/local/nexus/nexus-2.14.4-03

conf/nexus.properties里面有sonatype-work的地址

sonatype-work目录

/usr/local/nexus/sonatype-work

nexus/conf/nexus.xml里面有storage的地址

storage目录

/usr/local/nexus/sonatype-work/nexus/storage

里面主要是各种程序的jar包等

通常只备份sonatype-work目录:

tar -zcvpf sonatype-work-$(date +%Y%m%d%H%m)-pc.tar.gz sonatype-work


本文标题为:CentOS下Maven私服nexus搭建

上一篇: Centos安装JDK

基础教程推荐