从零开始搭建系统2.1——nexus安装及配置(代码片段)

爱吃栗子的猿 爱吃栗子的猿     2022-10-27     610

关键词:

 

在安装配置Nexus时,请先确定您已经配置好jdk

1.创建目录

2.下载安装包

[root@localhost usr]# cd nexus

下载地址:https://www.sonatype.com/download-oss-sonatype

wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.9.0-01-unix.tar.gz

3.解压安装包

tar -zxvf nexus-3.9.0-01-unix.tar.gz

解压之后生成两个文件夹,分别为nexus-2.3.1-01、sonatype-work

 

4.启动

进入到bin目录下,执行./nexus start

解决上面的提示:

创建nexus用户

groupadd nexus#创建组

useradd nexus -g nexus#创建用户并将用户添加到组

 #修改文件所有者

chown -R nexus  /usr/nexus/

修改 nexus 脚本,指定启动用户

 

5.开启8081端口

添加

firewall-cmd --zone=public --add-port=8081/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone= public --query-port=8081/tcp
查看所有打开的端口
firewall-cmd --zone=public --list-ports

 5.验证是否启动成功

http://192.168.0.200:8081

 

出现上述页面,说明配置nexus成功!

点击右上角“Log in”, 输入用户名和密码(默认用户名:admin      密码: admin123)登录。

6.开机启动

sudo ln -s /usr/nexus/nexus-3.9.0-01/bin/nexus /etc/init.d/nexus

使用
service nexus status/start/stop
查看nexus服务状态、启动服务、停止服务等

使用
chkconfig nexus on/off

设置nexus服务开机自启动或者开机不启动

 

如果启动不起来的话可以用下面方式启动,通过启动日志查找问题

service nexus start-launchd

7.配置nexus

新建store

 

8.proxy私仓,使用的外部私仓是阿里的仓库http://maven.aliyun.com/nexus/content/groups/public:

 

 9.release私仓

 

10.snapshot私仓

11.group私仓组

12.如何在项目中使用

settings.xml 配置

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<localRepository>D:\\.m2\\repository</localRepository>

<pluginGroups>
<pluginGroup>org.sonatype.plugins</pluginGroup>
</pluginGroups>

<proxies>
</proxies>

<servers>
<server>
<id>Releases</id>
<username>admin</username>
<password>admin123</password>
</server>

<server>
<id>Snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>

<mirrors>

<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://192.168.0.200:8081/repository/nexus-public/</url>
</mirror>
</mirrors>

<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>

</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>

项目pom配置

<distributionManagement>
<repository>
<id>Releases</id>
<name>Releases</name>
<url>http://192.168.0.200:8081/repository/nexus-releases</url>
</repository>
<snapshotRepository>
<id>Snapshots</id>
<name>Snapshots</name>
<url>http://192.168.0.200:8081/repository/nexus-snapshots</url>
</snapshotRepository>
</distributionManagement>

 

 

13.直接deploy即可

 

 14.设置可重复deploy

如果需要可重复deploy同一个版本的jar包,可进行如下配置

 

 

 

从零开始搭建系统2.6——kafka安装及配置

从零开始搭建系统2.6——Kafka安装及配置 查看详情

从零开始搭建系统2.7——quartz安装及配置

从零开始搭建系统2.7——Quartz安装及配置 查看详情

从零开始搭建系统2.3——cat安装及配置

从零开始搭建系统2.3——Cat安装及配置 查看详情

从零开始搭建系统2.2——elk安装及配置

从零开始搭建系统2.2——ELK安装及配置 查看详情

从零开始搭建系统1.6——https证书安装及配置

从零开始搭建系统1.6——Https证书安装及配置 查看详情

从零开始搭建系统2.4——jenkins安装及配置(代码片段)

从零开始搭建系统2.4——Jenkins安装及配置 查看详情

从零开始搭建solo个人博客系统(代码片段)

目录1.博客系统的搭建流程2.服务器选购2.1阿里云学生主机2.2普通云主机3.域名购买与备案(可选)3.1域名购买3.2域名服务器备案3.3域名服务器解析4.solo安装4.1本地试用5.安装nginx(可选)6.配置ssl证书(可选)6.1证书选购6.2配置ngi... 查看详情

从零开始搭建系统3.3——图片服务开发及部署

从零开始搭建系统3.3——图片服务开发及部署 查看详情

从零开始搭建系统3.2——微服务注册中心开发及部署

从零开始搭建系统3.2——微服务注册中心开发及部署 查看详情

从零开始搭建系统3.6——基础配置组件开发

从零开始搭建系统3.6——基础配置组件开发 查看详情

kubernetes第二篇:从零开始搭建k8s集群(亲测可用)(代码片段)

文章目录一、前言二、Centos最小化安装2.1vmware最小化安装centos72.2配置静态IP三、K8S集群搭建3.1更新yum3.2安装Docker3.3修改hosts文件3.4系统基础前提配置3.5安装kubeadm,kubeletandkubectl3.6配置国内镜像3.7kubeinit初始化master3.8部署calico网络插... 查看详情

从零开始写博客系统——环境搭建(代码片段)

环境相关内容关于Python的安装,环境变量等配置这里就不单独出文章了,网上有大量的文章可以参考。我使用的Mac电脑,使用Windows也是同样可以的。只不过某些配置可能略有差异。$python3-VPython3.6.6我的Python版本如上&#... 查看详情

kubernetes部署_02_从零开始搭建k8s集群v1.21.0(亲测可用)(代码片段)

文章目录一、前言二、Centos最小化安装2.1vmware最小化安装centos72.2配置静态IP三、K8S集群搭建3.1更新yum(所有机器都执行)3.2安装Docker(所有机器都执行)3.3修改hosts文件(所有机器都执行)3.4系统基础前提配置(所有机器都执行)3.5安装kubea... 查看详情

kubernetes部署_02_从零开始搭建k8s集群v1.21.0(亲测可用)(代码片段)

文章目录一、前言二、Centos最小化安装2.1vmware最小化安装centos72.2配置静态IP三、K8S集群搭建3.1更新yum(所有机器都执行)3.2安装Docker(所有机器都执行)3.3修改hosts文件(所有机器都执行)3.4系统基础前提配置(所有机器都执行)3.5安装kubea... 查看详情

从零开始搭建go语言开发环境(代码片段)

一步一步,从零搭建Go语言开发环境。安装Go语言及搭建Go语言开发环境下载下载地址Go官网下载地址:https://golang.org/dl/Go官方镜像站(推荐):https://golang.google.cn/dl/版本的选择Windows平台和Mac平台推荐下载可执行文件版,Linux平台... 查看详情

从零开始搭建go语言开发环境(代码片段)

一步一步,从零搭建Go语言开发环境。安装Go语言及搭建Go语言开发环境下载Go官网下载地址:https://golang.org/dl/Go官方镜像站(推荐):https://golang.google.cn/dl/版本的选择Windows平台和Mac平台推荐下载可执行文件版,Linux平台下载压缩... 查看详情

从零开始使用vue-cli搭建一个vue项目及注意事项(代码片段)

一、安装node.js  1.根据电脑的自行下载node.js安装包http://nodejs.cn      2.点击安装,按照正常的的一路点击下去  3.验证安装是否成功,按键win+r,输入cmd打开命令行工具,点击确认后再输入node-v出现版本好说明npm安装成... 查看详情

fate部署实战——从零开始实现fatecluster部署(代码片段)

文章目录摘要1总体介绍1.1.系统介绍1.2.组件说明1.3.系统架构2详细设计2.1.部署规划2.2.主机资源和操作系统要求2.3.网络要求3搭建虚拟环境3.1硬件要求3.2软件3.3安装VMWare虚拟机安装3.4CentOS安装4虚拟环境配置4.1hostname配置4.2关闭selinu... 查看详情