maven私服搭建
maven私服是一种特殊的远程仓库,一般是一个公司局域网中部署一个私服,用于代理互联网上的远程仓库,同时供公司内部开发的项目部署后共享.
以下是在Linux环境安装maven私服步骤
1 下载maven私服安装包,下载页面如下:https://support.sonatype.com/hc/en-us
最新的有3点几版本的,这里下载的是nexus-2.11.2-04-bundle.tar.gz,下载链接如下:
https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2-04-bundle.tar.gz
2 创建nexus目录,命令如下:
mkdir nexus
3 将下载的安装包放到创建的nexus目录,解压缩
tar -zxvf nexus-2.11.2-04-bundle.tar.gz
4 解压后,目录结构如下:

其中,nexus-2.11.2-04是私服提供的web服务,里面包含了一个内嵌的jetty,提供web页面来管理私服;sonatype-work是默认的本地仓库地址,里面存储创建的各类仓库以及管理的构建
5 如果与需要,修改本地仓库存储路径及web服务端口信息
cd nexus-2.11.2-04/conf
vim nexus.properties
内容如下:
# Sonatype Nexus (TM) Open Source Version
# Copyright (c) 2008-2015 Sonatype, Inc.
# All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
#
# This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
# which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
#
# Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
# of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
# Eclipse Foundation. All other trademarks are the property of their respective owners.
#
# 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
nexus-webapp-context-path=/nexus
# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
# nexus-work=/home/ywu/mvnRepository/
runtime=${bundleBasedir}/nexus/WEB-INF
默认web服务的端口8081,web服务上下文路径是nexus,如果有需要,可以修改
6 启动/停止
进入到bin目录
启动:./nexus start
停止:./nexus stop
7 访问
在浏览器中输入url:http://ip:port/nexus