码迷,mamicode.com
首页 > 系统相关 > 详细

Linux搭建Nexus仓库

时间:2018-05-25 21:23:01      阅读:474      评论:0      收藏:0      [点我收藏+]

标签:ica   source   需要   image   env   tool   成功   1.3   bsp   

Linux搭建nexus仓库

1.安装jdk

1.1 获取安装包,解压到指定目录:

1 tar xf jdk.tar.gz -C /opt/export

1.2 配置环境变量:

1 # vim /etc/profile
2 export JAVA_HOME=/opt/export/jdk
3 export PATH=$JAVA_HOME/bin:$PATH
4 export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
5 export RUN_AS_USER=root  # 后边启动nexus需要
6 
7 # source /etc/profile

1.3 出现下面结果,说明部署成功

1 # java -version
2 java version "1.7.0_80"
3 Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
4 Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

2.安装nexus

2.1下载安装

下载地址:

https://www.sonatype.com/download-oss-sonatype
https://help.sonatype.com/repomanager2/download/download-archives---repository-manager-oss

1 cd /opt
2 tar xf nexus-2.4.0-09-bundle.tar.gz

解压后有两个目录:

1 $ ls /opt/
2 nexus-2.4.0-09  sonatype-work

更改目录名称:

1 mv nexus-2.4.0-09 nexus

2.2 更改nexus配置文件

默认端口为8081,可根据需要修改:

 1 $ vim /opt/nexus/conf/nexus.properties
 2 # Jetty section
 3 application-port=8081  # 修改为10890
 4 application-host=0.0.0.0
 5 nexus-webapp=${bundleBasedir}/nexus
 6 nexus-webapp-context-path=/nexus
 7 
 8 # Nexus section
 9 nexus-work=${bundleBasedir}/../sonatype-work/nexus
10 runtime=${bundleBasedir}/nexus/WEB-INF

2.3 关闭防火墙或打开10890端口

1 /etc/init.d/iptables stop
2 chkconfig iptables off

2.4 启动nexus

1 $ /opt/nexus/bin/jsw/linux-x86-64/nexus start
2 ****************************************
3 WARNING - NOT RECOMMENDED TO RUN AS ROOT
4 ****************************************
5 Starting Nexus OSS...
6 Started Nexus OSS.

如果没有配置环境变量RUN_AS_USER=root,会报错:

1 # /opt/nexus/bin/jsw/linux-x86-64/nexus start
2 ****************************************
3 WARNING - NOT RECOMMENDED TO RUN AS ROOT
4 ****************************************
5 If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.

2.5 检查进程和端口 

技术分享图片

 3.浏览器访问nexus

1 http://ip地址:8081/nexus
2 登录,默认用户名 admin 默认密码 admin123

 访问登录:

技术分享图片

4.迁移nexus

如果想要将nexus仓库迁移,只需要打包此目录,迁移到新nexus主机:

1 $ du -sh /opt/sonatype-work/nexus/storage
2 47G    /opt/sonatype-work/nexus/storage/

由于文件过大,可采用rsync的方式。

本文参考:https://blog.csdn.net/sunyanxiong123/article/details/68926610

 

Linux搭建Nexus仓库

标签:ica   source   需要   image   env   tool   成功   1.3   bsp   

原文地址:https://www.cnblogs.com/yangjianan/p/9090348.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!