1. Nexus 安装与配置

1.1 下载Nexus

  登录https://www.sonatype.com/download-oss-sonatype,下载最新的Nexus版本。 我这里使用的是nexus-3.16.1-02版本;

1.2 安装Nexus

#将tar包上传到服务器/usr/local/目录下解压,这个时候会出现 nexus-3.16.1-02、sonatype-work 两个文件夹

tar -zxvf nexus-3.16.1-02-unix.tar.gz  

#修改配置文件,eg:端口号

cd /usr/local/nexus-3.16.1-02/etc

vim nexus-default.properties

1.3 启动Nexus

  启动用户是root的时候会出现下面的警告,可以通过修改/usr/local/nexus-3.16.1-02/bin/nexus.rc文件解决;

#修改启动用户run_as_user,建议不要使用root

vim /usr/local/nexus-3.16.1-02/bin/nexus.rc

#
cd /usr/local/nexus-3.16.1-02/bin ./nexus start --后台启动 ./nexus run --前台启动,显示日志

1.4 登录Nexus

  服务启动完以后,输入Ip地址+端口访问(8081),Nexus默认的账户名和密码是是 admin/admin123

1.5 配置私有库

  将私有库添加到http://192.168.209.128:8081/repository/maven-public/中。

1.6 导入jar包

  一般私服都是存在内网环境,Nexus3.0以后需要通过命令命令将具体的jar包打到私服中;

#将下面的脚本丢到需要上传jar包的文件目录下
chmod u+x mavenimport.sh
./mavenimport.sh -u admin -p admin123 -r http://192.168.209.128:8081/repository/lingan/
#!/bin/bash
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params while getopts ":r:u:p:" opt; do
case $opt in
r) REPO_URL="$OPTARG"
;;
u) USERNAME="$OPTARG"
;;
p) PASSWORD="$OPTARG"
;;
esac
done find . -type f -not -path './mavenimport\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml'
-not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;

1.7 设置登录用户权限

  建议将admin注销,重新定义一个登录用户。在Nexus 3.0 这个版本中我直接删除admin会报错,但是设置为不可用没有问题;

2. Maven 安装与配置

2.1 下载Maven

登录http://maven.apache.org 下载最新的maven版本,我这里使用的是apache-maven-3.6.1版本。

2.2 安装Maven

将tar包上传到服务器/usr/local/目录下解压
tar -zxvf apache-maven-3.6.1-bin.tar.gz 

2.3 配置Maven

#配置release、snapshot的用户信息;
#配置mirror指向私服的nexus-public;
vim /usr/local/maven/apache-maven-3.6.1/conf/setting.xml

3. 工作空间配置

3.1 修改本地Maven配置

  配置release、snapshot的用户信息;

  配置mirror指向私服的nexus-public;

3.2 修改工程中的pom文件

<repositories>

<repository>

<id>nexus-public</id>

<url>http://192.168.11.23:8180/repository/maven-public/</url>

<snapshots>

<enabled>true</enabled>

</snapshots>

</repository>

</repositories>

<distributionManagement>

<repository>

<id>release</id>

<url>http://192.168.11.23:8180/repository/maven-releases/</url>

</repository>

<snapshotRepository>

<id>snapshot</id>

<url>http://192.168.11.23:8180/repository/maven-snapshots/</url>

</snapshotRepository>

</distributionManagement>

<build>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<version>3.8.0</version>

<configuration>

<source>1.7</source>

<target>1.7</target>

<encoding>UTF-8</encoding>

</configuration>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-war-plugin</artifactId>

<version>3.2.2</version>

</plugin>

</plugins>

</build>

  

Nexus 安装运维手册的更多相关文章

  1. 使用ansible编译安装运维工具tmux

    实验系统:CentOS 6.6_x86_64 实验前提:提前准备好编译环境,防火墙和selinux都关闭 软件介绍:tmux是一个优秀的终端复用软件,类似GNU Screen,但来自于OpenBSD, ...

  2. 最全的linux命令大全,shell运维手册

    shell实例手册 0 说明{ 手册制作: 雪松} 1 文件{        ls -rtl                 # 按时间倒叙列出所有目录和文件 ll -rt    touch file ...

  3. [转帖]Shell运维手册

    shell实例手册    https://github.com/liquanzhou/ops_doc   0 说明{       手册制作: 雪松   更新日期: 2018-09-11       欢 ...

  4. redis 运维手册

    redis cli命令 - milkty - 博客园https://www.cnblogs.com/kongzhongqijing/p/6867960.html Redis多个数据库 - EasonJ ...

  5. Hbase运维手册(1)

    1. region情况 需要检查 1. region的数量(总数和每台regionserver上的region数) 2. region的大小 如果发现异常可以通过手动merge region和手动分配 ...

  6. VERITAS NETBACKUP运维手册(自制)

    ps:本文为目录.详情请点如下目录超链接 1 VERITAS NETBACKUP介绍 1.1 NBU基本概念 1.2 配置存储单元 1.3 配置备份策略(Policy) 1.4 配置NetBackup ...

  7. redis运维手册

    版本采用:redis-3.2.11.tar.gz 官网下载地址:https://redis.io/download 1.redis服务器资源 redis服务器基础配置CPU2核.内存按需分配,系统磁盘 ...

  8. 命令行界面下使用emca安装配置Oracle Database Control实战

    作为命令行忠有用户,server端软件的运维都倾向于使用命令或 脚本完毕,非常讨厌资源占用非常大的GUI.Oracle数据库作为重要的server端软件.其安装运维自然也全然支持纯命令行方式.虽然同一 ...

  9. 2019阿里云开年Hi购季基础云产品分会场全攻略!

    2019阿里云云上Hi购季活动已经于2月25日正式开启,从已开放的活动页面来看,活动分为三个阶段: 2月25日-3月04日的活动报名阶段.3月04日-3月16日的新购满返+5折抢购阶段.3月16日-3 ...

随机推荐

  1. CentOS6.8 LAMP

    第一次配置LAMP运行环境,上网查询了很多资料,一边试命令一边学习.服务器重置了很多次. 虽然有OneinStack这个方便的网站一键命令部署,但知道这个网站却是我自己踩坑之后的事情了,故此记录. 1 ...

  2. Spring Cloud Eureka------详解

    一 Eureka服务治理体系 1.1 服务治理 服务治理是微服务架构中最为核心和基础的模块,它主要用来实现各个微服务实例的自动化注册和发现. Spring Cloud Eureka是Spring Cl ...

  3. Gitlab安装配置管理

    ◆安装Gitlab前系统预配置准备工作1.关闭firewalld防火墙# systemctl stop firewalld# systemctl disable firewalld 2.关闭SELIN ...

  4. MTV

    M:模型 models.py T:模板 html C:控制 urls.py 和 views.py 与MVC类似

  5. [bzoj1005] [洛谷P2624] 明明的烦恼

    Description 自从明明学了树的结构,就对奇怪的树产生了兴趣-- 给出标号为1到N的点,以及某些点最终的度数,允许在任意两点间连线,可产生多少棵度数满足要求的树? Input 第一行为N(0 ...

  6. GP工作室——系统设计

    团队作业第二次--系统设计 问题 答案 这个作业属于哪个课程 软件工程 这个作业要求在哪里 作业要求 团队名称 GP工作室 这个作业的目标 对项目软件进行更为详细的系统性设计 按照本游戏的设计要求,我 ...

  7. c# 三种计算程序运行时间的方法

    三种计算c#程序运行时间的方法第一种:利用 System.DateTime.Now // example1: System.DateTime.Now method DateTime dt1 = Sys ...

  8. Dynamics CRM 快速获取custom entity

    我们可以使用Command来实现快速获取custom entity的值. 创建cmd  并且在nuget中引用 CRMSDK 复制下面的代码. userName 为登陆CRM的email passwo ...

  9. 使用LD_PRELOAD注入程序

    LD_PRELOAD是Linux系统的一个环境变量,它可以影响程序的运行时的链接(Runtime linker),它允许你定义在程序运行前优先加载的动态链接库.这个功能主要就是用来有选择性的载入不同动 ...

  10. WebAPI接口开发实践

    背景 在团队两年多陆续负责了几个项目的开发上线已经代码的review,特别是对老项目的重构过程中,发现之前的API设计是没有任何规范和约定的,不同的开发同学有不同的习惯,因此需要一套规范去约定,现在分 ...