centos使用nexus-3.13.0-01搭建私服
原创 crazywind 发表于:2019-10-14 13:51:30
  阅读 :518   收藏   编辑
  • 下载

http://119.29.241.56:8080/view/1320

  • 解压文件到/usr/local

tar -zxvf /install/nexus-3.13.0-01-unix.tar.gz  -C /usr/local/
  • 建立软链接

cd /usr/local/
ln -s nexus-3.13.0-01 nexus
  • 设置环境变量

vim /etc/profile
export NEXUS_HOME=/usr/local/nexus-3.13.0-01
export RUN_AS_USER=root #可以用root用户启动
source /etc/profile
  • 配置文件

vi /usr/local/nexus/etc/nexus-default.properties

默认端口8081

  • 启动

/usr/local/nexus/bin/nexus start

WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
Starting nexus
  • 注意防火墙

systemctl status firewalld.service #检测是否开启了firewall
systemctl stop firewalld.service #关闭firewall 
sytsemctl disable firewalld.service #禁止firewall开机自启

访问,启动较慢多等带一会

  • 浏览器访问

http://ip:8081

点击右上角登录

默认用户名为admin,密码admin123

  • 仓库类型介绍

maven-central:maven中央库,默认从https://repo1.maven.org/maven2/拉取jar

maven-releases:私库发行版jar

maven-snapshots:私库快照(调试版本)jar

maven-public:仓库分组,把上面三个仓库组合在一起对外提供服务

Nexus默认的仓库类型有以下四种:

group(仓库组类型):又叫组仓库,用于方便开发人员自己设定的仓库

hosted(宿主类型):内部项目的发布仓库(内部开发人员,发布上去存放的仓库)

proxy(代理类型):  从远程中央仓库中寻找数据的仓库

virtual(虚拟类型): 虚拟仓库(这个基本用不到,重点关注上面三个仓库的使用)

Policy(策略):表示该仓库为发布(Release)版本仓库还是快照(Snapshot)版本仓库

  • 创建仓库

登录后,点击左侧的Repositories打开仓库列表

1

1.创建3rdPart仓库保存本地jar包

2

type选maven2(hosted)

3

填写名字后保存

4


2.创建aliyun-proxy仓库

type选maven2(proxy)

5

代理仓库地址写:http://maven.aliyun.com/nexus/content/groups/public/

6


更新maven-public仓库拉取顺序

7

  • idea使用私服仓库jar

更新pom.xml添加

	<repositories>
		<repository>
			<id>maven-public</id>
			<name>maven-public</name>
			<url>http://ip:8081/repository/maven-public/</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</repository>
	</repositories>