前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用 Nexus 搭建 maven 私服

使用 Nexus 搭建 maven 私服

作者头像
陳斯托洛夫斯記
发布2022-10-04 14:30:52
9840
发布2022-10-04 14:30:52
举报
文章被收录于专栏:XBD

二进制方式安装

安装 JDK 环境

下载 nexus

代码语言:javascript
复制
https://help.sonatype.com/repomanager3/product-information/download

配置 nexus

代码语言:javascript
复制
# 解压
tar zxvf nexus-3.38.1-01-unix.tar.gz -C /usr/local/

# 解压后会得到两个目录
nexus-3.38.1-01		# nexus 服务目录
sonatype-work		# 私有仓库目录

# 修改端口,默认8081
vim /usr/local/nexus-3.38.1-01/etc/nexus-default.properties
application-port=8081

# 修改运行nexus的用户
vim /usr/local/nexus-3.38.1-01/bin/nexus.rc
run_as_user="nexus"

# 修改数据目录
vim /usr/local/nexus-3.38.1-01/bin/nexus.vmoptions
-Dkaraf.data=/data/nexus	
-Djava.io.tmpdir=/data/nexus/tmp

# 禁止搜索引擎索引,减少被发现的风险
vim /usr/local/nexus-3.38.1-01/public/robots.txt
User-agent: *
Disallow: /

启动 nexus

代码语言:javascript
复制
# 使用nexus命令启动
cd /usr/local/nexus-3.38.1-01/bin
./nexus start

# 添加systemd管理nexus服务
vim /usr/lib/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nexus-3.38.1-01/bin/nexus start
ExecStop=/usr/local/nexus-3.38.1-01/bin/nexus stop
ExecReload=/usr/local/nexus-3.38.1-01/bin/nexus force-reload
User=nexus
Restart=on-abort

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl start nexus
systemctl enable nexus

访问

代码语言:javascript
复制
http://ip:8081

Docker 方式安装

代码语言:javascript
复制
docker pull sonatype/nexus3:3.38.1

mkdir /data/nexus-data
chmod -R 777 /data/nexus-data

docker run -d --name nexus3 --restart=always -p 8081:8081 -p 8082:8082 -p 8083:8083 -p 8084:8084 -p 8085:8085 -v /opt/nexus-data:/nexus-data -e INSTALL4J_ADD_VM_PARAMS="-Xms256M -Xmx512M -XX:MaxDirectMemorySize=512M  -Djava.util.prefs.userRoot=/some-other-dir" sonatype/nexus3:38.1

配置私有仓库

配置 Docker 私有仓库

创建hosted类型的docker

配置 maven 私有仓库

Create repository

创建proxy类型的maven2

配置 npm 私有仓库

创建blob存储

创建hosted类型的npm

创建proxy类型的npm

创建group类型的npm


我的博客即将同步至腾讯云开发者社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=1melm7zbxp9z9

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 二进制方式安装
    • 安装 JDK 环境
      • 下载 nexus
        • 配置 nexus
          • 启动 nexus
            • 访问
            • Docker 方式安装
            • 配置私有仓库
              • 配置 Docker 私有仓库
                • 配置 maven 私有仓库
                  • 配置 npm 私有仓库
                  相关产品与服务
                  容器镜像服务
                  容器镜像服务(Tencent Container Registry,TCR)为您提供安全独享、高性能的容器镜像托管分发服务。您可同时在全球多个地域创建独享实例,以实现容器镜像的就近拉取,降低拉取时间,节约带宽成本。TCR 提供细颗粒度的权限管理及访问控制,保障您的数据安全。
                  领券
                  问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档