nexus3.X本地私有化安装及其介绍

nexus3.X本地私有化安装

nexus3.x介绍

Sonatype Nexus 3 软件仓库服务器,它既是一个私有软件仓库服务器,又可以作为代理和缓存服务器从公共的软件仓库获取内容。

官网地址:https://www.sonatype.com/products/sonatype-nexus-oss-download。页面注册一下既可以下载软件。

Nexus 3相对其他软件或nexus 2在支持私服仓库类型更多了。其中包含:maven、conda、docker、go、helm、npm、pypi、yum等,可以将主流的开发语言都包含,开源版本既有丰富的权限管理等。

部署安装

下载并上传

cd /app
mkdir nexus3
tar -zxvf nexus-3.60.0-02-unix.tar.gz

如果你需要普通用户

useradd nexus
passwd nexus  #密码也时nexus
chown -R nexus:nexus /app/nexus3
su nexus  #切换用户

修改配置文件

cd /app/nexus3/nexus-3.60.0-02/etc/
vim nexus-default.properties

可以设置你的端口和访问路径。

开始启动

cd /app/nexus3/nexus-3.60.0-02/bin/
./nexus run #在前台启动Nexus服务
./nexus start  #在后台启动Nexus服务
./nexus status #查看Nexus运行状态
./nexus stop  #停止后台的Nexus服务
./nexus restart #重新启动后台的Nexus服务

查看密码: cat /app/nexus3/sonatype-work/nexus3/admin.password

设置开机启动(可以最后配置)

新建服务脚本 vim /etc/init.d/nexus

#chkconfig:2345 20 90
#description\:nexus
#processname\:nexus
export JAVA\_HOME=/usr/local/jdk1.8.0_60

case \$1 in
start) su root /app/nexus3/nexus-3.60.0-02/bin/nexus start;;
stop) su root /app/nexus3/nexus-3.60.0-02/bin/nexus stop;;
status) su root /app/nexus3/nexus-3.60.0-02/bin/nexus status;;
restart) su root /app/nexus3/nexus-3.60.0-02/bin/nexus restart;;
dump) su root /app/nexus3/nexus-3.60.0-02/bin/nexus dump;;
console) su root /app/nexus3/nexus-3.60.0-02/bin/nexus console;;
\*) echo "Usage: nexus {start|stop|run|run-redirect|status|restart|force-reload}"
esac

给脚本执行权限 chmod 744 /etc/init.d/nexus

#启动 service nexus start

#停止 service nexus stop

#重启 service nexus restart

#查看nexus的状态 service nexus status

配置nexus服务开机自启动

#向chkconfig添加 nexus 服务的管理 chkconfig --add nexus

#设置nexus服务自启动 chkconfig nexus on

#关闭nexus服务自启动 chkconfig nexus off

#删除nexus服务在chkconfig上的管理 chkconfig –del nexus

开始登陆使用

查看密码: cat /app/nexus3/sonatype-work/nexus3/admin.password

Repositories和Blob Stores的设置和建议

Repositories是配置仓库的分三种类型

hosted:本地私服仓库,也就是我们自己开发的jar包等上传到这里。可以建多个,分snapshots版本和releases版本

proxy:代理的地址,例如将maven阿里云的仓库代理到这里,并将使用到的包缓存到这里,以后再使用已经有的包时不会再从阿里云上下载了。

group:是将hosted+proxy合在一起代理,并可以对外提供仓库服务。

Blob Stores是仓库存储位置

这里建议每一个hosted都需要建一个Store。每一个proxy也都需要建一个Store,每一个group也都需要建一个Store

nexus代理的实例

maven仓库

代理阿里云的maven仓库

阿里云仓库地址是:http://maven.aliyun.com/nexus/content/groups/public

代理npm

如果你连网的话你的地址可以写 http://registry.npm.taobao.org/

如果你是内网需要开可以访问的网址的话,remote的地址需要写成 :http://registry.npmmirror.com 因为又被代理了一层

代理yum源

你的remote地址需要写 :https://mirrors.aliyun.com/centos/

其他的地址可以参考阿里云官网 https://developer.aliyun.com/mirror/?spm=a2c6h.13651102.0.0.7f8b1b11l4vRbD&serviceType=mirror

代理和本地仓库对外提供服务

新建一个 group类型的仓库,这里以yum为例,其他maven、npm也是一样的.

选择好新建的Store。在将需要的仓库添加到group的成员仓库中即可。

角色的设定

新建角色,填写基本的角色名称和信息,并将想赋予权限的仓库添加到该角色下即可。

用户权限

在用户中可以添加对应的角色信息,角色下有的仓库权限,该用户就有了该仓库的权限。

更过内容请关注

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

哈尔日记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值