当前位置:网站首页>Mavn 搭建 Nexus 私服
Mavn 搭建 Nexus 私服
2022-07-02 11:56:00 【云计算-Security】
一、目的
有时候 Java 开发在构建项目的时候,由于存在一些依赖关系会把整体项目都进行构建,这样一来 Jenkins 构建就非常慢,四五分钟才能构建完成。于是可以搭建 Mavn 私服 Nexus,开发将公用的 jar 包先上传到 Nexus,这样在构建的时候不需要额外的构建,从而提高 Jenkins 构建性能。
二、部署
1、下载
Nexus 版本:3.x
Nexus 安装包下载链接:https://help.sonatype.com/repomanager3/product-information/download

2、解压
[[email protected] ~]# tar xzf nexus-3.39.0-01-unix.tar.gz
3、配置
配置 JDK 路径:
[[email protected] ~]# cd nexus-3.39.0-01/bin/
[[email protected] bin]# cat nexus
...
# Uncomment the following line to override the JVM search sequence
# INSTALL4J_JAVA_HOME_OVERRIDE=
# Uncomment the following line to add additional VM parameters
# INSTALL4J_ADD_VM_PARAMS=
INSTALL4J_JAVA_HOME_OVERRIDE=/opt/jdk
...
修改 JVM 堆大小(默认为 2703M):根据实际情况修改
[[email protected] ~]# cd nexus-3.39.0-01/bin/
[[email protected] bin]# cat nexus.vmoptions
...
-Xms512m
-Xmx512m
...
修改默认端口(默认为 8081):
[[email protected] ~]# cd nexus-3.39.0-01/etc/
[[email protected] etc]# cat nexus-default.properties
...
application-port=8181
application-host=0.0.0.0
...
4、启动
[[email protected] ~]# cd nexus-3.39.0-01/bin/
# 此启动为后台启动
[[email protected] bin]# ./nexus start
WARNING: ************************************************************
WARNING: Detected execution as "root" user. This is NOT recommended!
WARNING: ************************************************************
Starting nexus
# 停止
# [[email protected] bin]# ./nexus stop
# 重启
# [[email protected] bin]# ./nexus restart
# 前台启动(打印日志)
# [[email protected] bin]# ./nexus run
5、访问
http://139.198.105.50:8181/

点击右上角 Sign in 登录
用户名:admin
密码:find 找一下(一般与 Nexus 的解压文件处于同一级目录下)
[[email protected] bin]# find / -name "admin.password" /root/sonatype-work/nexus3/admin.password [[email protected] ~]# cd /root/sonatype-work/nexus3/ [[email protected] nexus3]# cat admin.password 4649fc72-d96b-44a5-93eb-e7101db22072
输入初始密码后会提示你设置新密码:

最后进入web页面:

至此,Nexus 安装完成!!后续就是一些点点点的操作。
三、FAQ
1、JDK 版本问题
# 当前版本11.X
[[email protected] opt]# java -version
java version "11.0.2" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)
# 启动报错(说JDK版本必须是1.8.X)
[email protected] bin]# ./nexus start
No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be 1.8.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
2、解决方案
降低 JDK 版本为 1.8.X 即可解决该问题。
[[email protected] opt]# wget https://mirrors.tuna.tsinghua.edu.cn/AdoptOpenJDK/8/jdk/x64/linux/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz
[[email protected] opt]# tar xzf OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz
# 将原来JDK家目录mv备份
[[email protected] opt]# mv /opt/jdk /opt/jdk.bak
# 经1.8.X版本mv改名为JDK即可
[[email protected] opt]# mv jdk8u322-b06/ jdk
# 再看看当前JDK版本(已经降下来了)
[[email protected] opt]# java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (Temurin)(build 25.322-b06, mixed mode)
边栏推荐
- C语言习题---(数组)
- Find the maximum inscribed circle of the contour
- 使用mathtype编辑公式,复制粘贴时设置成仅包含mathjax语法的公式
- LeetCode 2310. 个位数字为 K 的整数之和
- Onnx+tensorrt: write preprocessing operations to onnx and complete TRT deployment
- IE 浏览器正式退休
- Simple verification code generator for 51 single chip microcomputer experiment
- STM32库函数进行GPIO初始化
- 富文本编辑器添加矢量公式(MathType for TinyMCE ,可视化添加)
- 广州市应急管理局发布7月高温高湿化工安全提醒
猜你喜欢

btrace-(字节码)动态跟踪工具

电脑怎么设置扬声器播放麦克风的声音

fatal: unsafe repository is owned by someone else 的解决方法

Add vector formula in rich text editor (MathType for TinyMCE, visual addition)

关于网页中的文本选择以及统计选中文本长度

Implement a server with multi process concurrency

.NET Core 日志系统

LeetCode 2320. Count the number of ways to place the house

富文本编辑器添加矢量公式(MathType for TinyMCE ,可视化添加)

forEach的错误用法,你都学废了吗
随机推荐
广州市应急管理局发布7月高温高湿化工安全提醒
求轮廓最大内接圆
为什么只会编程的程序员无法成为优秀的开发者?
MFC console printing, pop-up dialog box
threejs的控制器 立方體空間 基本控制器+慣性控制+飛行控制
[QNX Hypervisor 2.2用户手册]6.3 Guest与外部之间通信
buuctf-pwn write-ups (7)
MFC A对话框调用B对话框函数并传参
Implement a server with multi process concurrency
4. Array pointer and pointer array
记一次报错解决经历依赖重复
[development environment] install the visual studio community 2013 development environment (download the installation package of visual studio community 2013 with update 5 version)
threejs的控制器 立方体空间 基本控制器+惯性控制+飞行控制
实现一个多进程并发的服务器
taobao. trade. memo. Add (add remarks to a transaction) interface, Taobao store flag insertion interface, Taobao order flag insertion API interface, oauth2.0 interface
2、const 型指针
Dragonfly low code security tool platform development path
一张图彻底掌握prototype、__proto__、constructor之前的关系(JS原型、原型链)
Error: NPM warn config global ` --global`, `--local` are deprecated Use `--location=global` instead.
C code audit practice + pre knowledge