Q&A Corner with the Nexus Support Team

December 08, 2017 By Mark Miller

3 minute read time

The Nexus Support Team answers questions and suggests solutions on the Nexus User List. Each Friday, we look solutions the community found of interest.

How to create or delete a repository in Nexus 3.2 OSS from command prompt

Question: I'm a new user of Nexus, started using the Nexus OSS 3.2. I would like to create or delete a repository outside the Nexus UI, from the command line. Any help would be appreciated.

Answer: You can write a groovy script which does these things, and execute it from the REST API interface: https://help.sonatype.com/display/NXRM3/REST+and+Integration+API

Original Post


Is there a way to get a list of all users in Nexus 3?

Question: Is there a way to generate a report or some other process to get a list of all system or ldap users list in nexus 3.2? We also have a requirement to get the list of users who used nexus for last 30 days.

Answer: Use the nexus request.log. The IP address used to access Nexus is in column one, the user ID (if any was provided) is in column 3. The user agent string used by the client is in the last column: - admin [04/Dec/2017:11:52:47 -0600] "GET /service/extdirect/poll/rapture_State_get?_dc=1512409967622 HTTP/1.1" 200 20399 14 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"

As an example, here is a single command you can use at a terminal to list all unique user names for request logs from Aug 2017.

gunzip -c request-2017-08*.log.gz | awk '{print $3}' | sort | uniq

Original Post


Mulitple migrations against the same Nexus 2 instance

Question: I have a Nexus OSS 2.14.5-02 instance, and plan to migrate it to a new 3.6.2 production instance, but I would like to do a dry run using a new 3.6.2 TEST instance first. My questions are:

1. Could I do multiple migrations against the same Nexus 2 instance as long as my Nexus 3 instance is a new install each time? It looks like I could, but I would like to be sure.

2. If I could, is there anything special I need to do on the Nexus 2 instance before a second migration? Is removing sonatype-work/nexus/db/migrationagent necessary?

Answer: Yes, you can do multiple migrations. as long as each Nexus 3 instance is a new install (starting with a clean work directory). Before running a new migration, shut down Nexus 2 and remove "sonatype-work/nexus/db/migrationagent".

 Original Post


The most popular posts on the Nexus User List

Do you have a question about using Nexus Repository, Nexus Lifecycle or Nexus Firewall? Ask the Nexus Support Team on the Nexus User List.

Tags: support, The Q&A Corner, technical

Written by Mark Miller

Mark Miller serves as the Senior Storyteller and DevOps Advocate at Sonatype. He speaks and writes extensively on DevSecOps and Security, hosting panel discussions, podcasts, and webinars on tools and processes within the Software Supply Chain.