nexus-3.31.1-01-unix.tar.gz
链接:https://pan.baidu.com/s/1YrJMwpGxmu8N2d7XMl6fSg
提取码:kfeh
上传到服务器,解压
tar -zvxf nexus-3.31.1-01-unix.tar.gz
进入bin目录,启动
./nexus start
查看状态
./nexus status
默认8081端口,访问地址 http://ip:8081/
首先需要确认nexus的安装目录,这里使用的目录为/opt/nexus-3.31.1-01,权限配置为nexus用户所有。
在三个文件夹其中一个创建nexus.service文件,优先级是/etc/systemd/ > /usr/lib/systemd/ > /lib/systemd/
[Unit]
Description=nexus service
After=network.target[Service]
Type=forking
ExecStart=/opt/nexus-3.31.1-01/bin/nexus start
ExecStop=/opt/nexus-3.31.1-01/bin/nexus stop
User=nexus #启动nexus进程的用户,需要确认目录是否有访问权限
Restart=on-abort[Install]
WantedBy=multi-user.target #命令行模式
执行以下命令
systemctl daemon-reload
systemctl enable nexus
systemctl start nexus
点击登录会提示修改密码,按提示命令执行
一般使用maven-public,maven-central会去拉公共仓库,拉完maven-public中就能用,其实就是代理
maven-releases是正式的jar包
maven-snapshots是快照的jar包
在pom.xml中配置如下
public nexus http://192.168.56.203:8081/repository/maven-public/ true public nexus http://192.168.56.203:8081/repository/maven-public/ true false
在maven的settings.xml中配置
maven-releases admin chenxb123456 maven-snapshots admin chenxb123456
在pom.xml中配置如下
maven-releases http://192.168.56.203:8081/repository/maven-releases/ maven-snapshots http://192.168.56.203:8081/repository/maven-snapshots/
version标签中是SNAPSHOT则上传到maven-snapshots,releases则上传到maven-releases
点击maven deploy,如下图上传成功