linux下安装nexus-2.14.8 -01私服

一、安装、配置nexus-2.14.8-01私服

#解压 tar.gz

tar -zxvf nexus-2.14.8-01-bundle.tar.gz

#移动到/usr/local 中

mv nexus-2.14.8-01 /usr/local

mv sonatype-work/ /usr/local

# 查看、编辑配置文件

cd /usr/local/nexus-2.14.8-01

vi conf/nexus.properties # 默认配置如下,保持默认配置即可


# Jetty section
application-port=8081 #端口
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus #上下文

# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF


# orientdb buffer size in megabytes
storage.diskCache.bufferSize=4096


vi /usr/local/nexus-2.14.8-01/bin/nexus #修改RUN_AS_USER 为root, NEXUS_HOME程序主目录最好用绝对路径。


#! /bin/sh

#
# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#

#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application

# Set this to the root of the Nexus installation
NEXUS_HOME="/usr/local/nexus-2.14.8-01"

# If specified, the Wrapper will be run as the specified user.

# IMPORTANT - Make sure that the user has the required privileges to write into the Nexus installation directory.

# NOTE - This will set the user which is used to run the Wrapper as well as
# the JVM and is not useful in situations where a privileged resource or
# port needs to be allocated prior to the user being changed.
#RUN_AS_USER=
RUN_AS_USER="root"
# Application
APP_NAME="nexus"
APP_LONG_NAME="Nexus OSS"

赋予NEXUS_HOME 目录写入权限
chmod -R +w /usr/local/nexus-2.14.8-01

二、nexus服务启动、停止等命令

./nexus {console | start | stop |restart |status | dump }

./nexus console 在当前控制台窗口启动,按ctrl+c结束进程

./nexus start 后台进程启动nexus服务,可查看 logs目录中wrapper.log 输出日志

./nexus stop 停止nexus服务。
三、nexus服管理控制台

nexus 服务启动比较慢,启动后稍待1分钟左右,访问IP:8081/nexus 进入管理控制台。

默认超级管理员为 admin,登陆密码 admin123

默认部署员 deployment, 登陆密码deployment123 .

使用超级管理员登陆上,点击左侧Respositories ,即可看到所有的仓库了。

四.私服的简单用法和说明

linux下安装nexus-2.14.8 -01私服

登录后,点击左侧Repositories,界面如上图所示。

右侧的列表中,可以看到nexus预设的几个仓库。

第一个public Repositories,类型为group,这个简单理解为仓库的集合,下面的仓库就是可以加入到这个集合的元素。

对外可以只提供一个单独的url,如上图显示为:http://192.168.2.141:8081/nexus/content/groups/public/

大部分的终端用户,只需要配置上面这一个单独的聚合后的url,而不用单独配置多个仓库。用户也不需要知道某个jar包具体来源于maven *仓库,或者是Apache Snapshots,或者是我们自己添加的其他仓库。

这样的好处在于:如果我们要新增某个仓库(如开源中国、阿里云),客户端不需要做任何更改,只需要在nexus上将要新增的仓库加入到对外提供服务的仓库 group中就可以。

第二个3rd party,与倒数第一个和第二个仓库,Releases和Snapshots一样,类型为hosted,意思是由nexus本机管理的仓库。该仓库用于商业化的,第三方提供的非开源的依赖仓库,如oracle jdbc driver。

倒数第二个Releases,用于存放开发团队内部用的正式版的依赖。

倒数第一个Snapshots,用于存放开发团队内部日常构建的频率更新较快的依赖包。

Apache Snapshots和Central类型都是proxy,意思是远端仓库的代理。前者包含了Apache Software Foundation 发布的快照版本(这么翻译不知道对不对),后者为Maven*仓库,我们平时maven默认就是连接该仓库。

Central M1 Shadow类型为virtual,按官方文档的意思是,只是已有仓库的一个不同呈现方式的映射。有需要可以参考官方手册6.2.3节。

 linux下安装nexus-2.14.8 -01私服

点击Configuration,可以看到当前添加到该集合的仓库列表及顺序(优先级高的在上面,可用鼠标拖拽),当我们新增了仓库,将会出现在右侧的available Repository,添加到左边即可。

如果有哪个仓库不想加入到该集合,也可以拖拽到右边来。

 

使用本地maven客户端测试nexus是否成功部署

首先复制仓库集合的repository url,客户端配置需要用到。

然后可以从项目中导入包,或是直接从私服导入包.

 

linux下安装nexus-2.14.8 -01私服

上一篇:我用shell写了个mud游戏:武林群侠传


下一篇:.NET Core 3 WPF MVVM框架 Prism系列之对话框服务