Centos7 Nexus Maven 私服搭建

下载源代码,自行官网下载
1、下载最新版 Nexus(本教程使用的是:nexus-2.11.2-03-bundle.tar.gz),下载地址:
[最新nexus下载] (https://www.sonatype.com/products/repository-oss-download)

wget 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 /home/nexus

cd nexus

ls

nexus-2.11.2-03 sonatype-work
(一个 nexus 服务,一个私有库目录)
3、编辑 Nexus 的 nexus.properties 文件,配置端口和 work 目录信息(保留默认)

cd nexus-2.11.2-03

ls

bin conf lib LICENSE.txt logs nexus NOTICE.txt tmp
查看目录结构,jetty 运行

cd conf

vi nexus.properties

Jetty section

application-port=8081
application-host=0.0.0.0 ----------------此处换为ip
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus

Nexus section

nexus-work= b u n d l e B a s e d i r / . . / s o n a t y p e − w o r k / n e x u s r u n t i m e = {bundleBasedir}/../sonatype-work/nexus runtime= bundleBasedir/../sonatypework/nexusruntime={bundleBasedir}/nexus/WEB-INF
4、编辑 nexus 脚本, 配置 RUN_AS_USER 参数

vi /root/nexus/nexus-2.11.2-03/bin/nexus

#RUN_AS_USER=
改为:
RUN_AS_USER=root
/home/nexus-2.11.2-03/bin/nexus

#屏蔽原来NEXUS_HOME,使用绝对路径
#NEXUS_HOME="…"

RUN_AS_USER=root
JAVA_HOME=/home/jdk1.8.0_91
NEXUS_HOME=/home/nexus-2.11.2-03
PLATFORM=linux-x86-64
开机启动报异常:wrapper | Unable to start JVM: No such file or directory (2)
二、修改配置文件,/home/nexus-2.11.2-03/bin/jsw/conf/wrapper.conf
#开机启动没有环境变量,改为绝对路径
#原本
#wrapper.java.command=java
#改为
wrapper.java.command=/home/jdk1.8.0_91/bin/java
三、配置系统开机启动
vim /lib/systemd/system/nexus.service
[Unit]
Description=nexus
After=network.target

[Service]
Type=forking
ExecStart=/home/nexus-2.11.2-03/bin/nexus start
ExecReload=/home/nexus-2.11.2-03/bin/nexus restart
ExecStop=/home/nexus-2.11.2-03/bin/nexus stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target

systemctl daemon-reload

设置开机启动
systemctl enable nexus.service

开放防火墙端口
firewall-cmd --permanent --add-port=8081/tcp

firewall-cmd --reload 重新加载配置

执行:
systemctl start nexus # 启动私服
systemctl status nexus # 查看状态
systemctl stop nexus # 关闭私服

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值