您的位置:首页 > 运维架构 > Linux

Centos+Sonatype Nexus 搭建Maven私有库

2017-07-27 10:08 453 查看
必要环境:Centos,JDK7,Maven,Sonatype Nexus

IP:192.168.25.135 /root 确保JDK已经成功安装并且配置好环境变量

1.下载Sonatype Nexus:

https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2-03-bundle.tar.gz

2.解压:

- 创建解压文件所需要的目录并解压文件到该目录

# mkdir nexus

# tar -zxvf nexus-2.11.2-03-bundle.tar.gz -C nexus

# cd nexus

# ls (可以看到有两个目录)

nexus-2.11.2-03(存放nexus服务目录) sonatype-work(存放私有库目录)

- 编辑nexus-2.11.2-03的nexus.properties文件

# cd nexus-2.11.2-03/conf

# vi 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
nexus-webapp-context-path=/nexus

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


编辑 nexus 脚本, 配置 RUN_AS_USER 参数

#RUN_AS_USER=

改为:

RUN_AS_USER=root

打开防火墙的8081端口,与上面所修改的一致

# vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

# 打开8081端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT


启动nexus:

进入到nexus的bin目录:cd /root/nexus/nexus-2.11.2-03/bin

启动: ./nexus start

[b]******************************[/b]

WARNING - NOT RECOMMENDED TO RUN AS ROOT

[b]******************************[/b]

Starting Nexus OSS…

Started Nexus OSS.

访问nexus http://192.168.25.135:8081/nexus



此时,一个Maven的私有库就搭建完成了。下一篇将说一下如何通过在IDE中配置和访问私有库
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  maven centos