1. Nexus 安装与配置

1.1 下载Nexus

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

1.2 安装Nexus

  1. #将tar包上传到服务器/usr/local/目录下解压,这个时候会出现 nexus-3.16.1-02、sonatype-work 两个文件夹
  2.  
  3. tar -zxvf nexus-3.16.1-02-unix.tar.gz  
  4.  
  5. #修改配置文件,eg:端口号
  6.  
  7. cd /usr/local/nexus-3.16.1-02/etc
  8.  
  9. vim nexus-default.properties

1.3 启动Nexus

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

  1. #修改启动用户run_as_user,建议不要使用root
  2.  
  3. vim /usr/local/nexus-3.16.1-02/bin/nexus.rc
  4.  
  5. #
  6. cd /usr/local/nexus-3.16.1-02/bin
  7.  
  8. ./nexus start --后台启动
  9.  
  10. ./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包打到私服中;

  1. #将下面的脚本丢到需要上传jar包的文件目录下
    chmod u+x mavenimport.sh
    ./mavenimport.sh -u admin -p admin123 -r http://192.168.209.128:8081/repository/lingan/
  1. #!/bin/bash
  2. # copy and run this script to the root of the repository directory containing files
  3. # this script attempts to exclude uploading itself explicitly so the script name is important
  4. # Get command line params
  5.  
  6. while getopts ":r:u:p:" opt; do
  7. case $opt in
  8. r) REPO_URL="$OPTARG"
  9. ;;
  10. u) USERNAME="$OPTARG"
  11. ;;
  12. p) PASSWORD="$OPTARG"
  13. ;;
  14. esac
  15. done
  16.  
  17. 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

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

2.3 配置Maven

  1. #配置release、snapshot的用户信息;
  2. #配置mirror指向私服的nexus-public;
  3. 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. DP-Fibonacci

    善于发现 DP 中的 Fibonacci 我们在做 DP  题时  , 会发现有一些题 类似于找规律的题 ,观察测试样例 , 要对数据敏感 , 比如输入 2 输出 1 , 输入 3 就输出 2 …… ...

  2. Git创建远程分支并提交代码到远程分支

    1.可以在VS中新建分支 2.可以通过git branch -r 命令查看远端库的分支情况 这些红色都是远程的分支 3.从已有的分支创建新的分支(如从master分支),创建一个dev分支 (不用vs ...

  3. 13.系统总结static

    static修饰属性和方法: package com.oop.demo08; //static :被static修饰的变量或者方法随类加载,从属于类,当然对象也可以调用 public class St ...

  4. maven版本对应的jdk

    今天配置项目环境发现jdk1.6与maven-3.39不能匹配 查询jdk与maven的版本对应关系 关系网址:http://maven.apache.org/docs/history.html Ma ...

  5. 洛谷P3335 [ZJOI2013]蚂蚁寻路

    题目描述 在一个 n*m 的棋盘上,每个格子有一个权值,初始时,在某个格子的顶点处一只面朝北的蚂蚁,我们只知道它的行走路线是如何转弯,却不知道每次转弯前走了多长. 蚂蚁转弯是有一定特点的,即它的转弯序 ...

  6. mezzanine 历险记

    安装去github下载 mezzanine https://github.com/ganmk/mezzanine 安装出现问题了: grappelli_safe >= 0.4.5 问题好像出在这 ...

  7. UVA 最大面积最小三角形剖分

    点击打开题目 题目大意: 以顺时针或逆时针给出一个简单多边形的n个点的坐标,用n-2条互不相交的,且与边不相交的对角线,分成n-2个三角形,要求其中最大三角形的面积最小 开始还汪星人咬乌龟,无从下口, ...

  8. 利用geojson实现模型轨迹运动

    直接上代码 var viewer = new Cesium.Viewer('cesiumContainer'); //Set the random number seed for consistent ...

  9. ElasticSearch入门篇Ⅰ --- ES核心知识概括

    C01.什么是Elasticsearch 1.什么是搜索 垂直搜索(站内搜索) 互联网的搜索:电商网站,招聘网站,各种app IT系统的搜索:OA软件,办公自动化软件,会议管理,员工管理,后台管理系 ...

  10. 释放innodb空间

    记一次MySQL运维 [root@b2btest ~]# free -h total used free shared buffers cached Mem: 125G 124G 780M 13M 2 ...