如何在linux服务器上搭建npm私服 (nexus)

1安装java、maven环境

2下载nexus

官方下载太慢,这是一个免积分下载地址https://download.csdn.net/download/u010792039/12097188

3 将下载的文件提交到服务器,并解压

   命令行cd到存放压缩文件的文件夹下, 输入: tar -zvxf nexus-2.14.8-01-bundle.tar.gz   

4配置环境变量

/etc/profile中添加以下配置信息

export RUN_AS_USER=root  
#如果这里不配置,nexus启动时会出现   
#If you insist running as root ,than set the environment variable RUN_AS_USER=root before running this script 报错

然后 命令行输入:source /etc/profile   以激活配置

5 开启nexus

[root@izwz91h49n3mj8r232gqwez weblogic]# /weblogic/nexus-2.14.8-01/bin/nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.

 

6配置nexus  和maven


访问网址:http://yourhostname:8081/nexus     如果无法访问,

执行关闭防火墙命令:sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service

maven/conf/setting.xml文件配置如下









    
      
        
      nexus  
      *  
      http://你的服务器地址:8081/private/npm/  
      
    
     
  
      
      nexus  
        
        
        
          
          central  
          http://central  
          truealways  
          true  
          
          
            spring-release  
            Spring Maven Release Repository  
            http://repo.springsource.org/libs-release  
              
                false  
              
          
        
       
          
          central  
          http://central  
          truealways  
          true  
          
        
      
    
    
      
    nexus  
    
  
    
    
      
      releases  
      admin  
      admin123  
      
      
      snapshots  
      admin  
      admin123  
      
    


  

 

你可能感兴趣的:(前端,java后端)