CentOS 安装 Nexus

前端之家收集整理的这篇文章主要介绍了CentOS 安装 Nexus前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
前提:Java

1)下载
  1. # cd /usr/local/src/
  2. # wget http://www.sonatype.org/downloads/nexus-latest-bundle.tar.gz
  3. # tar -zxvf nexus-latest-bundle.tar.gz
  4. # mv /usr/local/src/nexus-2.14.1-01 /usr/local/nexus
  5. # rm -rf sonatype-work/


2)配置
  1. # vi /usr/local/nexus/bin/nexus
  2. NEXUS_HOME="/usr/local/nexus"
  3. RUN_AS_USER="nexus"
  4. PIDDIR=${NEXUS_HOME}
  5. # vi /usr/local/nexus/conf/nexus.properties
  6. application-port=8081
  7. nexus-work=${bundleBasedir}/sonatype-work/nexus
  8. # vi /usr/local/nexus/bin/jsw/conf/wrapper.conf
  9. wrapper.java.maxmemory=768


3)修改用户
  1. # groupadd nexus
  2. # useradd nexus -g nexus
  3. # cd /usr/local/
  4. # chown -R nexus:nexus nexus


4)测试配置
  1. # /usr/local/nexus/bin/nexus console
  2. Started InstrumentedSelectChannelConnector@0.0.0.0:8081
  3. # /usr/local/nexus/bin/nexus stop


5)启动服务
  1. # cp /usr/local/nexus/bin/nexus /etc/init.d/nexus
  2. # chmod 755 /etc/init.d/nexus
  3. # service nexus start
  4. Starting Nexus OSS...
  5. Started Nexus OSS.
  6. # tail -f /usr/local/nexus/logs/wrapper.log


6)设置代理服务
管理页面URL:http://<IP>:8081/nexus
账户:admin / admin123

通过 Views/Repositories -> Repositories -> Add -> Proxy Repository,创建以下两个代理:

<Maven代理仓库>
引用
Repository ID :proxied-maven-repo
Repository Name :proxied-maven-repo
Provider :Maven2
Remote Storage Location :http://maven.aliyun.com/nexus/content/groups/public/



<NPM代理仓库>
引用
Repository ID :proxied-npm-repo
Repository Name :proxied-npm-repo
Provider :npm
Remote Storage Location :https://registry.npm.taobao.org/



引用

代理仓库地址:
http://<IP>:8081/nexus/content/repositories/proxied-maven-repo/
http://<IP>:8081/nexus/content/repositories/proxied-npm-repo/


7)测试确认:

<Maven代理仓库确认>
C:\Users\rensanning\.m2\settings.xml
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <settings>
  3. <mirrors>
  4. <mirror>
  5. <id>my-repo</id>
  6. <mirrorOf>*</mirrorOf>
  7. <url>http://<IP>:8081/nexus/content/repositories/proxied-maven-repo/</url>
  8. </mirror>
  9. </mirrors>
  10. </settings>

  1. # mvn package


<NPM代理仓库确认>
  1. # npm config set registry http://<IP>:8081/nexus/content/repositories/proxied-npm-repo/
  2. # npm install -g underscore


<下载文件确认>
  1. # cd /usr/local/nexus
  2. # ll sonatype-work/nexus/storage/proxied-maven-repo
  3. # ll sonatype-work/nexus/storage/proxied-npm-repo


<下载日志确认>
  1. # tail -f /usr/local/nexus/sonatype-work/nexus/logs/request.log

猜你在找的CentOS相关文章