Sonatype Nexus: Creating Private PyPi Repository

Feb 10, 2024

If you’re in need of a private PyPi repository, Sonatype Nexus is an excellent alternative solution. In this blog post, I’ll walk you through the process of setting up both private and proxy PyPi repositories.

For detailed installation instructions, please refer to the GitHub repository. The quickest setup method, as always, involves Docker. You can launch Nexus with the following command:

docker run -d -p 8081:8081 --name nexus sonatype/nexus3

The default login credentials are as follows:

  • Username: admin
  • Password: Auto-generated and stored in the /nexus-data/admin.password file. You can view it by running:
docker exec -it nexus cat /nexus-data/admin.password

Now, let’s proceed to create our PyPi repositories. We’ll establish three repositories to handle both private and proxy packages. There are three types of repositories visible on the admin dashboard:

  1. Hosted: This type houses our private packages.
  2. Proxy: Enables access to public pip repositories, caching packages locally.
  3. Group: Allows grouping of hosted and proxy types for unified access via a single URL.

For each repository type, we’ll also create corresponding blob storages to facilitate disk management and enable easy removal of proxy support in the future.

Let’s set up the blob storages first:

Create Blob Storage All Blob Storages

Great! With our storages in place, let’s proceed to create the repositories. We’ll stick to the same naming rules:

  • Hosted: pypi-internal
  • Proxy: pypi-proxy
  • Group: pypi

During creation, ensure to select the appropriate blob storage for each repository.

This is the page we can see all repositories. Our target is pypi.

Repository Selection

This is the form for creating the pypi-internal repository. Let’s proceed to create our first hosted repository.


This is the second repository setup, the proxy. Pay close attention to the Remote storage field. If you’re using the default repository, ensure to input the details exactly as shown in the image.

This is the final form. Here, we’re creating a grouped repository that combines the hosted and proxy repositories. This allows us to access our repository using a single unified URL.


We’re all set now! You can utilize the pypi/simple URL to upload your packages and facilitate installations. This automatically directs packages to our hosted repository.

If you want to learn how to create python packages, please check this page on python documents. It is also working with our setup.

Happy coding, and may your repository serve you well!