Linux 搭建nexus私服

1、nexus下载

    可以去nexus官网下载,我下载的是nexus-2.13.0-01-bundle.tar

2、nexus的安装

    确保已经安装maven

    将下载的nexus解压至/usr/local下

    tar -xvf nexus-2.13.0-01-bundle.tar

    建立链接

    ln -s nexus-2.13.0-01 nexus

3、将nexus设置为系统服务,并配置开机自启动

    cd /etc/init.d

    cp /usr/local/nexus/bin/nexus ./nexus

    chmod 755 nexus

    增加nexus服务

    chkconfig —add nexus

    chkconfig —levels 234 nexus on

4、修改

    在对配置步修改的情况下,可能会遇到以下的问题:

    1、If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.

    2、Missing platform binary: /etc/rc.d/init.d/../bin/jsw/linux-x86-64/wrapper

    其他的问题我没有遇到

    修改配置

    vim /etc/init.d/nexus

1
2
3
4
RUN_AS_USER=root
NEXUS_HOME= "/usr/local/nexus"
PLATFORM=linux-x86-64
PLATFORM_DIR="${NEXUS_HOME} /bin/jsw/ ${PLATFORM}”

5、启动Nexus

    service nexus start

    访问http://ip:8081/nexus

    默认管理员用户名/密码: admin/admin123

    

6、配置

    

7、项目使用nexus的maven配置

        首先在nexus下创建用户,使其拥有Nexus Deployment Role和Nexus Full Respositroies(Full Controll)这两个权限。

        userId将在下面的配置中用到

        以下是maven的settings.xml中用到



 
    /Users/local/repo
 
    
        
            jikefriend-releases
            userId
            userId
        
        
            jikefriend-snapshots
            userId
            userId
        
    
 
    
        
 
            dev
            
                true
            
 
            
                
                    nexus
                    http://ip:8081/nexus/content/groups/public/
                    
                        true
                    
 
                    
                        true
                        always
                        warn
                    
                
            
 
            
                
                    nexus
                    http://ip:8081/nexus/content/groups/public/
                    
                        true
                    
 
                    
                        true
                        always
                        warn
                    
                
            
 
        
    
 

同时在pom.xml中加入以下内容


  
    nexus
    nexus
    http://ip:8081/nexus/content/groups/public/
    
      true
    
    
      true
    
  


  
    jikefriend-releases
    Nexus Release Repository
    http://ip:8081/nexus/content/repositories/releases/
  
  
    jikefriend-snapshots
    Nexus Snapshot Repository
     http://ip:8081/nexus/content/repositories/snapshots/
  


  
    nexus
    nexus
    http://ip:8081/nexus/content/groups/public/
    
      true
    
    
      true
    
  

你可能感兴趣的:(Linux)