CentOS安装Nexus:(一)安装Maven私服
来源:互联网 发布:淘宝举报售假文章 编辑:程序博客网 时间:2024/05/21 09:24
一、概述
使用Nexus搭建私服的主要背景是:我们做的是内容管理平台EMC Documentum产品的二次开发有很多平台所特有的第三方jar包需要管理,同时需要用Nexus简化内部仓库的维护和外部仓库的访问。有了私服之后,当 Maven 需要下载构件时,直接请求私服,私服上存在则下载到本地仓库;否则,私服请求外部的远程仓库,将构件下载到私服,再提供给本地仓库下载。
二、前期准备
操作系统:CentOS Linux release 7.2.1511 (Core)
Nexus版本:nexus-2.14.0-01-bundle.tar.gz
Nexus下载路径:http://www.sonatype.org/nexus/archived/
JDK版本:jdk-8u101-linux-x64.rpm
三、解压Nexus
[root@localhost opt]# tar zxvf nexus-2.14.0-01-bundle.tar.gz
注意:安装nexus,本地仓库默认的jar包存储位置是:/sonatype-work/nexus/storage/central。由于Central仓库占用存储较大,所以要注意存储位置。
四、移动到合适的位置:/usr/local
[root@localhost opt]# mv nexus-2.14.0-01 /usr/local
[root@localhost opt]# mv sonatype-work/ /usr/local
五、修改配置文件1:/usr/local/nexus-2.14.0-01/conf/nexus.properties
# Sonatype Nexus# ==============# This is the most basic configuration of Nexus.# Jetty section</span>
#配置端口信息application-port=8081application-host=0.0.0.0nexus-webapp=${bundleBasedir}/nexus
<span style="font-size:14px;"><span style="font-size:10px;">#配置nexus应用名称,不用修改nexus-webapp-context-path=/nexus# Nexus sectionnexus-work=${bundleBasedir}/../sonatype-work/nexusruntime=${bundleBasedir}/nexus/WEB-INF# orientdb buffer size in megabytesstorage.diskCache.bufferSize=4096
六、修改配置文件2:
/usr/local/nexus-2.14.0-01/bin/nexus
# Set this to the root of the Nexus installation
#建议使用绝对路径NEXUS_HOME="/usr/local/nexus-2.14.0-01"# If specified, the Wrapper will be run as the specified user.# IMPORTANT - Make sure that the user has the required privileges to write into the Nexus installation directory.# NOTE - This will set the user which is used to run the Wrapper as well as# the JVM and is not useful in situations where a privileged resource or# port needs to be allocated prior to the user being changed.
#设置为root用户启动,如果需要可设置为其他用户启动,不过需要用户赋予nexus home目录的操作权限RUN_AS_USER=root
七、启动Nexus
[root@localhost bin]# ./nexus start ****************************************WARNING - NOT RECOMMENDED TO RUN AS ROOT****************************************Starting Nexus OSS...Started Nexus OSS.[root@localhost bin]#
注意,这里不建议使用root用户来运行nexus,使用其他用户我们需要考虑一下文件系统的权限问题,不然程序可能无法启动,报出Permissiondenied错误 ,使用root用户执行如下命令 :
chmod -R o+w {nexus-home}/{nexus-home}表示nexus的根目录
上面的命令将nexus整个文件夹(包括其子文件和子文件夹)向普通用户开放了write权限,于是我们就可以使用普通用户执行nexus脚本了,执行命令./nexusstart
[root@localhost logs]# pwd/usr/local/nexus-2.14.0-01/logs[root@localhost logs]# lswrapper.log[root@localhost logs]# tail -f wrapper.log jvm 1 | 2016-10-17 06:29:45,193-0400 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.configuration.ModelUtils - Loading model /usr/local/sonatype-work/nexus/conf/lvo-plugin.xmljvm 1 | 2016-10-17 06:29:45,407-0400 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.webresources.internal.WebResourceServiceImpl - Discovered 1971 resourcesjvm 1 | 2016-10-17 06:29:45,408-0400 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.webresources.internal.WebResourceServlet - Max-age: 30 days (2592000 seconds)jvm 1 | 2016-10-17 06:29:45,430-0400 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.InstrumentedSelectChannelConnector - Metrics enabledjvm 1 | 2016-10-17 06:29:45,441-0400 INFO [jetty-main-1] *SYSTEM org.eclipse.jetty.server.AbstractConnector - Started InstrumentedSelectChannelConnector@0.0.0.0:8081jvm 1 | 2016-10-17 06:29:45,441-0400 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Runningjvm 1 | 2016-10-17 06:29:45,441-0400 INFO [WrapperListener_start_runner] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Started
日志:*SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Started则启动成功
九、配置成服务并开机启动
[root@localhost bin]# pwd/usr/local/nexus-2.14.0-01/bin[root@localhost bin]# cp nexus /etc/rc.d/init.d/ [root@localhost bin]# cd /etc/rc.d/init.d/[root@localhost init.d]# lsfunctions jexec netconsole network nexus README[root@localhost init.d]# chkconfig --add nexus [root@localhost init.d]# chkconfig --list | grep nexus 注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。 如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。 欲查看对特定 target 启用的服务请执行 'systemctl list-dependencies [target]'。nexus 0:关1:关2:开3:开4:开5:开6:关[root@localhost init.d]# chkconfig nexus on [root@localhost init.d]# chkconfig --list | grep nexus 注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。 如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。 欲查看对特定 target 启用的服务请执行 'systemctl list-dependencies [target]'。nexus 0:关1:关2:开3:开4:开5:开6:关[root@localhost init.d]#
十、访问与启停
访问地址:http://ip:8081/nexus
启动:service nexus start
停止:service nexus stop
重启:service nexus restart
十一、常见问题
1,地址不能访问,可能原因防火墙问题,解决办法如下:
/sbin/iptables -I INPUT -p tcp --dport 8081 -j ACCEPT/etc/rc.d/init.d/iptables save/etc/init.d/iptables restart
2,配置成服务启动时遇到的错误,如下:
[root@localhost init.d]# service nexus stopMissing platform binary: /etc/rc.d/init.d/../bin/jsw/linux-x86-64/wrapper解决办法:vi /etc/rc.d/init.d/nexus
# Set this to the root of the Nexus installation#此处最好设置为绝对路径NEXUS_HOME="/usr/local/nexus-2.14.0-01"
- CentOS安装Nexus:(一)安装Maven私服
- Nexus搭建Maven私服(一) Maven安装
- CentOS安装Nexus:(二)配置及使用Maven私服
- CentOS安装nexus(Maven仓库管理器)
- centos 安装配置 nexus maven私有仓库
- CentOS安装nexus(Maven仓库管理器)
- CentOS安装nexus(Maven仓库管理器)
- centos下安装maven和nexus
- centos 7安装nexus私服
- 安装配置maven私服--nexus
- maven(13)-安装nexus私服
- Mac安装Nexus Maven私服
- linux 安装maven私服nexus
- maven(10)------maven私服Nexus安装
- CentOS下Nexus安装
- centos 下安装nexus
- centos下nexus安装
- Maven Nexus 安装配置
- 153.Combination Sum II-数字组合 II(中等题)
- 跨平台AR增强现实开发(四)(高通识别图5星处理方式)
- 棋牌游戏开发之斗地主算法点选牌
- 我的未来
- 工作学习之spring:spring初始化读取xml配置文件
- CentOS安装Nexus:(一)安装Maven私服
- 刘金金16年的8月9月10月
- 一个数如果恰好等于它的因子之和,这个数就称为 "完数 "。例如6=1+2+3.编程 找出1000以内的所有完数。
- MySQL5.7.9,怎样永久设置client、connection、results这三项为utf8?
- ViewPager + Fragment实现滑动标签页
- 斗地主算法逻辑中的天之道
- VS2012正则查找
- Codeforces 731C Socks(并查集)
- Android情景模式、文件管理器 完整示例编程详解