- 02 Mar 2022
- 3 Minutes to read
HOWTO: Set Up a Private Chocolatey Repository
- Updated on 02 Mar 2022
- 3 Minutes to read
Chocolatey is a "system package manager" for Windows that helps you quickly and automatically configure machines by installing applications and tools using Chocolatey Packages.
ProGet can be configured as a private Chocolatey repository and host all your Chocolatey packages! If you want to download third-party Chocolatey packages, you can use a ProGet feed that connects directly to chocolatey.org. Alternatively, if you wish to use exclusively internalized packages, a separate feed that host internalized Chocolatey packages can be created.
In this article, we will explain how to set up both a public and internalized feed in ProGet to act as a private Chocolatey repository.
Setting up a Private Chocolatey Repository with a Public Feed
Using a public feed allows you to connect and pull packages from chocolatey.org and host them in ProGet.
Step 1: Create a Public Feed in ProGet
First you will need to create a public feed that hosts all your packages from chocolatey.org. To create a new feed, navigate to the banner at the top of the page and click on feeds. Next select Create New Feed.
We recommend using a name that clearly indicates this feed contains public Chocolatey packages, so we will name it public-chocolatey.
Step 2: Create a connector to Chocolatey.org
Now that your feed is created it will need to be connected to chocolatey.org. Click on add connector and fill in the relevant information.
This feed is now connected to chocolately.org and can pull packages directly from it.
Step 3: Enable Metadata Caching
While it's not required, we recommend enabling metadata caching. This will significantly reduce the number of times ProGet needs to forward queries to chocolatey and avoiding rate limiting.
To enable metadata caching navigate to Feeds> Connectors> Chocolatey.org> Metadata Caching> Edit.
Setting up a Private Chocolatey Repository with an Internalized Feed
Chocolatey packages truly shine when they are completely independent of outside factors like an internet connection or web address changes. This can be done by internalizing Chocolatey packages.
Internalizing a package takes all the embedded/internal resources and “internalizes” it so you can reuse the install logic without the hassle of running a script that downloads an installer from the internet.
Step 1: Internalize Packages
You will need to internalize your Chocolatey packages before uploading them to a private ProGet feed. Chocolatey’s package internalizer can internalize packages automatically or you can do it on your own by:
- Downloading and unpacking the existing package as a zip file.
- Downloading the resources the package has and putting them in the package.
- Editing the install script to point to the internal software.
- Packaging it back up.
Be sure to change the title or edit the description of your internalized packages before uploading them to ProGet, since internalized packages look identical to normal packages on the outside. To avoid confusion, we recommend slightly altering the internalized package name, such as turning "Firefox" into "Firefox-internalized"
Step 2: Create an Internalized Feed in ProGet
Now that your packages are internalized, a separate feed exclusively for approved internalized Chocolatey packages should be created. Navigate to the banner at the top of the page and click on Feeds. Next select Create New Feed.
To signify that this feed is only for approved internalized packages we will call it internalized-chocolatey.
Since this feed is only for approved internal packages, Private/Internal packages should be selected for the feed usage.
Step 3: Upload Packages to Internalized Feed
Now that you have a private internalized feed setup, you can upload your internalized packages to it. Navigate to Set Up Chocolatey> Add Package and upload your internalized packages.
That’s it! You now have a private Chocolatey repository that takes full advantage of internalized packages.