16.Ubuntu16.04安装Nexus


Ubuntu16.04安装Nexus

1.准备环境

linux16.04版本

安装JDK8

2.下载安装包

官网:https://www.sonatype.com/nexus/repository-oss

下载地址:https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.29.2-02-unix.tar.gz(强烈推荐用迅雷)

根据需要自行下载

3.上传到你的linux服务器并进行解压

tar xvzf nexus-3.29.2-02-unix.tar.gz

4.启动Nexus

cd /nexus/nexus-3.29.2-02/bin/
sudo ./nexus run
其他命令:
Usage: ./nexus { console | start | stop | restart | status | dump }
启动nexus:
#./nexus start
关闭nexus:
#./nexus stop

 运行成功后,会出现

Started Sonatype Nexus OSS 3.29.2-02

 注意:如果遇到

Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.

请重新配置下jdk路径

vi /nexus/nexus-3.29.2-02/bin/nexus

5.访问nexus UI界面

6.配置为Linux Service

 编辑bin/nexus.rc

vi /nexus/nexus-3.29.2-02/bin/nexus.rc

#run_as_user=""
run_as_user="root"

注意:红色部分是用什么用户去执行

 在/etc/init.d放nexus软连接

ln -s /nexus/nexus-3.29.2-02/bin/nexus /etc/init.d/nexus

运行服务

update-rc.d 参见:https://www.cnblogs.com/EasonJim/p/7573292.html
cd /etc/init.d
chmod 755 /etc/init.d/nexus 修改权限 update
-rc.d nexus defaults  设置开启启动
service nexus start 启动服务(或者关机重启)

第一次查看密码:

 

 复制这个密码,账号:admin

 第一次登录修改密码

其他Nexus操作参考

https://www.jianshu.com/p/9740778b154f

https://blog.csdn.net/worn_xiao/article/details/79187982

解决文件最大限制问题

vi /etc/security/limits.conf 

* soft nproc 65536
* hard nproc 65536
* soft nofile 65536
* hard nofile 65536

root soft nproc 65536
root hard nproc 65536
root soft nofile 65536
root hard nofile 65536

  数字对齐

vim /etc/pam.d/common-session-noninteractive

  首行增加一行

session required pam_limits.so

 以上都是网上乱七八糟的

 这是重点,网上乱七八糟没一个好使

直接将/etc/systemd/system.conf 和 /etc/systemd/user.conf 的参数DefaultLimitNOFILE修改为65536,默认是注释的。

DefaultLimitNOFILE=65536

重启

 查看

ulimit -a

附:

1.打包上传私库配置

maven setting 文件配置

<?xml version="1.0" encoding="UTF-8"?>


  
  
  

  

  

  
  
    
  

  
  
    
  


  
  
      
        releases  
        admin  
        admin123  
      
      
        snapshots  
        admin  
        admin123  
     
	
		nexus-public
		admin
		admin123
	
  

  
  
    
        nexus-public 
        nexus public
		*
        http://192.168.88.84:8081/repository/maven-public/ 
     
	
		alimaven
		aliyun maven
		http://maven.aliyun.com/nexus/content/groups/public/
		central       
		
  

代码jar包配置

<?xml version="1.0" encoding="UTF-8"?>
"http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
        org.springframework.boot
        spring-boot-starter-parent
        2.0.6.RELEASE
        
    
    4.0.0
    com.llhu
    spring-boot-api
    spring-boot-api
    0.1.0-SNAPSHOT
    jar
    
        
            org.springframework.cloud
            spring-cloud-starter-openfeign
            true
            2.0.2.RELEASE
        
        
            org.projectlombok
            lombok
            1.18.8
        
        
            com.alibaba
            fastjson
            1.2.68
            provided
        
        
        
            io.springfox
            springfox-swagger2
            2.7.0
        
        
            io.springfox
            springfox-swagger-ui
            2.7.0
        
    
    
        
            releases
            Nexus Release Repository
            http://192.168.88.84:8081/repository/maven-releases/
        
        
            snapshots
            Nexus Snapshot Repository
            http://192.168.88.84:8081/repository/maven-snapshots/
        
    

idea 打包

仓库

 

遇到无法从私服下载jar包问题可以参考https://blog.csdn.net/huqiankunlol/article/details/103250535