Nexus environment installation, deployment and use

 

table of Contents

1. Introduction to Nexus

Two, 2.X environment installation and deployment

1. Nexus official website download address

2. Unzip to local 

3. Modify the Nexus port (default is 8081)

4. Open the firewall

5. Modify the startup file

6, start

7. Visit nexus

Three, 3.X environment installation and deployment

1. Unzip

2. Modify the default port of Nexus

3. Turn on the firewall

4. Add a startup user

5. Start nexus

6. Visit the 3.X version of Nexus


1. Introduction to Nexus

For Maven, warehouses are divided into two categories: local warehouses and remote warehouses. There are three specialized Maven warehouse management software that can be used to help us build private servers: chiva, Artifactory and Nexus. Nexus is currently the most popular Maven warehouse management software. Nexus includes the concept of various types of warehouses, including proxy warehouses, host warehouses, warehouse groups, etc. Each warehouse provides a wealth of practical configuration parameters, which is convenient for users to customize according to their needs.

Two, 2.X environment installation and deployment

Take the latest version of 2.X as an example, the version number is 2.14.16

1. Nexus official website download address

https://www.sonatype.com/download-oss-sonatype

2.X version download link: https://help.sonatype.com/repomanager2/download

3.X version download address: https://help.sonatype.com/repomanager3/download

2. Unzip to local 

tar -xzvf nexus-2.14.16-01-bundle.tar.gz 

3. Modify the Nexus port (default is 8081)

My query port here is already occupied, so I need to modify the port, vi nexus.properties, here I modify the application-port to 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. Open the firewall

vi /etc/sysconfig/iptables

添加:-A INPUT -p tcp -m state --state NEW -m tcp --dport 8090 -j ACCEPT

service   iptables restart

5. Modify the startup file

/opt/nexus-2.14.16-01/bin/nexus add root startup, or add nexus user (useradd nexus),

否则启动报错If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.

Modify RUN_AS_USER=root //Be careful to delete the # in front

Modify the JDK path vi wrapper.conf (./bin/jsw/conf/wrapper.conf)

Modify the parameter wrapper.java.library.path.1=/opt/jdk1.8.0_151/bin/


6, start

/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. Visit nexus

http://ip address:8090/nexus/    default account and password: admin/admin123

 

Three, 3.X environment installation and deployment

There are some differences between 3.x and 2.x, here are also recorded

3.X version download address: https://help.sonatype.com/repomanager3/download

1. Unzip

tar  -xzvf nexus-3.21.2-03-unix.tar.gz

After decompression, there are two folders nexus-3.21.2-03 and sonatype-work

2. Modify the default port of Nexus

There is a slight change in the path, the configuration file is under the path /opt/nexus-3.21.2-03/etc vi nexus-default.properties

Modify here to application-port=8091

3. Turn on the firewall

vi /etc/sysconfig/iptables

添加:-A INPUT -p tcp -m state --state NEW -m tcp --dport 8091 -j ACCEPT

service   iptables restart

4. Add a startup user

After testing, there are quite a lot of problems when using root to start.

useradd nexus

Modify the user and user group to which the file belongs:

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. Start nexus

./nexus run or run nohup in the background ./bin/nexus run> logs/nexus.log 2>&1 &

The startup is successful when the following information appears, and you can access it through the web page

-------------------------------------------------

Started Sonatype Nexus OSS 3.21.2-03

-------------------------------------------------

problem solved:

If the following error is reported during startup

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"

Solution:

Rename or delete nexus3 under sonatype-work/, and restart (Reference: 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. Visit the 3.X version of Nexus

Address: http://IP address:8091/The    user name is admin, the password is cat /opt/sonatype-work/nexus3/admin.password, the password needs to be changed after the first login

problem solved:

Background error exception:

2020-03-25 15:19:01,965+0800 WARN  [qtp356953667-47] admin com.sonatype.nexus.plugins.outreach.internal.outreach.SonatypeOutreach - Could not download page bundle
org.apache.http.conn.ConnectTimeoutException: Connect to sonatype-download.global.ssl.fastly.net:443 [sonatype-download.global.ssl.fastly.net/31.13.72.17] failed: connect timed out

Solution:

Open【System】==>【Capabilities】, disable【Outreach:Management】

reset Password:

 

 

Guess you like

Origin blog.csdn.net/xlyrh/article/details/105071688