当前位置:网站首页>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)
边栏推荐
- 2. Const pointer
- C# richTextBox控制显示最大行数
- How does CTO help the business?
- fatal: unsafe repository is owned by someone else 的解决方法
- btrace-(字节码)动态跟踪工具
- Simple verification code generator for 51 single chip microcomputer experiment
- buuctf-pwn write-ups (7)
- tmall.product.schema.get( 产品信息获取schema获取 ),淘宝店铺上传商品API接口,淘宝商品发布接口,淘宝商品上传API接口,店铺上传接口,oAuth2.0接口
- Makefile separates file names and suffixes
- C语言中的算术运算及相关练习题
猜你喜欢

vChain: Enabling Verifiable Boolean Range Queries over Blockchain Databases(sigmod‘2019)

taobao. trade. memo. Add (add remarks to a transaction) interface, Taobao store flag insertion interface, Taobao order flag insertion API interface, oauth2.0 interface

【C语言】详解指针的初阶和进阶以及注意点(1)

taobao.trade.memo.add( 对一笔交易添加备注 )接口,淘宝店铺插旗接口,淘宝订单插旗API接口,oAuth2.0接口

c语言入门--数组

LeetCode 2310. 个位数字为 K 的整数之和

MFC timer usage

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

Btrace- (bytecode) dynamic tracking tool

About text selection in web pages and counting the length of selected text
随机推荐
表格响应式布局小技巧
Ad20 cannot select the solution of component packaging in PCB editor
电脑怎么设置扬声器播放麦克风的声音
taobao.trade.memo.add( 对一笔交易添加备注 )接口,淘宝店铺插旗接口,淘宝订单插旗API接口,oAuth2.0接口
华为面试题: 没有回文串
Large top heap, small top heap and heap sequencing
buuctf-pwn write-ups (7)
871. Minimum refueling times: simple priority queue (heap) greedy question
[noi Simulation Competition] scraping (dynamic planning)
Li Chuang EDA learning notes 15: draw border or import border (DXF file)
C thread transfer parameters
CTO如何帮助业务?
.NET Core 日志系统
IE 浏览器正式退休
Makefile 分隔文件名与后缀
LeetCode 2310. The number of digits is the sum of integers of K
Error: NPM warn config global ` --global`, `--local` are deprecated Use `--location=global` instead.
taobao. logistics. dummy. Send (no logistics delivery processing) interface, Taobao store delivery API interface, Taobao order delivery interface, Taobao R2 interface, Taobao oau2.0 interface
记一次报错解决经历依赖重复
taobao. trade. memo. Add (add remarks to a transaction) interface, Taobao store flag insertion interface, Taobao order flag insertion API interface, oauth2.0 interface