目次
1.Nexusの紹介
Mavenの場合、ウェアハウスはローカルウェアハウスとリモートウェアハウスの2つのカテゴリに分類されます。プライベートサーバーの構築に使用できる、chiva、Artifactory、Nexusの3つの専用Mavenウェアハウス管理ソフトウェアがあります。Nexusは現在、最も人気のあるMaven倉庫管理ソフトウェアです。Nexusには、プロキシウェアハウス、ホストウェアハウス、ウェアハウスグループなど、さまざまなタイプのウェアハウスの概念が含まれています。各ウェアハウスには、ユーザーがニーズに応じてカスタマイズするのに便利な、豊富な実用的な構成パラメーターが用意されています。
2、2.X環境のインストールと展開
例として2.Xの最新バージョンを取り上げます。バージョン番号は2.14.16です。
1.Nexus公式ウェブサイトのダウンロードアドレス
https://www.sonatype.com/download-oss-sonatype
2.Xバージョンのダウンロードリンク:https://help.sonatype.com/repomanager2/download
3.Xバージョンのダウンロードアドレス:https://help.sonatype.com/repomanager3/download
2.ローカルに解凍します
tar -xzvf nexus-2.14.16-01-bundle.tar.gz
3. Nexusポートを変更します(デフォルトは8081)
ここのクエリポートはすでに占有されているので、ポートvi nexus.propertiesを変更する必要があります。ここでは、application-portを8090に変更します。
[root@yang opt]# netstat -aon | grep "8081"
tcp6 0 0 :::8081 :::* LISTEN off (0.00/0/0)
[root@yang opt]# lsof -i :8081
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
jsvc 17634 web 49u IPv6 63482708 0t0 TCP *:tproxy (LISTEN)
[root@yang opt]# ps -ef | grep 17634
root 7323 31243 0 11:27 pts/0 00:00:00 grep --color=auto 17634
web 17634 17633 0 Jan16 ? 03:58:22 jsvc.exec -java-home /opt/jdk1.8.0_151 -user web -pidfile /export/apache-tomcat-8.5.43/logs/catalina-daemon.pid -wait 10 -outfile /export/apache-tomcat-8.5.43/logs/catalina-daemon.out -errfile &1 -classpath /export/apache-tomcat-8.5.43/bin/bootstrap.jar:/export/apache-tomcat-8.5.43/bin/commons-daemon.jar:/export/apache-tomcat-8.5.43/bin/tomcat-juli.jar -Djava.util.logging.config.file=/export/apache-tomcat-8.5.43/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dignore.endorsed.dirs= -Dcatalina.base=/export/apache-tomcat-8.5.43 -Dcatalina.home=/export/apache-tomcat-8.5.43 -Djava.io.tmpdir=/export/apache-tomcat-8.5.43/temp org.apache.catalina.startup.Bootstra
[root@yang conf]# vi nexus.properties
#
# Sonatype Nexus (TM) Open Source Version
# Copyright (c) 2008-present Sonatype, Inc.
# All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
#
# This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
# which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
#
# Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
# of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
# Eclipse Foundation. All other trademarks are the property of their respective owners.
#
# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.
# Jetty section
application-port=8090
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus
# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
# orientdb buffer size in megabytes
storage.diskCache.bufferSize=4096
4.ファイアウォールを開きます
vi / etc / sysconfig / iptables
追加:-A INPUT -p tcp -m state --state NEW -m tcp --dport 8090 -j ACCEPT
service iptables restart
5.スタートアップファイルを変更します
/opt/nexus-2.14.16-01/bin/nexusルートスタートアップを追加するか、nexusユーザー(useradd nexus)を追加します。
断则启PIN报错rootとして実行することを主張する場合は、このスクリプトを実行する前に、環境変数RUN_AS_USER = rootを設定してください。
RUN_AS_USER = rootを変更します//前の#を削除するように注意してください
JDKパスを変更しますviwrapper.conf(./ bin / jsw / conf / wrapper.conf)
パラメータwrapper.java.library.path.1 = / opt / jdk1.8.0_151 / bin /を変更します
6、開始
/opt/nexus-2.14.16-01/bin/nexus
[root@yang bin]# ./nexus start &
[1] 2514
[root@yang bin]# ****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.
[1]+ Done ./nexus start
[root@yang bin]# ps -ef | grep nexus
root 2558 1 0 14:03 ? 00:00:00 /opt/nexus-2.14.16-01/bin/../bin/jsw/linux-x86-64/wrapper /opt/nexus-2.14.16-01/bin/../bin/jsw/conf/wrapper.conf wrapper.syslog.ident=nexus wrapper.pidfile=/opt/nexus-2.14.16-01/bin/../bin/jsw/linux-x86-64/nexus.pid wrapper.daemonize=TRUE wrapper.lockfile=/var/lock/subsys/nexus
root 2564 2558 87 14:03 ? 00:00:24 java -Djava.io.tmpdir=./tmp -Djava.net.preferIPv4Stack=true -Dcom.sun.jndi.ldap.connect.pool.protocol=plain ssl -Xms256m -Xmx768m -Djava.library.path=/opt/jdk1.8.0_151/bin/ -classpath bin/jsw/lib/wrapper-3.2.3.jar:./lib/jetty-server-8.1.16.v20140903.jar:./lib/jetty-http-8.1.16.v20140903.jar:./lib/metrics-jetty-2.2.0.jar:./lib/logback-core-1.2.3.jar:./lib/jetty-servlet-8.1.16.v20140903.jar:./lib/metrics-core-2.2.0.jar:./lib/logback-access-1.2.3.jar:./lib/nexus-bootstrap-2.14.16-01.jar:./lib/jetty-xml-8.1.16.v20140903.jar:./lib/jul-to-slf4j-1.7.25.jar:./lib/jetty-util-8.1.16.v20140903.jar:./lib/jetty-client-8.1.16.v20140903.jar:./lib/javax.servlet-3.0.0.v201112011016.jar:./lib/jetty-io-8.1.16.v20140903.jar:./lib/jetty-deploy-8.1.16.v20140903.jar:./lib/logback-classic-1.2.3.jar:./lib/jetty-rewrite-8.1.16.v20140903.jar:./lib/jetty-continuation-8.1.16.v20140903.jar:./lib/slf4j-api-1.7.25.jar:./lib/plexus-interpolation-1.16.jar:./lib/metrics-logback-2.2.0.jar:./lib/jetty-webapp-8.1.16.v20140903.jar:./lib/jetty-security-8.1.16.v20140903.jar:./lib/jetty-jmx-8.1.16.v20140903.jar:./conf/ -Dwrapper.key=iRiyGKHQ9Yp5stNP -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=2558 -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 ./conf/jetty-requestlog.xml
7.ネクサスにアクセス
http:// ip address:8090 / nexus / デフォルトのアカウントとパスワード:admin / admin123
3、3.X環境のインストールと展開
3.xと2.xの間にはいくつかの違いがあり、ここにも記録されています
3.Xバージョンのダウンロードアドレス:https://help.sonatype.com/repomanager3/download
1.解凍します
tar -xzvf nexus-3.21.2-03-unix.tar.gz
解凍後、nexus-3.21.2-03とsonatype-workの2つのフォルダーがあります。
2.Nexusのデフォルトポートを変更します
パスにわずかな変更があります。構成ファイルはパス/opt/nexus-3.21.2-03/etcvinexus-default.propertiesの下にあります。
ここでapplication-port = 8091に変更します
3.ファイアウォールをオンにします
vi / etc / sysconfig / iptables
追加:-A INPUT -p tcp -m state --state NEW -m tcp --dport 8091 -j ACCEPT
service iptables restart
4.スタートアップユーザーを追加します
テスト後、rootを使用して開始すると、かなり多くの問題が発生します。ここで、nexusユーザーを追加して開始します。
useraddネクサス
ファイルが属するユーザーとユーザーグループを変更します。
chown -R nexus:nexus /opt/nexus-3.21.2-0
chown -R nexus:nexus / opt / sonatype-work
drwxr-xr-x 9 nexus nexus 4096 Mar 24 20:09 nexus-3.21.2-03
-rw-r--r-- 1 root root 140760762 Mar 24 17:33 nexus-3.21.2-03-unix.tar.gz
drwxr-xr-x 5 nexus nexus 4096 Mar 25 14:29 sonatype-work
5.ネクサスを開始します
./nexusrunまたはバックグラウンドでnohupを実行します./bin/nexusrun> logs / nexus.log 2>&1&
以下の情報が表示されれば起動は成功し、Webページからアクセスできます。
-------------------------------------------------
Started Sonatype Nexus OSS 3.21.2-03
-------------------------------------------------
問題が解決しました:
起動時に以下のエラーが報告された場合
2020-03-25 14:11:40,914+0800 ERROR [ForkJoinPool.commonPool-worker-1] *SYSTEM com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage - Exception `4BCD73AB` in storage `plocal:/opt/sonatype-work/nexus3/db/config`: 2.2.36 (build d3beb772c02098ceaea89779a7afd4b7305d3788, branch 2.2.x)
com.orientechnologies.orient.core.exception.OStorageException: Storage config is not opened.
DB name="config"
解決:
sonatype-work /の下のnexus3の名前を変更または削除し、再起動します(参照:https://www.cnblogs.com/ccbloom/p/10932822.html )
[nexus@yang opt]$ cd sonatype-work/
[nexus@yang sonatype-work]$ ls
nexus nexus3 README.txt
[nexus@yang sonatype-work]$ mv nexus3/ nexus3_backup
[nexus@yang sonatype-work]$ ll
total 12
drwxr-xr-x 15 nexus nexus 4096 Mar 24 21:41 nexus
drwxr-xr-x 13 nexus nexus 4096 Mar 25 14:10 nexus3_backup
-rw-r--r-- 1 nexus nexus 350 Jan 15 03:57 README.txt
6.3.XバージョンのNexusにアクセスします
アドレス:http:// IPアドレス:8091 / ユーザー名はadmin、パスワードはcat /opt/sonatype-work/nexus3/admin.password、パスワードは最初のログイン後に変更する必要があります
問題が解決しました:
バックグラウンドエラーの例外:
2020-03-25 15:19:01,965 +0800警告[qtp356953667-47] admin com.sonatype.nexus.plugins.outreach.internal.outreach.SonatypeOutreach-ページバンドル
org.apache.http.conn.ConnectTimeoutExceptionをダウンロードできませんでした: sonatype-download.global.ssl.fastly.net:443 [sonatype-download.global.ssl.fastly.net/31.13.72.17]への接続に失敗しました:接続がタイムアウトしました
解決:
【システム】==>【機能】を開き、【アウトリーチ:管理】を無効にする
パスワードを再設定する: