Centos7搭建Maven私服-Nexus3.19.1-01

一、下载软件

  1.JDK8:https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8u211-later-5573849.html 

   Nexus Repository Manager需要Java 8运行时环境(JRE)。也可以到下方网盘下载。

  2.Nexus开源版下载地址: https://www.sonatype.com/download-oss-sonatype

   需要翻墙下载,也可以到网盘下载:https://pan.baidu.com/s/10LepsaMMaerJqPZtm-lJvQ   提取码:mrwm

   

 

   

二、安装配置

  1、上传jdk-8u221-linux-x64.tar.gz并解压

  2、vi /etc/profile

   添加java环境变量

    #JAVA_HOME

    export JAVA_HOME=/usr/local/jdk1.8.0_221

    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

    export PATH=$PATH:$JAVA_HOME/bin

    保存退出 :wq

    使配置生效  source /etc/profile

    查看java版本 java -version

    

  3、上传nexus-3.19.1-01-unix.tar.gz到/usr/local/nexus/路径下并解压

    

   4、cd nexus-3.19.1-01/bin路径下,vi nexus添加环境变量

    INSTALL4J_JAVA_HOME_OVERRIDE=/usr/local/jdk1.8.0_221

    

     :wq 保存退出

   5、运行nexus

    在/usr/local/nexus/nexus-3.19.1-01/bin目录下运行./nexus start或./nexus run(注:./nexus start。这种是后台启动,./nexus run 可以看到启动日志)

    

     nexus的默认内存需要2G,如果本机内存较小的话会启动失败,提示:

    # There is insufficient memory for the Java Runtime Environment to continue.

    # Native memory allocation (mmap) failed to map 945094656 bytes for committing reserved memory.

    # An error report file with more information is saved as:

    # /tmp/hs_err_pid22397.log

    此时修改/usr/local/nexus/nexus-3.19.1-01/bin/nexus.vmoptions

    vi nexus.vmoptions

    

     :wq 保存退出

    修改端口号

    vi /usr/local/nexus/nexus-3.19.1-01/etc/nexus-default.properties

    6、访问localhost:8081

      用户名:admin

      密码:cat /usr/local/nexus/sonatype-work/nexus3/admin.password

      登录之后会提示修改密码

      

 

 

 

 三、添加阿里云maven代理

 

   填写代理库的名称和代理库的url,阿里云url:http://maven.aliyun.com/nexus/content/groups/public/

  滚动到页面最下方,点击“Create repositoty”按钮

 

   重新配置maven-public组,使其包含新建的aliyun-maven。把aliyun-maven移至右侧,并向上移至第一位。然后点击保存。

 

 四、配置maven客户端使用私服

  找到本地的中maven中的conf文件夹下的setting.xml文件

 

猜你喜欢

转载自www.cnblogs.com/guduershi/p/12028043.html
今日推荐