Table of Contents

Setup self hosted Chocolatey Repository/Proxy on Linux

To host a local repository for Chocolatey either as server for self-hosted packages or as proxy server for any NuGet server/the official chocolatey repository server we use Solartype Nexus3: sonatype.com - Nexus3

Currently not working because of an missing Key-File from Sonatype, this guide is partially outdated. Newer versions require Java13 for running. The only way to install sonatype-nexus-repository-manager is by downloading the .deb file manually from repo.sonatype.com.

Therefore that Nexus3 required Java 8 it's recommended to use a Ubuntu Server (in this case 24) because Ubuntu still serves Java 8 from the official repository which Debian doesn't.

Installation

  1. Download Ubuntu Server from here: ubuntu.com/download/server and install your machine.
  2. Install Java8:
    sudo apt install openjdk-8-jdk
  3. Add Sonatype's APT repository to sources lists:
    wget -P /etc/apt/sources.list.d/ https://repo.sonatype.com/repository/community-hosted/deb/sonatype-community.list
  4. Add the repositories key:
    nano sonatype-apt-repo.key

    And paste the following content:

    -----BEGIN PGP PUBLIC KEY BLOCK-----
     
    mQGNBF1Uv8ABDAD0Te7EGf8n4jUKzeD9YfqqiPUs/Q54QBOQeFHe+pdMQeC7O8Kl
    W3AX0Qy1C0SUZWlDkOt3F+5ct18S/xT/42bVQYHzaT05zIjlwxqiSB8ApVnR9Gpm
    +N2u6eNyHCXItsdNwV8djd9B5nsRd0Gqgzmklt8bxZUX9NI0OQmbcquEg46Kt65J
    IueVqy/qM4vdZSIH3+f/klHblBty8JHNorbNXdtz8e7PuzshVghULKlvgnJmQWdG
    XJsMuWpKYUhDtsN4UHOzsS7uFBn/cWlLYs9bQy9BmK/8tBfcMtoXZGq3/c+fN9fj
    9wdxNeTrbMEsZiaLOLHCZwKEbn03+OjJKtTAxu6Q+benc9/++0BMhQK4gqj7zQW+
    CPlN+gg+PX4WVreU8rhT3kgTGCMm2aGiCjBg/aF4BmewLl/+CPgpw9VrFAKPN7w/
    fE5Smcrmta4i4DFSQoMYclOObzjr3qydx8INcRyXWEXPHz7NW+3PQY4JvUec8/KR
    BE6DJWInZPuo5j0AEQEAAbQxU29uYXR5cGUgQ29tbXVuaXR5IDxjb21tdW5pdHkt
    Z3JvdXBAc29uYXR5cGUuY29tPokB1AQTAQoAPgIbAwULCQgHAgYVCgkICwIEFgID
    AQIeAQIXgBYhBOd4iMdnFOvXGUAl6pZLXnIKpPMaBQJhGs7JBQkJaamJAAoJEJZL
    XnIKpPMaLtQMAMthe85oV6QyyWyTqTMnI6Huotd6IXn97YsbL6AUNiE23x4UcF8B
    nVkyaFmtIrSkV+W0Y9yuCmgUDDtXDbpOwaJeCPK8avTtUpKojRPManh4+K9MK94i
    NkzxbWWGjb2wgbGdSDPuFeAW3dnd+eeC9+5iYtnhUYzcnKFvtnE1g9comzpvmZhD
    cyAS5+Kp/bP8sT3Sk51tlnBnYCZuXs30lCiOGUie8UM5JJeCMK/ppugPFa5DOwVb
    HGRqCDjWcKdnEYG1c2KUYPVsWZ/5Feqg4PXXDwZbrRWoCWj34omX597RYFKQR7sT
    4pUjwmyl65iIf9jdDerPqSAIkrCaXGdZz1rqC3Fvn7xZm3CRyaQwUgf9pwO4kjFo
    neaYSW5P0f37fbAuH4n7c8s/8khFe8ljnKs4ivxQErZMACyddW0ZjJvReD9uBczI
    mgYLA3rarP9fxwwGVCa0IIPchGAeUG53QSby18m3M4I2oKGJHpENGQZRsu7ArKQl
    e1dx2e2gUr5OgbkBjQRdVL/AAQwAr11CHfZ6KBi1IRH/Ca0jG7LonStBX2XUNvyA
    iz+IsFM8CAD8rGSzhgJO2Br/+u9KgyVczolmUlK1TvIzJUmNyUyc2p/WGYdzFs8K
    UteSSa2zxNVMbjuePDKu+aThklVnBU//Q2HkqTNPXYklo4f+IzkCQg7A+jcT9BHB
    1JhNWhzan3IytpuypXJxX5Le0kXAhULeIiBM+UoGFGdblldVN7ieH5FOrDcbHcYu
    RUNZRkwLSARawkc9g8f2omAvwFDzcqmvA3xjC3cQMEwBS0BdvsGwM18/0G8khR3E
    c03plCeWMaWEfYh0infkP9twoH6XoI4dAyTOnf7w11smIYCBjc07VOUtraRfGkjQ
    5TXfmPC5LVBo8OXLhkcmpYQwFHnncqFzzK20iGM1plc758Enwzx2elGVhXdw5upF
    LQUHYU29vHePRwlv/AGAjl+UzZWrE7IKNrphc1bKFsAHJZ0MisJu4BtHTGKcY6EZ
    rmnGEW32iCvrZTWcwICRDWx77IZFABEBAAGJAbwEGAEKACYCGwwWIQTneIjHZxTr
    1xlAJeqWS15yCqTzGgUCYRrPpAUJCWmqZAAKCRCWS15yCqTzGiNODACh5Ho5RlBJ
    PQcsyaBpLkpzJvmY59Q7g50pAWd9GoLF0rnJi5jd7+senRwHYWig4H/9+01lx7fi
    7sI2Cd96xXV01pp6OpopR346IvbiNOPzk6ngpFfFc90ujA5CrXjj+lMl5VzV3QOO
    nVHOvFXkT0wMloHq8MdYzkLFuSETEcEdvKM9E5yXhUo0BCC60G+YZTvMuITvAw4i
    5xBnLIdKHmOXZhCq3ChtwFf/hXhGH7Xf5F9pHPmHx6tC7+uJ0Tovpk7Jd42YLtHT
    RMH/Q39OxFfGHOIvrzuHa6cpKaBlE0/Zqs9DGJE7pKetyWA5aRNWElGFWFgOsE0j
    0duTbAh/xyvAb9LF2F2XP21EoCmA3mHd2/SVMQfenvk9i8VcB5KBZYKt5kvsoFvy
    5YA5ENG8dtMQDyfV3dhUWpzghOOgOof05fp/JUNdHTEHbjh57yj+W04KNsPAl84E
    dq6/peJdFjJp7dHV94yQjv1O4OcNtriD2kTBtucc+XswPSFgyeoR8tQ=
    =1ghU
    -----END PGP PUBLIC KEY BLOCK-----
  5. Then update the repositories:
    sudo apt update
  6. And install Nexus3:
    sudo apt install nexus-repository-manager
  7. When everything was successful, enter the webservice with http://<ip>:8081/
  8. The password for admin is located under /opt/sonatype/sonatype-work/nexus3/admin.password after entering the password, it's forced to be changed.
    cat /opt/sonatype/sonatype-work/nexus3/admin.password

    The installation of Nexus is now finished!

Setup Repository

NuGet Proxy

To add a new NuGet (Chocolatey) repository proxy add a new nuget (proxy). To proxy the official Chocolatey repository add the following URL as URL:

https://community.chocolatey.org/api/v2/

Finally save the proxy repository.

NuGet Hosted

If the repository should also host packages locally add a new nuget (hosted).

This section will be extended later.

NuGet Group

To make the proxy-repository and all local hosted packages available through one URL, add a nuget-group on the repository tab. Then add both nuget-proxy and nuget-hosted to the group.


Sourced from: