Skip to content

Nexus3 Configuration

TheSpiritMan edited this page Dec 25, 2022 · 5 revisions

Nexus3 Configuration

  • Nexus3 is a private Repository Manager.
  • Different artifact including docker images can be hosted in the Nexus Repository.

Nexus3 Requirement

  • Nexus will running in docker container, so docker must be installed in your system.
  • By default, nexus runs in port 8081, so port 8081 must be free to use for use in your system. IF not, we can forward the port different free port.

Nexus3 Container

  • The command to run the nexus3 container:

    docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-data sonatype/nexus3
    
  • Output:

  • We created a new docker volume named as nexus-data to save all the data for future use.

Nexus Webpage

  • Visit http://<your_ip>:8081 to access the nexus. Do not use localhost, problem may arise.

  • Since my private ip address is 192.168.18.8. So I can visit http://192.168.18.8:8081.

  • The default webpage is somehow same as below:

  • Click in the Sign In button. We can see that it promts a form for credential. We can that, username is admin and the password can be found in /nexus-data/admin.password.

  • Command to get password:

    docker exec -it nexus cat /nexus-data/admin.password
    
  • Output:

  • Remember, the $ sign from the output is from my shell. So the password is only 5306178f-e5cc-48d3-9117-bb463e27de14.

  • Login into the nexus webpage using the credential.

  • Once logged in, you will be asked to setup wizard for the Nexus Repository. It includes the new password and control access form. For my case, I have set new pasword as a admin and disable anonymous access.

  • Once everything is configured, we can see Welcome page:

Artifact Repository

  • Let's create a artifact repository.

  • Click on the Setting button. We can see multiple option:

  • Select Repositories from them. We can see that there are already some repository created. If we want, we can use maven-releases and maven-snapshots repository from them but we will practice creating our own repository. It will be best if we delete default repository in Enterprise Level and create custom Repository.

  • We will create 2 repositories to store artifacts. One for Release version and another for Snapshot version.

Release Repository

  • To create new Release repository, click on Create Repository button. We can lots of option. From there, select maven2 hosted. Fill the form as follows and select Release from Drop-Down-Menu of Version Policy. Click on Create Repository button to create a repository.

  • We can see, our newly created repository in Repositories list.

  • Click on that repository and we gets all the details about the Repository including the URL to upload the artifacts from third-party app like Jenkins.

Snapshot Repository

  • To create new Snapshot repository, click on Create Repository button. We can lots of option. From there, select maven2 hosted. Fill the form as follows and select Snapshot from Drop-Down-Menu of Version Policy. Click on Create Repository button to create a repository.

  • We can see, our newly created repository in Repositories list.

  • Click on that repository and we gets all the details about the Repository including the URL to upload the artifacts from third-party app like Jenkins.

Now Nexus Repository is ready to accept artifact from Third-Party Tools like Jenkins using admin credentials. So goto Jenkins Configuration Page in Manage Nexus section and continue with the project.

Clone this wiki locally