Sam's Notes | Sam Blog

梦想还是要有的,万一实现了呢

0%

Sonatype nexus

永久免费的 Sonatype Nexus Repository Manager OSS版本,
可以帮助你与其他开发人员和最终用户共享组件。它大大简化了内部存储库的维护和访问外部存储库,可以从单一地点完全控制访问和部署每个组件。
主要配合maven 和 gradle 工作。

版本 OSS 3.25.1-04

安装

前提要JRE7以上

下载

安装

主要步骤像这样滴

  • 文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ sudo cp nexus-3.25.1-04-unix.tar.gz /opt
$ cd /opt
$ sudo tar xvzf nexus-3.25.1-04-unix.tar.gz

# 增加用户 nexus
useradd nexus

ln -s nexus-3.25.1-04 nexus

# 修改nexus的权限
chown -R nexus:nexus nexus-3.25.1-04
chown -R nexus:nexus sonatype-work
chown -R nexus:nexus nexus

# 安装
cd nexus/bin
sudo -u nexus ./nexus run

  • sonatype-work

安装同级目录有sonatype-work文件夹($data-dir),用来保存 repository and configuration data;和安装文件分离,方便升级。

vim /etc/systemd/system/nexus.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Unit]
Description=nexus service
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
TimeoutSec=600

[Install]
WantedBy=multi-user.target
1
2
3
systemctl daemon-reload
systemctl enable nexus.service
systemctl start nexus.service

配置和管理

  • JVM配置
    $install-dir/bin/nexus.vmoptions

  • 主配置
    $install-dir/etc

    1
    2
    3
    4
    5
    6
    7
    ls -1 nexus-<version>/etc
    fabric
    jetty
    karaf
    logback
    nexus-default.properties
    ssl

nexus-default.properties 是模块文件,不能修改, 第一次启动后会生成 实际使用的配置 $data-dir/etc/nexus.properties

反向代理

官方文档

后台管理

  • 地址账户
    地址 :端口和context 参照 你自己配置的 $data-dir/etc/nexus.properties
    初始账户 :admin
    初始密码 :参考 /opt/sonatype-work/nexus3/admin.password

  • Repository
    参照

客户端

参照Maven配置