设为首页 收藏本站
查看: 642|回复: 0

[经验分享] CentOS 安装 SonaType Nexus Maven Repository,以及旧库迁移。

[复制链接]

尚未签到

发表于 2017-2-28 06:54:46 | 显示全部楼层 |阅读模式
  1. CentOS下安装SonaType Nexus:
  1.1 下载SonaTYpe Nexus:
  cd /usr/local/src
  wget http://download.sonatype.com/nexus/oss/nexus-2.3.1-01-bundle.tar.gz
  1.2 安装:
  cd /usr/local/src
  sudo cp nexus-2.3.1-01-bundle.tar.gz /usr/local
  cd /usr/local
  sudo tar xvzf nexus-2.3.1-01-bundle.tar.gz
  ln -s nexus-2.3.1-01 nexus
  cp nexus/bin/nexus /etc/init.d/nexus
  cd /etc/init.d
  chmod 755 /etc/init.d/nexus
  1.3 创建nexus用户/用户组:
  1.3.1 创建用户组:groupadd -g 104 nexus
  1.3.2 创建用户:useradd -u 103 -g 104 -c "Neuxs Maven Repository"  nexus
  1.4 配置属性文件/权限:
  1.4.1 配置/etc/init.d/nexus:
  vi /etc/init.d/nexus (修改如下变量)



# Set this to the root of the Nexus installation
NEXUS_HOME="/usr/local/nexus"
# 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.
RUN_AS_USER=nexus

  1.4.2 配置/usr/local/nexus/conf/nexus.properties
  vi /usr/local/nexus/conf/nexus.properties


  # Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/
  # Nexus section
nexus-work=${bundleBasedir}/sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
  1.4.3 配置/usr/local/nexus权限
  chown -R nexus:nexus /usr/local/nexus
  1.5 启动Nexus
  1.5.1 启动:
  cd /etc/init.d
  chkconfig --add nexus
  chkconfig --levels 345 nexus on
  service nexus start
  启动正常,会得到如下信息:
  Starting Nexus OSS... Started Nexus OSS.
  1.5.2 监控
  tail -f /usr/local/nexus/logs/wrapper.log
  1.5.3 查看进程
  ps -ef | grep nexus
  获得类似如下进程:
  nexus 15133 1 0 13:56 ? 00:00:00 /usr/local/nexus/bin/jsw/linux-x86-64/wrapper /usr/local/nexus/bin/jsw/conf/wrapper.conf wrapper.syslog.ident=nexus wrapper.pidfile=/usr/local/nexus/bin/jsw/linux-x86-64/nexus.pid wrapper.daemonize=TRUE
nexus    15135 15133 13 13:56 ?        00:00:21 java -Djava.library.path=bin/jsw/lib -classpath bin/jsw/lib/wrapper-3.2.3.jar:./lib/sisu-jetty8-1.4.2.jar:./lib/logback-core-1.0.7.jar:./lib/jetty-io-8.1.8.v20121106.jar:./lib/jetty-webapp-8.1.8.v20121106.jar:./lib/jetty-http-8.1.8.v20121106.jar:./lib/jetty-servlet-8.1.8.v20121106.jar:./lib/logback-classic-1.0.7.jar:./lib/jetty-server-8.1.8.v20121106.jar:./lib/appcontext-3.2.jar:./lib/jetty-xml-8.1.8.v20121106.jar:./lib/javax.servlet-3.0.0.v201112011016.jar:./lib/jetty-deploy-8.1.8.v20121106.jar:./lib/nexus-bootstrap-2.3.1-01.jar:./lib/jetty-continuation-8.1.8.v20121106.jar:./lib/jetty-security-8.1.8.v20121106.jar:./lib/nexus-logging-extras-appender-2.3.1-01.jar:./lib/jetty-rewrite-8.1.8.v20121106.jar:./lib/slf4j-api-1.7.2.jar:./lib/jetty-util-8.1.8.v20121106.jar:./lib/plexus-interpolation-1.15.jar:./lib/jetty-jmx-8.1.8.v20121106.jar:./conf/ -Dwrapper.key=3C3oeOSu3AweFCPW -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=15133 -Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.sonatype.nexus.bootstrap.jsw.JswLauncher ./conf/jetty.xml
  2. 配置Nginx:
  vi /etc/nginx/nginx.conf,加入如下server:



    server{
listen       80;
        server_name  192.168.xxx.xxx; (服务器IP或者DNS域名
        #charset koi8-r;
        #access_log  logs/host.access.log  main;

location / {
proxy_read_timeout 120;
           proxy_send_timeout 120;
           proxy_connect_timeout 120;
           proxy_set_header  X-Real-IP  $remote_addr;
           proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header Host $http_host;
           proxy_redirect off;
           proxy_pass http://localhost:8081;      
        }
error_page  404              /404.html;
        location = /404.html {
root   /usr/share/nginx/html;
        }
# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
        location = /50x.html {
root   /usr/share/nginx/html;
        }
}
  service nginx restart
  3. 登录 Sonatype Nexus
  http://192.168.XXX.XXX
  4.旧库迁移(Nexus 到 Nexus)
  旧库迁移其实非常简单,只需要将旧的库文件拷贝到新库对应位置,然后repair index就可以了。如:
  将旧库的“/usr/local/nexus/sonatype-work/nexus/storage/releases”文件夹覆盖到新库的“/usr/local/nexus/sonatype-work/nexus/storage/releases”,然后“repair index”(需要花费一点时间),就可以了。
  参考:https://support.sonatype.com/entries/21602547-How-do-I-migrate-an-existing-repository-to-Nexus-
  4.旧库迁移(其他仓库到 Nexus)
  官网有详细的描述:http://www.sonatype.com/books/nexus-book/reference/migrating.html

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-348066-1-1.html 上篇帖子: Eclipse 插件 —— RunJettyRun 的下载、安装与使用 下篇帖子: javamelody对Java Application进行监控
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表