惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
T
Tenable Blog
T
Troy Hunt's Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy & Cybersecurity Law Blog
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Hacker News: Front Page
S
Secure Thoughts
AWS News Blog
AWS News Blog
L
LINUX DO - 最新话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
M
MIT News - Artificial intelligence
T
Tor Project blog
S
Schneier on Security
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
美团技术团队
Google DeepMind News
Google DeepMind News
V
Visual Studio Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
T
Threat Research - Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
D
Docker
J
Java Code Geeks
GbyAI
GbyAI
H
Heimdal Security Blog
The Hacker News
The Hacker News
MongoDB | Blog
MongoDB | Blog
V
Vulnerabilities – Threatpost
T
Tailwind CSS Blog
Cloudbric
Cloudbric
TaoSecurity Blog
TaoSecurity Blog
C
CERT Recently Published Vulnerability Notes
Y
Y Combinator Blog
Recorded Future
Recorded Future
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
The Register - Security
The Register - Security
Hacker News - Newest:
Hacker News - Newest: "LLM"

博客园 - 没头脑的土豆

(转)Python实例手册 (转)shell实例手册 Jetty嵌入式Web容器攻略 H2数据库攻略 CAS ticket过期策略 CAS自定义登录验证方法 Sonatype Nexus高级配置 配置sonar、jenkins进行持续审查 Scrum敏捷精要 使用yuicompressor-maven-plugin压缩js及css文件 (转)Rails Web应用相关插件和资源列表 (转)了解Instagram背后的技术 Jenkins服务器安装与配置 使用liquibase-maven-plugin实现持续数据库集成 Jenkins配置基于角色的项目权限管理 Android-x86虚拟机安装配置全攻略 CenOS系统中安装Tomcat7并设置为自启动服务 CentOS系统中安装JDK1.6 (转)Esri微博地址收录
CentOS系统中安装Nexus并导入已有的构件库
没头脑的土豆 · 2012-09-12 · via 博客园 - 没头脑的土豆

Nexus是Maven仓库管理器,用于搭建一个本地仓库服务器,这样做的主要的好处就是节约网络资源,速度快,开发团队中所有的Maven可以共享这个本地仓库,下载一遍共享使用。另外一个优点就是他为你的组织提供一个搭建构件的地方。本文将介绍如何在CentOS系统中安装配置Nexus,并介绍如何导入已有的构件仓库。

1、 软件

a) 下载Nexus 地址:http://www.sonatype.org/downloads/nexus-2.1.2-bundle.tar.gz
b) 如无特殊说明,本文档操作用户为nexus
c) nexus默认的管理员用户名密码是:admin/admin123

2、 安装

a) 解压

1 $ tar zxvf nexus-2.1.2-bundle.tar.gz

b) 移动到其他目录

1 $ mv nexus-2.1.2 /home/nexus/nexus

c) 设置为系统自启动服务(使用root用户)

1 # cd /etc/init.d/
2 # cp /home/nexus/nexus/bin/jsw/linux-x86-64/nexus nexus

编辑/etc/init.d/nexus文件,添加以下变量定义:

1 NEXUS_HOME=/home/nexus/nexus
2 PLATFORM=linux-x86-64
3 PLATFORM_DIR="${NEXUS_HOME}/bin/jsw/${PLATFORM}"


修改以下变量:

1 WRAPPER_CMD="${PLATFORM_DIR}/wrapper"
2 WRAPPER_CONF="${PLATFORM_DIR}/../conf/wrapper.conf"
3 PIDDIR="${NEXUS_HOME}"

修改如下变量,设置启动用户为nexus:

执行命令添加nexus自启动服务

1 # chkconfig –add nexus
2 # chkconfig –levels 345 nexus on

执行如下命令启动、停止nexus服务

1 # service nexus start
2 # service nexus stop

d) 检查是否启动成功

在本机浏览器中访问URL: http://localhost:8081/nexus
会出现Nexus的欢迎页面
注:如果想远程通过浏览器访问,则在远程浏览器中输入http://<ip>:8081/nexus
<ip> 可通过在本地机器上输入命令 ifconfig 查看
如果未能访问到nexus的欢迎页面,需要查看本机的防火墙设置,是否打开了端口8081

e) 修改配置

配置文件位置nexus/conf/nexus.properties,配置示例如下:

 1 # Sonatype Nexus
 2 # ==============
 3 # This is the most basic configuration of Nexus.
 4 
 5 # Jetty section
 6 application-port=8081
 7 application-host=0.0.0.0
 8 nexus-webapp=${bundleBasedir}/nexus
 9 nexus-webapp-context-path=/nexus
10 
11 # Nexus section
12 nexus-work=${bundleBasedir}/../sonatype-work/nexus
13 runtime=${bundleBasedir}/nexus/WEB-INF
14 pr.encryptor.publicKeyPath=/apr/public-key.txt

主要配置参数:

application-port:nexus启动端口
nexus-work:指定构件库的存储位置

3、 导入已有的构件库

nexus的构件仓库都保存在sonatype-work目录中,该目录的位置由nexus/conf/nexus.properties配置文件指定。
将已有的sonatype-work目录替换安装后的nexus的sonatype-work目录。
修改sonatype-work/nexus/conf目录下的nexus.xml文件,修改<localStorage>节点下面的<url>子节点为真实路径即可,如central库的配置:

 1 <repository>
 2       <id>central</id>
 3       <name>Central</name>
 4       <providerRole>org.sonatype.nexus.proxy.repository.Repository</providerRole>
 5       <providerHint>maven2</providerHint>
 6       <localStatus>IN_SERVICE</localStatus>
 7       <notFoundCacheActive>true</notFoundCacheActive>
 8       <notFoundCacheTTL>1440</notFoundCacheTTL>
 9       <userManaged>true</userManaged>
10       <exposed>true</exposed>
11       <browseable>true</browseable>
12       <writePolicy>READ_ONLY</writePolicy>
13       <indexable>true</indexable>
14       <searchable>true</searchable>
15       <localStorage>
16         <provider>file</provider>
17         <url>file:/home/nexus/sonatype-work/nexus/storage/central</url>
18       </localStorage>
19       <remoteStorage>
20         <provider>apacheHttpClient3x</provider>
21         <url>http://repo1.maven.org/maven2/</url>
22         <mirrors>
23           <mirror>
24             <id>http://repo.springsource.org/repo/</id>
25             <url>http://repo.springsource.org/repo/</url>
26           </mirror>
27           <mirror>
28             <id>http://gradle.artifactoryonline.com/gradle/libs</id>
29             <url>http://gradle.artifactoryonline.com/gradle/libs</url>
30           </mirror>
31           <mirror>
32             <id>http://repo.opengeo.org</id>
33             <url>http://repo.opengeo.org</url>
34           </mirror>
35           <mirror>
36             <id>http://repo.maven.apache.org/maven2</id>
37             <url>http://repo.maven.apache.org/maven2</url>
38           </mirror>
39           <mirror>
40             <id>http://search.maven.org</id>
41             <url>http://search.maven.org</url>
42           </mirror>
43           <mirror>
44             <id>http://repo1.maven.org/maven2/</id>
45             <url>http://repo1.maven.org/maven2/</url>
46           </mirror>
47           <mirror>
48             <id>http://download.osgeo.org/webdav/geotools/</id>
49             <url>http://download.osgeo.org/webdav/geotools/</url>
50           </mirror>
51         </mirrors>
52       </remoteStorage>
53       <externalConfiguration>
54         <proxyMode>ALLOW</proxyMode>
55         <artifactMaxAge>-1</artifactMaxAge>
56         <itemMaxAge>1440</itemMaxAge>
57         <cleanseRepositoryMetadata>false</cleanseRepositoryMetadata>
58         <downloadRemoteIndex>true</downloadRemoteIndex>
59         <checksumPolicy>WARN</checksumPolicy>
60         <repositoryPolicy>RELEASE</repositoryPolicy>
61         <autoBlockActive>true</autoBlockActive>
62         <fileTypeValidation>true</fileTypeValidation>
63         <metadataMaxAge>1440</metadataMaxAge>
64       </externalConfiguration>
66 </repository>