This is the first day of my participation in Gwen Challenge
Nexus is a powerful warehouse manager that greatly simplifies maintenance of internal warehouses and access to external warehouses. Nexus3 supports maven, NPM, yum, Pypi, Docker, Rubygem and other common software.
Install Nexus3
- Download: www.sonatype.com/oss-thank-y…
Environmental requirements
- Windows / Linux / Mac
- JDK 8+
- Apache Maven 3.0 +
The installation start
The operating system of this example is Centos 6.5
$ java -version
java version "1.8.0 comes with _144"
Java(TM) SE Runtime Environment (build 1.8. 0 _144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Copy the code
Unpack the
Click to download the latest stable version. After downloading, unpack it.
tar -zxvf nexus-3.71.-02-unix.tar.gz -C /data/nexus-3.71./
Copy the code
Change the file name habitually
cd /data/nexus-3.71./
mv nexus-3.71.-02/ nexus
Copy the code
Start the configuration
Modify the port
vim etc/nexus-default.properties
Copy the code
## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
##
# Jetty section
application-port=8081Application -host=0.0. 0. 0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/
# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
nexus-pro-feature
Copy the code
Edit the nexus. Rc
vim bin/nexus.rc
Copy the code
Configure users running the Nexus
run_as_user="hadoop"
Copy the code
Edit nexus and change INSTALL4J_JAVA_HOME_OVERRIDE to $JAVA_HOME for JDK1.8
INSTALL4J_JAVA_HOME_OVERRIDE="/ usr/local/Java/jdk1.8.0 _144"
Copy the code
Start the
bin/nexus start (stop/restart...)
Copy the code
Now open the address http://10.10.202.157:8081 shows the diagram below
When you log in to the system using the user name/password admin/admin123, the gear button will appear and you can configure the Nexus. The following figure
Creating the proxy repository
Go to Create Repositories -> Create Repositories and select Maven2 (Proxy), as shown below:
Fill in the address of the proxy warehouse (now we are acting as the mirror of Ali Cloud), as shown below:
Here are a few more commonly used warehouses:
- Ali cloud: maven.aliyun.com/nexus/conte…
- Spring-Release : maven.springframework.org/release/
- Cloudera: repository.cloudera.com/artifactory…
- Jboss : repository.jboss.com/maven2/
- Jboss – thirdparty – releases: repository.jboss.org/nexus/conte…
- jcenter : jcenter.bintray.com/
- Spring IO: repo. Spring. IO/libs – releas…
Click Save and select Maven-public. In the Group area, add the list of Available repositories to Members on the right. Alicloud is recommended to be the first repository to download from the top down.
At this point, the Maven Proxy repository has been configured. You can also create other Hosted, Proxy, or Group repositories yourself.
In addition, add other relevant knowledge:
The warehouse is introduced
Proxy Repository
As the name implies, it is an agent for third-party warehouses, such as:
- maven-central
- nuget.org-proxy
Version Policy:
- Release: Official version
- Snapshot: indicates the Snapshot version
- Mixed: Mixed mode
Layout Policy:
- Strict: Strict
- Permissive: loose
Hosted Repository (Hosted Repository)
Storing locally uploaded components and resources, such as:
- maven-releases
- maven-snapshots
- nuget-hosted
Deployment Policy:
- Allow Redeploy: Allows redeployment
- Disable Redeploy: Disables redeployment
- The Read – Only: Read Only
Repository Group: Typically contains multiple proxy and host repositories. Packages can be downloaded into proxy and host repositories by importing Repository groups in a project, such as:
- maven-public
- nuget-group
Upload the third-party JAR package
mvn deploy:deploy-file
-DgroupId=com.oracle
-DartifactId=jdbc-oracle-connection
-Dversion=2.23.
-Dpackaging=jar
-Dfile=~/Document/oracle-2.23..jar
-Durl=http:/ / 10.10.202.157: / repository/maven - 3 rd / 8081
-DrepositoryId=nexus-releases
Copy the code
Explanation:
-dgroupid =com.oracle User-defined -dartifactid = jdbC-oracle-connection user-defined -dversion =2.2.3 The custom, -dpackaging =jar Indicates the jar type. -dfile =~/Document/oracle- 22.3. jarjar Indicates the location of the local disk – Durl = http://10.10.202.157:8081/repository/maven-3rd/ private servers warehouse address, -DrepositoryId= THE ID configured in the nexus-releasesleaming.xml file