1.下载Nexus
地址: https://pan.baidu.com/s/1D5AI6zmuRBSMK0k7j41VuQ
提取码: q50j
选择02-nexus
2.新建nexus账号
useradd nexus
重置密码
passwd nexus
123456
3.更改文件属性
chown -R nexus:nexus /opt/nexus/nexus-2.14.15-01/
chown -R nexus:nexus /opt/nexus/sonatype-work/
4.修改端口
cd /opt/nexus/nexus-2.14.15-01/conf
vi nexus.properties
# # Sonatype Nexus (TM) Open Source Version # Copyright (c) 2008-present Sonatype, Inc. # All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. # # This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, # which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. # # Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks # of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the # Eclipse Foundation. All other trademarks are the property of their respective owners. # # Sonatype Nexus # ============== # This is the most basic configuration of Nexus. # Jetty section application-port=8081 application-host=192.168.125.139 nexus-webapp=${bundleBasedir}/nexus nexus-webapp-context-path=/nexus # Nexus section nexus-work=${bundleBasedir}/../sonatype-work/nexus runtime=${bundleBasedir}/nexus/WEB-INF # orientdb buffer size in megabytes storage.diskCache.bufferSize=4096
5.修改环境变量
vi /etc/profile
新增如下配置
#set nexus enviroment NEXUS_HOME=/opt/nexus/nexus-2.14.15-01 PATH=$PATH:$NEXUS_HOME/bin export NEXUS_HOME
刷新生效
source /etc/profile
6.开机启动
# vi /etc/rc.d/rc.local
# set nexus auto-run when open system
su - nexus -c '/opt/nexus/nexus-2.14.15-01/bin/nexus start'
#复制脚本cp /opt/nexus/nexus-2.14.15-01/bin/nexus /etc/init.d/nexus
#添加系统服务:chkconfig --add nexus
#设置启动级别为345:chkconfig --levels 345 nexus on
#查看是否添加成功:chkconfig --list|grep nexus
#vi /etc/init.d/nexus
#第一行 设置启动账号
#RUN_AS_USER="root"
#将NEXUS_HOME=".."
修改为NEXUS_HOME="
/opt/nexus/nexus-2.14.15-01/
"
#重启 reboot查看nexus是否启动,ps –ef|grep nexus
7.系统访问验证
http://192.168.125.139:8081/nexus
9.修改账号
默认账号 admin/admin123
请修改登录密码
10.重启再次验证
居然启动失败了,切换nexus账号输入 nexus console 执行一半失败了
经过日志分析2个原因:
a./opt/nexus/目录下面的有文件的所有这发生了变化,既文件的所属和权限发生了变化
b./opt/nexus/sonatype-work/nexus/conf/nexus.xml 删除该文件,运行时会自动生成
c.vi /etc/hosts 添加 127.0.0.1 机器名
经过以上分析修正后,执行正常了。