Centos7下按照配置nexus2

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7下按照配置nexus2相关的知识,希望对你有一定的参考价值。

一、什么是Nexus

技术分享图片

二、安装并配置Nexus

[[email protected] ~]# http://www.sonatype.com/download-oss-sonatype
[[email protected] ~]# tar -xf nexus-2.13.0-01-bundle.tar.gz
[[email protected] ~]# cd nexus-2.13.0-01/bin
[[email protected] ~]# mv nexus-2.13.0-01 /usr/local/
[[email protected] ~]# cd /usr/local/
[[email protected] local]# ls
apache-maven-3.3.9             bin  games    lib    libexec  nexus-2.13.0-01  sbin   src
apache-maven-3.3.9-bin.tar.gz  etc  include  lib64  maven    nodejs           share
[[email protected] local]# ln -s nexus-2.13.0-01 nexus
[[email protected] local]# cd /usr/local/nexus
[[email protected] nexus]# ls
bin  conf  lib  LICENSE.txt  logs  nexus  NOTICE.txt  tmp
[[email protected] nexus]# cp bin/nexus /etc/init.d/
[[email protected] nexus]# chmod 755 /etc/init.d/nexus 
[[email protected] nexus]# chown root /etc/init.d/nexus 、
[[email protected] nexus]# vim /etc/init.d/nexus
NEXUS_HOME="/usr/local/nexus"
RUN_AS_USER=root
[[email protected] init.d]# cd /etc/init.d/
[[email protected] init.d]# chkconfig --add nexus
[[email protected] init.d]# chkconfig --levels 345 nexus on
[[email protected] init.d]# service nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.

三、登录Nexus界面

登录界面:http://{ip}:8081/nexus/
默认用户名密码 admin admin123

四、Nexus的流程

Nexus MAVEN的私有仓库
如果没有nexus 项目的打包都需要通过公网下载
不利于包的管理和共用
如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的Maven仓库下载到本地,而一个团队中的所有人都重复的从maven仓库下载构件
技术分享图片
部署工作流:
技术分享图片

五、Apache Maven

Apache Maven
To use Nexus Repository Manager Pro and Nexus Repository Manager OSS with Apache Maven, configure Maven to check the repository manager instead of the default, built-in connection to the Central Repository.

To do this, you add a mirror configuration and override the default configuration for the central repository in your ~/.m2/settings.xml as shown:

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

六、参考资料:

以上是关于Centos7下按照配置nexus2的主要内容,如果未能解决你的问题,请参考以下文章

仅在按照意图进行时才更改片段(在这种情况下,他们实际上共享应用程序)

maven私库nexus2.3.0-04迁移升级到nexus-3.16.1-02(异机迁移备份)

CentOS7创建nginx服务并配置开机自启

Javascript代码片段在drupal中不起作用

linux 安装配置nexus以及maven私服应用

NAT模式下VMware中CentOS7无法连接外网的解决方法