Ubuntu 安装 Maven 私服 Nexus

下载安装包并解压

Nexus 现在是有社区版和 pro 版的区别的,社区版(制品数限制、每天的请求数限制、高级功能没有)对于个人和小型团队是够用的。

打开下载页面:https://help.sonatype.com/en/download.html

选择 Linux 版本的下载:

将下载的压缩包上传到 Ubuntu 机器上,你也可以直接在 Ubuntu 机器上通过 wget 指定 Nexus 的下载链接进行下载安装包:

shell 复制代码
wget https://download.sonatype.com/nexus/3/nexus-3.84.1-01-linux-x86_64.tar.gz

新建一个 nexus 的安装目录,将 Nexus 解压到这个安装目录:

shell 复制代码
cd /opt/module
mkdir nexus-3.84.1
tar -zxvf /opt/software/nexus-3.84.1-01-linux-x86_64.tar.gz -C /opt/module/nexus-3.84.1

解压完成后,在我的 Nexus 安装目录下生成了两个目录:

nexus-3.84.1-01 (不同版本这个目录名会和版本保持一致)是运行文件安装的目录,snatype-work 是 Nexus 的运行时目录。

修改 Nexus 配置

为避免 Nexus 与其他服务端口冲突,建议修改 Nexus 的运行端口为:18081,修改安装目录下目录名为 Nexus 版本的目录中的 etc/default-application.properties 这个配置文件:

shell 复制代码
application-port=18081

启动 Nexus

启动和停止相关命令如下(Nexus 不推荐使用 root 用户执行这些命令):

命令 作用
./bin/nexus start 后台启动 Nexus
./bin/nexus run 前台启动 Nexus
./bin/nexus stop 停止 Nexus
./bin/nexus restart 重启 Nexus 服务
./bin/nexus force-reload 重新加载配置文件
./bin/nexus status 查看 Nexus 状态

查看 Nexus 的 Web 页面

我自己的 Nexus 的访问地址是:http://node73:18081/,大家自己根据自己的 ip 或域名访问。

打开之后,就是这个样子的:

点击右上角的用户头像进行登录,弹出登录框,它告诉你了 admin 用户的密码在哪个文件中:

在文件中找到密码登录后,重新修改密码:

同意协议后,选择不能匿名访问:

可能会遇到的问题

存储空间不足

java 复制代码
com.orientechnologies.orient.core.exception.OLowDiskSpaceException: Error occurred while executing a write operation to database 'OSystem' due to limited free space on the disk (3436 MB). The database is now working in read-only mode. Please close the database (or stop OrientDB), make room on your hard drive and then reopen the database. The minimal required space is 4096 MB. Required space is now set to 4096MB (you can change it by setting parameter storage.diskCache.diskFreeSpaceLimit)

修改文件存储空间上限,在nexus-3.84.1-01/bin/nexus.vmoptions 中添加 storage.diskCache.diskFreeSpaceLimit 参数的配置:

shell 复制代码
-Dkaraf.base=.
-Djava.util.logging.config.file=etc/spring/java.util.logging.properties
-Dkaraf.data=../sonatype-work/nexus3
-Dkaraf.log=../sonatype-work/nexus3/log
-Djava.io.tmpdir=../sonatype-work/nexus3/tmp
-Djdk.tls.ephemeralDHKeySize=2048
-Dfile.encoding=UTF-8
-Dstorage.diskCache.diskFreeSpaceLimit=2048
相关推荐
想你依然心痛1 天前
从监控数据到告警管理:Prometheus与Alertmanager部署实战
ubuntu·prometheus·内网穿透·系统监控·cpolar·告警管理
黑白园2 天前
解决服务器拒绝连接导致ubuntu镜像无法下载问题 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/
ubuntu
青石路2 天前
记一次Qoder排查mave-shade-plugin只重定向部分package导致的NoSuchMethodError问题,查的还挺快的
java·maven
yangpan0112 天前
ubuntu输入法安装及选择
linux·运维·ubuntu
强里秋千墙外道2 天前
Ubuntu 开机 Kernel Panic:HWE 内核升级失败 + NVIDIA DKMS 踩坑实录
linux·运维·ubuntu
啊啊啊迈 旋棍2 天前
【译】TypeScript 7 测试版已在 Visual Studio 2026 18.6 Insiders 3 中默认启用
ubuntu·typescript·visual studio
Eloudy2 天前
ubuntu 22.04安装 cuda 12.8.2
linux·运维·ubuntu
奶糖 肥晨2 天前
mac系统中Java项目环境配置与问题解决全记录|环境准备篇:JDK与Maven安装配置
java·macos·maven
接针3 天前
Pycharm远程连接Ubuntu的conda环境
ubuntu·pycharm·conda
漂移的电子3 天前
解决Vue3 + TypeScript + Vite搭建的项目,动态路由页面加载失败的最隐蔽原因
javascript·ubuntu·typescript