CentOS 7 安装nexus
2019独角兽企业重金招聘Python工程师标准>>>
1、下载nexus ,使用版本nexus-3.13.0-01-unix.tar.gz,下载地址
https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.13.0-01-unix.tar.gz
2、解压后移动到安装目录(/opt/nexus)
创建安装目录
[root@ou Downloads]# mkdir /opt/nexus/
解压安装包到安装目录:
[root@ou Downloads]# tar -zxvf nexus-3.13.0-01-unix.tar.gz -C /opt/nexus/
切换到安装目录:
[root@ou Downloads]# cd /opt/nexus
查看目录详情:
[root@ou nexus]# ls
nexus-3.13.0-01 sonatype-work
解压缩后可以看到有两个文件夹,第一个是nexus服务,第二个是它的私有仓库目录。 这时已经可以启动 nexus
进入位置:NEXUS_HOME/bin
本示例位置:
/opt/nexus/nexus-3.13.0-01/bin
进入bin目录:
[root@ou nexus]# cd nexus-3.13.0-01/bin
[root@ou bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
当用root权限运行时会弹出提示,解决方式是
[root@ou bin]# vim nexus
在配置文件上部找到
#RUN_AS_USER=
在下一行添加
RUN_AS_USER=root
具体示例:
# the JVM and is not useful in situations where a privileged resource or
# port needs to be allocated prior to the user being changed.
#RUN_AS_USER=
RUN_AS_USER=root
3、设置系统服务
3.1、添加 NEXUS_HOME 环境变量
vim /etc/profile
在后面添加
export NEXUS_HOME=/opt/nexus/nexus-3.13.0-01
使新加入的内容生效
source /etc/profile
3.2、添加本地jdk
vim /opt/nexus/nexus-3.13.0-01/bin/nexus
在文件中找到 INSTALL4J_JAVA_HOME_OVERRIDE 这一行(这一行默认被注释),添加上自己的JDK路径
INSTALL4J_JAVA_HOME_OVERRIDE=/usr/java/jdk1.8.0_181-amd64
3.3、配置以 nexus 用户启动应用
nexus 官网建议不要使用 root 帐户启动应用,所以创建一个 nexus 用户
useradd nexus
修改 nexus 配置,使用 nexus 作为应用启动的帐户
gedit /opt/nexus/nexus-3.13.0-01/bin/nexus.rc
将内容修改为
run_as_user=”nexus”
修改 nexus 的目录权限
chown nexus nexus
3.4、设置系统服务(systemd)
vi /usr/lib/systemd/system/nexus.service
[Unit]
Description=nexus
After=network.target[Service]
Type=forking
ExecStart=/opt/nexus/nexus-3.13.0-01/bin/nexus start
ExecReload=/opt/nexus/nexus-3.13.0-01/bin/nexus stop
ExecStop=/opt/nexus/nexus-3.13.0-01/bin/nexus stop
PrivateTmp=true[Install]
WantedBy=multi-user.target
然后执行 systemctl daemon-reload,重新加载服务
再执行 systemctl enable nexus,使该服务可以开机自启。
启动服务 systemctl start nexus
4、登陆管理界面
默认管理地址为:http://localhost:8081/nexus/ 使用界面右上角log in进行默认用户的登陆,
默认用户为:admin,密码为:admin123。
5、点击左侧的users查看当前系统的用户。
可以看到一共三个用户,admin,deployment和anonymous。
admin:该用户拥有Nexus的全部权限,默认密码为admin123。
deployment:该用户能够访问Nexus,浏览仓库内容、搜索、上传部署构件,但是不能对Nexus进行任何配置,默认密码为deployment123。
anonymous:该用户对应了所有未登录的匿名用户,它们可以浏览仓库并进行搜索
6、集成Maven 打开本地 %M2_HOME%\conf\settings.xml 文件 6.1、设置本地仓库位置
<localRepository>/opt/apache-maven-3.5.4/repository</localRepository>
6.2、设置 Server
<server><id>nexus-releases</id><username>admin</username><password>admin123</password>
</server>
<server><id>nexus-snapshots</id><username>admin</username><password>admin123</password>
</server>
6.3、设置 Nexus 镜像(localhost 修改为安装 Nexus 的服务器地址)
<mirror><id>nexus</id><mirrorOf>*</mirrorOf><url>http://localhost:8081/repository/maven-public/</url>
</mirror>
6.4、设置 Profile(localhost 修改为安装 Nexus 的服务器地址)
<profile><id>nexus-resp</id><repositories><repository><id>nexus-releases</id><url>http://localhost:8081/repository/maven-releases/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></repository><repository><id>nexus-snapshots</id><url>http://localhost:8081/repository/maven-snapshots/</url><releases><enabled>false</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>nexus-plugin</id><url>http://localhost:8081/repository/maven-public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository></pluginRepositories>
</profile>
6.5、设置默认激活的 profile
<activeProfiles><activeProfile>nexus-resp</activeProfile>
</activeProfiles>
6.6、修改工程pom文件
<distributionManagement><repository><id>nexus-releases</id><name>Team Nexus Release Repository</name><url>http://localhost:8081/repository/maven-releases/</url></repository><snapshotRepository><id>nexus-snapshots</id><name>Team Nexus Snapshot Repository</name><url>http://localhost:8081/repository/maven-snapshots/</url></snapshotRepository>
</distributionManagement><repositories><repository><id>nexus-public</id><name>Nexus public Repository</name><url>http://localhost:8081/repository/maven-public</url></repository>
</repositories>
操作完成,执行 mvn deploy,应该就可以 Nexus 上查找到你当前项目了。
转载于:https://my.oschina.net/ouyushan/blog/1935515
CentOS 7 安装nexus相关推荐
- docker安装nexus私服
docker安装Maven私服nexus3 1 简介 2 Maven 2.1 Nexus私服 2.2 Docker 4 私服搭建过程 4.1 外网操作 4.1.1 下载和安装docker 4.1.2 ...
- linux 卸载nexus,CentOS7安装Nexus
1.环境 CentOS Linux release 7.5.1804 jdk-8u181-linux-x64.rpm nexus-3.13.0-01 2.JDK RPM安装 已安装JDK请跳过 #查看 ...
- CentOS 8 安装图解
继 RHEL 8 发布之后,CentOS 社区也发布了让人期待已久的 CentOS 8,并发布了两种模式: CentOS stream:滚动发布的 Linux 发行版,适用于需要频繁更新的开发者 Ce ...
- centOS 自动安装php
centos下安装php #yum install -y php 这个只安装PHP 建议安装运行库及MySQL的支持 #yum install -y php php-devel php-mysql 如 ...
- Centos下安装mysql 总结
一.MySQL安装 Centos下安装mysql 请点开:http://www.centoscn.com/CentosServer/sql/2013/0817/1285.html 二.MySQL的几个 ...
- linux卸载欧朋浏览器,如何在Centos下安装opera浏览器
如何在Centos下安装opera浏览器 ,Opera目前是Linux平台上性能最优的浏览器,而且Opera中国团队本身即定位于Opera的研发中心,主要也是负责全球Linux平台项目的开发,这个版本 ...
- 如何在Ubuntu/CentOS上安装Linux内核4.0
如何在Ubuntu/CentOS上安装Linux内核4.0 大家好,今天我们学习一下如何从Elrepo或者源代码来安装最新的Linux内核4.0.代号为'Hurr durr I'm a sheep'的 ...
- CentOS 7 安装 Jenkins
CentOS 7 安装 Jenkins 准备工作 首选需要安装JAVA环境 这个简单不说了 如果你的系统没有自带git,那么也需要安装一个 yum install git 1.安装 第一种方法 sud ...
- centos+ffmpeg安装配置+切片
在虚拟机vmware6(版本比较旧了)中,安装centos6,不多说了. vmware虚拟工具安装前,需要安装如下内容 yum -y install kernel-devel yum -y insta ...
最新文章
- Android拷贝工程不覆盖原工程的配置方法
- spring boot 搭建 和 全局异常处理
- ubuntu10.04 安装virtualbox
- linux 日志文件utmp、wtmp、lastlog、messages介绍
- Web布局连载——两栏固定布局(五)
- linux lamp架构部署,Centos7部署LAMP平台之架构之路
- 用Syslog 记录UNIX和Windows日志的方法
- python php perl,python 调用 php 范例
- java 变量初始化_浅谈Java变量的初始化顺序详解
- 王飞跃教授:生成式对抗网络GAN的研究进展与展望
- matlab上机操作作业指导书,LED自动固晶基本操作1
- 【U盘量产】你的U盘坏了吗
- overlay/static/register/atuo/extern/volatile/const 修饰符的用法
- 复杂句变简单句 java_【SAT写作】简单句如何变为复杂句?10招教你快速转变
- pycharm 添加已有文件
- token 自动续期的方案
- cl.clus pw index.php,Application Essay 写作 第五课 Introductions and Conclus
- 3900x做服务器性能怎么样,AMD Ryzen 9 3900X评测:向消费级性能王者宝座进发
- 传腾讯计划出售美团全部股权,知情人士辟谣;苹果证实iOS 16要大量推送广告;Linux 6.0-rc1 发布|极客头条
- protues VSM 图形仿真帮助
热门文章
- 360面试题计算机面试题,奇虎360软件测试面试经验
- html绘制头像原样教程,CSS实例教程:创意CSS3头像展示教程
- python中如何定义一个数组_Python数组定义方法
- mysql linux 中文乱码_解决MySQL中文乱码的问题
- ieee39节点系统介绍_太原理工大学 秦文萍,逯瑞鹏等:大规模新能源接入对电气耦合综合能源系统稳定性有何影响?...
- 联通突然从4g变成3g了_中国联通最快明年底2G全面退网 并推进3G逐步退网
- mysql连接池为何不用nio_MyCAT 在 Cobar 的基础上,完成了彻底的 NIO 通讯,并且合并了两个线程池...
- mysql 列选项_列未显示在“列”选项卡中(MySQL Workbench)
- 【研发管理】聊一聊DevOps
- Mono制作安装包让C#桌面应用程序脱离net framework步骤