Not coming from a NuGet background, I don't understand how to setup Nexus to serve up Chocolatey packages.
Here is how you do it:
- Create a NuGet proxy repository that points to https://chocolatey.org/api/v2/. This will allow you to cache packages from chocolatey.org which can come in handy if it goes down during a deployment.
- Create a NuGet hosted repository. This is where you will publish your private packages.
- Create a group repository that contains the above repositories. This what you will set
--source
flag to when installing a package.
The NuGet tab under hosted repo created above will have the Package Source and Personal API Key.
So if hosted repo has:
Package Source = "https://example.com/nexus/service/local/nuget/choco-releases/"
Personal API Key = "d8471cc1-d350-3e45-a0c2-95d0b938e1d9"
Then the call to package and publish your private mypackage
package would look like this:
choco pack
choco push --source "'https://example.com/nexus/service/local/nuget/choco-releases/'" -k="'d8471cc1-d350-3e45-a0c2-95d0b938e1d9'"
To install packages from both private and public sources, use the group repository as the source. The NuGet tab under group repo created above will have the Package Source to use.
So if the group repo has:
Package Source = "https://example.com/nexus/service/local/nuget/choco-all/"
Then the call to install both your private and publicly available packages would look something like this:
choco install jdk8 mypackage --source "'https://example.com/nexus/service/local/nuget/choco-all/'"
When the jdk8
package is not in the private repo; Nexus will pull it from chocolatey.org, cache it in the proxy repo, then send it on to where choco install
is called.
choco push
command working... –
Depress http://hostname/repository/reponame/
, and it's essential that there is a trailing /
. –
Heilbronn © 2022 - 2024 — McMap. All rights reserved.