Introduction to the
Using the Nexus, you can build private warehouses.
advantages
- Nexus is an “out of the box” system that doesn’t need a database, but uses a file system plus Lucene to organize data.
- Supports WebDAV and LDAP security authentication.
The installation
You need the JDK to create a directory
mkdir /usr/local/nexus3
Copying the installation package
Cp nexus – 3.18.1-01 – Unix. Tar/usr/local/nexus3
Unzip the files
Tar – ZXVF nexus – 3.18.1-01 – Unix. Tar
Generate 2 folders
- Sonatype -work is the Nexus working directory
- Nexus-3.18.1-01 Installation directory
Changing the Port Address [Optional]
CD nexus – 3.18.1-01 / etc/vim nexus – default. The properties
## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
# #
# Jetty section
# service port
application-port=9090
application-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
nexus.hazelcast.discovery.isEnabled=true
Copy the code
Start the service
CD nexus-3.18.1-01/bin./nexus start Enables background startup./nexus stop Stops services
Open the browser at http://localhost:9090/
User name admin password in sonatype – work/nexus3 / admin. The password file
practice
Build NPM repository upload and download dependency
The NPM has been installed.
Create a repository for NPM on nexus
You can create one of the following three
- Hosted represents a local warehouse
- Proxy indicates the repository of the proxy. It is preferentially downloaded from the local proxy service address
- Group, said the group
Replication warehouse address
Create the role
Create a user
Add the realms
A method for the
vim ~/.npmrc
1 registry=http://localhost:9090/repository/npm-proxy/
2 home=https://www.npmjs.org
3 [email protected]
4 _auth=ZGVwbG95ZXI6ZGVwbG95ZXI=
Copy the code
_auth is base64 encoding of the [Username: password] string of the nexus user (parentheses not included)
Another way to do it
nrm add npm-group http://localhost:9090/repository/npm-group/
nrm use npm-group
npm adduser
Then release
npm publish
Download the dependent
npm install
Build maven repository upload and download dependencies
Prerequisites You have installed maven Nexus to create a Maven repository
There’s nothing to say about creating the warehouse, writing the name next next…
Go back to the warehouse home page and get the warehouse URL
Modify the Maven configuration file setting.xml
CD/usr/local/apache maven – 3.5.4 / conf
Add authentication and mirror addresses
<server> <id>test</id> <username>deployer</username> <password>deployer</password> </server> ... . <mirror> <id>test</id> <! </mirrorOf> <name>Nexus myself</name> <url>http://localhost:9090/repository/test/</url> </mirror>Copy the code
Maven poM file
<distributionManagement>
<repository>
<id>test</id>
<name>Nexus Release Repository</name>
<url>http://localhost:9090/repository/test/</url>
</repository>
</distributionManagement>
Copy the code
Use maven Deploy that comes with the development tool