1 下载nexus
    下载地址:https://blog.csdn.net/u010741112/article/details/103886347
    nexus运行需要安装jdk
    2 解压
    上传至:/opt/nexus
    tar -zxvf nexus-2.11.4-01-bundle.tar.gz
    解压后的目录,这里的nexus的主目录是/opt/nexus/nexus-2.11.4-01
    3 配置环境变量
    编辑 /etc/profile 文件,在末尾加入nexus的环境变量配置,MAVEN_HOME的取值具体看实际情况解压到哪了
    #NEXUS
    export NEXUS_HOME=/opt/nexus/nexus-2.11.4-01
    export PATH=$PATH:$NEXUS_HOME/bin
    保存后重载配置文件
    source /etc/profile
    4 启动nexus
    nexus start











    图片.png
    如启动异常提示如下:
    图片.png
    则在/etc/profile 末尾添加
    export RUN_AS_USER=root
    然后修改完nexus账号密码,先关闭nexus,再启动。
    “export RUN_AS_USER=root”不可删除
    5 查看当前的状态
    nexus status
    图片.png
    6 默认访问地址是 [ip地址]:8081
    更改端口是修改文件 /opt/nexus/nexus-2.11.4-01/conf/nexus.properties
    修改application-port即可
    application-port=8081
    7 访问[ip地址]:8081,修改nexus登录账号密码
     设置账号密码:admin do{12}while(!!)
    8 其他命令
    # 停止
    nexus stop
    # 重启
    nexus reload
    9 添加开机启动
    vim /etc/init.d/nexus
    #创建jenkins启动文件,加入以下内容
    #!/bin/bash
    # chkconfig: 2345 10 90
    # description: nexus
    ###主要目的用于开机启动服务,不然 启动jenkins.war包没有java -jar的权限
    JAVA_HOME=/usr/java/jdk1.8.0_161
    pid=ps -ef | grep nexus | grep -v 'grep'| awk '{print $2}'| wc -l
    if [ “$1” = “start” ];then
    if [ $pid -gt 0 ];then
    echo ‘nexus is running…’
    else
    ### java启动服务 配置java安装根路径,和启动war包存的根路径
    nexus start
    fi
    elif [ “$1” = “stop” ];then
    exec ps -ef | grep nexus | grep -v grep | awk ‘{print $2}’| xargs kill -9
    echo ‘nexus is stop…’
    else
    echo “Please input like this:”./nexus start” or “./nexus stop””
    fi
    赋予执行权限
    chmod +x nexus
    #添加开机启动项
    #chkconfig —add nexus
    查看启动权限
    chkconfig —list nexus
    10 访问[ip地址]:8081,修改nexus登录账号密码
    This wizard will help you complete required setup tasks.
    设置账号密码:admin do{12}while(!!)