CentOS安装nexus(Maven仓库管理器)

简介: Nexus是一个强大的Maven仓库管理器,它极大地简化了自己内部仓库的维护和外部仓库的访问。利用Nexus你可以只在一个地方就能够完全控制访问和部署在你所维护仓库中的每个Artifact。Nexus是一套“开箱即用”的系统不需要数据库,它使用文件系统加Lucene来组织数据。Nexus使用ExtJS来开发界面,利用Restlet来提供完整的REST APIs,通过m2eclips
Nexus是一个强大的Maven仓库管理器,
它极大地简化了自己内部仓库的维护和外部仓库的访问。
利用Nexus你可以只在一个地方就能够完全控制访问和部署在你所维护仓库中的每个Artifact。
Nexus是一套“开箱即用”的系统不需要数据库,它使用文件系统加Lucene来组织数据。
Nexus使用ExtJS来开发界面,利用Restlet来提供完整的REST APIs,通过m2eclipse与Eclipse集成使用。
Nexus支持WebDAV与LDAP安全身份认证。

官网下载:http://www.sonatype.org/nexus/archived/

我的准备:

 CentOS Linux release 7.1.1503 (Core)
 nexus-2.11.1-01-bundle.tar.gz
 jdk-8u60-linux-x64

注:最终启动,如果远程访问关闭,或者是stoped的nexus的jre版本和本地jre的version不符合(一般1.7就ok)!

1:解压:

[root@CentOS-Slave1 install-files]# tar zxvf nexus-2.11.1-01-bundle.tar.gz 
-rw-r--r--. 1 root root 71817045 Oct 18 15:17 nexus-2.11.1-01-bundle.tar.gz
drwxr-xr-x. 8 root root     4096 Dec 17  2014 nexus-2.11.1-01
drwxr-xr-x. 3 root root       35 Dec 17  2014 sonatype-work
注:安装nexus,本地仓库默认的jar包存储位置是:/sonatype-work/nexus/storage/central。由于Central仓库占用存储较大,所以要注意存储位置。

2:移动合适位置/home/nexus:

[root@CentOS-Slave1 install-files]# mv nexus-2.11.1-01 /home/nexus/
[root@CentOS-Slave1 install-files]# mv sonatype-work/ /home/nexus
[root@CentOS-Slave1 install-files]# cd /home/nexus/
[root@CentOS-Slave1 nexus]# ll
total 4
drwxr-xr-x. 8 root root 4096 Dec 17  2014 nexus-2.11.1-01
drwxr-xr-x. 3 root root   35 Dec 17  2014 sonatype-work

3:修改配置文件1:/home/nexus/nexus-2.11.1-01/conf/nexus.properties
………………
# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.

# Jetty section
# 配置端口信息
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
#配置IP端口访问
#http://192.168.10.56:8081/nexus/可修改为: /
nexus-webapp-context-path=/nexus

# Nexus section
#配置work目录地址,Maven仓库JAR缓存地址,可修改其他地址eg:${bundleBasedir}/nexus-work/nexus 
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
4:修改配置文件2:/home/nexus/nexus-2.11.1-01/bin/nexus
………………
#NEXUS_HOME=".."
#如果目录改变配置,如果修改了运行路径
NEXUS_HOME="/home/nexus/nexus-2.11.1-01"
……………………
#RUN_AS_USER=
#nexus启动用户
RUN_AS_USER=root
注: nexus很依赖于jdk,编写,所以必须安装好jdk并设置环境变量/etc/profile并生效!备注附件!
[root@CentOS-Slave1 metrics]# pwd
/home/nexus/nexus-2.11.1-01/nexus/WEB-INF/classes/org/sonatype/nexus/webapp/metrics
[root@CentOS-Slave1 metrics]# ls
DeadlockHealthCheckProvider.class  HealthCheckMediator.class  MetricsModule$1.class  MetricsModule$2.class  MetricsModule.class
5:启动nexus服务:
[root@CentOS-Slave1 bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.
警告:不推荐作为root用户运行.
6:nexus启动日志:
[root@CentOS-Slave1 logs]# pwd
/home/nexus/nexus-2.11.1-01/logs
[root@CentOS-Slave1 logs]# tail -f wrapper.log 
……………………
xceptionMapper
jvm 1    | 2015-10-18 16:38:29,492+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.rest.NexusApplication_UriMatching - Strict URI matching: true
jvm 1    | 2015-10-18 16:38:29,816+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.configuration.ModelUtils - Loading model /home/nexus/sonatype-work/nexus/conf/ldap.xml
jvm 1    | 2015-10-18 16:38:29,873+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.configuration.ModelUtils - Loading model /home/nexus/sonatype-work/nexus/conf/lvo-plugin.xml
jvm 1    | 2015-10-18 16:38:30,994+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.webresources.internal.WebResourceServiceImpl - Discovered 1973 resources
jvm 1    | 2015-10-18 16:38:30,996+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.webresources.internal.WebResourceServlet - Max-age: 30 days (2592000 seconds)
jvm 1    | 2015-10-18 16:38:31,132+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.InstrumentedSelectChannelConnector - Metrics enabled
jvm 1    | 2015-10-18 16:38:31,166+0800 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.AbstractConnector - Started InstrumentedSelectChannelConnector@0.0.0.0:8081
jvm 1    | 2015-10-18 16:38:31,166+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Running
jvm 1    | 2015-10-18 16:38:31,166+0800 INFO  [WrapperListener_start_runner] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Started

注:启动日志:*SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Started则,启动成功!
用浏览器访问:http://192.168.10.56:8081/nexus/

7:nexus开机启动:

[root@CentOS-Slave1 bin]# pwd
/home/nexus/nexus-2.11.1-01/bin
[root@CentOS-Slave1 bin]# ls
jsw  nexus  nexus.bat
[root@CentOS-Slave1 bin]# cp nexus /etc/rc.d/init.d/
[root@CentOS-Slave1 bin]# cd /etc/rc.d/init.d/
[root@CentOS-Slave1 init.d]# ls
functions  jexec  mysql  netconsole  network  nexus  README
[root@CentOS-Slave1 init.d]# chkconfig --add nexus
[root@CentOS-Slave1 init.d]# chkconfig --list | grep nexus 

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

nexus          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
[root@CentOS-Slave1 init.d]# chkconfig nexus on
[root@CentOS-Slave1 init.d]# chkconfig --list | grep nexus 

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

nexus          	0:off	1:off	2:on	3:on	4:on	5:on	6:off

问题1:

[root@CentOS-Slave1 bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.

解决1:上:4:修改配置文件2:/home/nexus/nexus-2.11.1-01/bin/nexus ---> RUN_AS_USER=root

备注附件:

安装jdk:

[root@CentOS-Slave1 install-files]# rpm -ivh jdk-8u60-linux-x64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8.0_60-2000:1.8.0_60-fcs    ################################# [100%]
Unpacking JAR files...
	tools.jar...
	plugin.jar...
	javaws.jar...
	deploy.jar...
	rt.jar...
	jsse.jar...
	charsets.jar...
	localedata.jar...
	jfxrt.jar...
[root@CentOS-Slave1 install-files]# vim /etc/profile
……………………
#jdk
export JAVA_HOME=/usr/java/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib:.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
[root@CentOS-Slave1 install-files]# source /etc/profile

参数说明:

nexus的仓库类型分为以下四种:group: 仓库组,hosted:宿主 ,proxy:代理,virtual:虚拟
仓库组和多个仓库:
Public Repositories:  仓库组
3rd party: 无法从公共仓库获得的第三方发布版本的构件仓库
Apache Snapshots: 用了代理ApacheMaven仓库快照版本的构件仓库
Central: 用来代理maven中央仓库中发布版本构件的仓库
Central M1 shadow: 用于提供中央仓库中M1格式的发布版本的构件镜像仓库
Codehaus Snapshots: 用来代理CodehausMaven 仓库的快照版本构件的仓库
Releases: 用来部署管理内部的发布版本构件的宿主类型仓库
Snapshots:用来部署管理内部的快照版本构件的宿主类型仓库
maven的pom.xml设置:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
	<mirrors>
		<mirror>
			<!--This sends everything else to /public -->
			<id>nexus</id>
			<mirrorOf>*</mirrorOf>
			 <!-- <url>http://repo1.maven.org/maven2/</url> -->
			<url>http://192.168.10.56:8081/nexus/content/groups/public</url>
		</mirror>
	</mirrors>
	<profiles>
		<profile>
			<id>nexus</id>
			<!--Enable snapshots for the built in central repo to direct -->
			<!--all requests to nexus via the mirror -->
			<repositories>
				<repository>
		    <id>central</id>
		    <url>http://repo1.maven.org/maven2/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>central</id>
					<url>http://central</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>
	
	<activeProfiles>
		<!--make the profile active all the time -->
		<activeProfile>nexus</activeProfile>
	</activeProfiles>
</settings>

目录
相关文章
|
3月前
|
存储 Ubuntu Linux
VMware-安装CentOS系统教程及安装包
虚拟机相当于是一个独立于你电脑的环境,在这个环境上面,你可以安装Linux、Windows、Ubuntu等各个类型各个版本的系统,在这个系统里面你不用担心有病读等,不用担心文件误删导致系统崩溃。 虚拟机也和正常的电脑系统是一样的,也可以开关机,不用的时候,你关机就可以了,也不会占用你的系统资源,使用起来还是比较方便 这里也有已经做好的CentOS 7系统,下载下来解压后直接用VMware打开就可以使用
678 69
|
2月前
|
存储 分布式计算 Linux
安装篇--CentOS 7 虚拟机安装
VMware 装 CentOS 7 不知道从哪下手?这篇超详细图文教程手把手教你在 VMware Workstation 中完成 CentOS 7 桌面系统的完整安装流程。从 ISO 镜像下载、虚拟机配置,到安装图形界面、设置用户密码,每一步都有截图讲解,适合零基础新手快速上手。装好之后无论你是要搭 Hadoop 集群,还是练 Linux ,这个环境都够你折腾一整天!
791 2
|
3月前
|
Ubuntu Linux 索引
Centos 7、Debian及Ubuntu系统中安装和验证tree命令的指南。
通过上述步骤,我们可以在CentOS 7、Debian和Ubuntu系统中安装并验证 `tree`命令。在命令行界面中执行安装命令,然后通过版本检查确认安装成功。这保证了在多个平台上 `tree`命令的一致性和可用性,使得用户无论在哪种Linux发行版上都能使用此工具浏览目录结构。
316 78
|
2月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
392 16
|
4月前
|
Linux 网络安全 Apache
针对在Centos/Linux安装Apache过程中出现的常见问题集锦
以上每个问题的解决方案应深入分析错误日志、系统消息和各种配置文件,以找到根本原因并加以解决。务必保持系统和Apache软件包更新到最新版本,以修复已知的bugs和安全漏洞。安装和管理Web服务器是一项需要细致关注和不断学习的任务。随着技术的发展,推荐定期查看官方文档和社区论坛,以保持知识的更新。
211 80
|
3月前
|
存储 关系型数据库 MySQL
在CentOS 8.x上安装Percona Xtrabackup工具备份MySQL数据步骤。
以上就是在CentOS8.x上通过Perconaxtabbackup工具对Mysql进行高效率、高可靠性、无锁定影响地实现在线快速全量及增加式数据库资料保存与恢复流程。通过以上流程可以有效地将Mysql相关资料按需求完成定期或不定期地保存与灾难恢复需求。
249 10
|
4月前
|
人工智能 数据挖掘 Linux
Centos安装Python3.7(亲测可用)
本指南详细介绍了在基于Linux(以CentOS系统为例,使用yum包管理器)的系统上安装Python 3.7版本的完整流程。Python是一种广泛使用的高级编程语言,在各种领域如软件开发、数据分析、人工智能和区块链开发等都有着重要的应用。
403 2
|
3月前
|
运维 网络协议 Linux
CentOS下Bind服务的安装与故障排查
通过以上的步骤,您应该能够在CentOS系统上安装并配置BIND DNS服务,并进行基本的故障排查。
252 0
|
5月前
|
机器人 Linux
CentOS 7系统中安装特定版本CMake 3.21.2的方法。
到这里,过程已经全部完成。如果你跟随上面的步骤来,那么你现在已经拥有了一个全新的CMake版本在你的CentOS 7系统上了。这个过程就像是你通过一系列仪式,唤醒了一个沉睡已久的古老机器人,它现在完全按照你的意愿来帮你构建和编译软件了。
369 18
|
3月前
|
存储 Ubuntu Linux
安卓手机免root安装各种Linux系统:Ubuntu, Centos,Kali等
此外还可以安装Slackware、Archstrike等系统,还可以通过github查找方法安装更多有趣的东西。 昨日小编就是通过Termux安装的Kali Linux工具包。