美文网首页
Nexus Install and configure

Nexus Install and configure

作者: 水平号 | 来源:发表于2021-01-02 15:31 被阅读0次

    一,安装Nexus

    安装java, nexus要求特定的JAVA版本

    下载JAVA RPM包

    https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

    rpm -ivh jdk-8u271-linux-x64.rpm
    
    
    
    vim /etc/profile
    
    export JAVA_HOME=/usr/java/jdk1.8.0_271-amd64
    export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    export PATH=$PATH:$JAVA_HOME/bin
    
     source /etc/profile
    
    
    
    java -version
    
    javac -version
    

    安装nexus

    tar -zxvf nexus-3.28.1-01-unix.tar.gz -C /home/nexus
    
    
    
    vim /home/nexus/nexus-3.28.1-01/bin/nexus
    
     INSTALL4J_JAVA_HOME_OVERRIDE=/usr/java/jdk1.8.0_271-amd64
    
    ./nexus start
    

    如果JAVA版本不对,会出现如下提示:

    No suitable Java Virtual Machine could be found on your system.
    The version of the JVM must be at least 1.8 and at most 1.8.
    Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
    

    检查NEXUS是否运行

    
    ps -ef |grep nexus
    
    netstat -natp |grep 8081
    

    二,Nexus加入服务并自启动

    CentOS7配置nexus开机自启动

    新建nexus启动脚本

    进入/etc/init.d目录,新建脚本文件nexus

    进入/etc/init.d
    [root@linux_maven etc]# cd /etc/init.d/

    新建脚本文件nexus
    [root@linux_maven init.d]# vim nexus

    脚本内容:

    #!/bin/bash
    #chkconfig:2345 20 90
    #description:nexus
    #processname:nexus
     
    export JAVA_HOME=/usr/java/jdk1.8.0_271-amd64
     
    case $1 in
            start) su root /usr/local/nexus3.21/bin/nexus start;;
            stop) su root /usr/local/nexus3.21/bin/nexus stop;;
            status) su root /usr/local/nexus3.21/bin/nexus status;;
            restart) su root /usr/local/nexus3.21/bin/nexus restart;;
            dump) su root /usr/local/nexus3.21/bin/nexus dump;;
            console) su root /usr/local/nexus3.21/bin/nexus console;;
            *) echo "Usage: nexus {start|stop|run|run-redirect|status|restart|force-reload}"
    esac
    

    设置脚本权限

    chmod +x /etc/init.d/nexus 
    

    使用service命令使用nexus

     service nexus status
    WARNING: ************************************************************ 
    WARNING: Detected execution as "root" user.  This is NOT recommended!
    WARNING: ************************************************************
    nexus is running.
    
    

    添加到开机启动

     chkconfig nexus on
    

    查看nexus开机启动

    [root@linux_maven ~]# chkconfig --list nexus
     
    Note: This output shows SysV services only and does not include native
          systemd services. SysV configuration data might be overridden by native
          systemd configuration.
     
          If you want to list systemd services use 'systemctl list-unit-files'.
          To see services enabled on particular target use
          'systemctl list-dependencies [target]'.
     
    nexus           0:off   1:off   2:on    3:on    4:on    5:on    6:off
    

    启动nexus

    ps -ef |grep nexus |xargs kill -9
    
    service start nexus
    

    三,配置LDAP(AD)认证

    image.png
    image.png
    LDAP server address
    used  AD server
    
    search base DN:
    dc=fj,dc=com
    
    username or DN:
    AD管理员权限帐号
    
    image.png
    image.png
    image.png

    至此完成安装,并配置使用LDAP认证。

    相关文章

      网友评论

          本文标题:Nexus Install and configure

          本文链接:https://www.haomeiwen.com/subject/dyueoktx.html