centos7 手动搭建maven私人仓库nexus

  • A+
所属分类:体育平台

centos7 手动搭建maven私人仓库nexus

手动对标基于docker的快速搭建

1. 安装java并配置环境变量

yum remove *openjdk*
rpm -ivh jdk-8u112-linux-x64.rpm 
vim /etc/profile
    export JAVA_HOME=/usr/java/jdk1.8.0_112
    export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile

2. 安装maven

yum install maven
mvn -version

3. 安装nexus:我是安装在 /home/maven/nexus上

cd /home/maven/nexus
wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.14.5-02-bundle.tar.gz
tzr -xzvf  nexus-2.14.5-02-bundle.tar.gz
mv nexus-2.14.5-02 nexus

4. 安装nexus到系统服务

cp nexus/bin/nexus /etc/init.d/nexus

vim /etc/init.d/nexus
    NEXUS_HOME="/home/data/maven/nexus"
    PLATFORM=linux-x86-64
    PLATFORM_DIR="${NEXUS_HOME}/bin/jsw/${PLATFORM}"
    RUN_AS_USER=root

5. 修改nexus默认用户名密码

  • 浏览器打开 域名:8081/nexus
  • 右上角login:默认用户名密码:admin admin123
  • 修改管理密码,左边导航栏:security>users>在admin用户上右键>set password

6. 仓库配置说明:

修改 setting.xml文件 增加

<mirrors>
  <mirror> 
      <id>central</id> 
      <mirrorOf>*</mirrorOf> 
      <name>central-mirror</name> 
      <url>http://域名或IP:8081/nexus/content/groups/public/</url> 
  </mirror> 
</mirrors>

7. 在pom中使用私服:

 <repositories>
        <repository>
            <id>id</id>
            <name>nexus</name>
            <url>http://域名或IP:8081/nexus/content/groups/public/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>id</id>
            <name>nexus</name>
            <url>http://域名或IP:8081/nexus/content/groups/public/</url>
        </pluginRepository>
    </pluginRepositories>

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: