How to Install and Use Chocolatey Package Manager on Windows Server 2025
Chocolatey is the most widely-used open-source package manager for Windows, bringing the Linux apt / yum experience to the Windows ecosystem. It allows system administrators to install, upgrade, and remove software from the command line, script entire server configurations with a single PowerShell file, and maintain consistent, auditable software inventories across fleets of servers. On Windows Server 2025, Chocolatey is particularly valuable for automating base server builds — installing developer tools, runtimes, monitoring agents, and utilities without ever clicking through a wizard. This guide covers installing Chocolatey, using it for day-to-day package management, building a custom package, and setting up an internal feed for air-gapped environments.
Prerequisites
- Windows Server 2025 with an administrator account
- PowerShell 5.1 or PowerShell 7.x (run as Administrator)
- Internet access to
chocolatey.org, or an internal Nexus/Artifactory mirror - Execution policy that allows running scripts (the installer handles this temporarily)
- .NET Framework 4.8 (pre-installed on Windows Server 2025)
Step 1: Install Chocolatey
The official one-liner installs Chocolatey by downloading and executing the installation script from chocolatey.org. Run PowerShell as Administrator before proceeding:
# Temporarily bypass execution policy to allow the installer to run
Set-ExecutionPolicy Bypass -Scope Process -Force
# Set TLS 1.2 to ensure secure download
[System.Net.ServicePointManager]::SecurityProtocol = `
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072
# Download and run the Chocolatey install script
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(
'https://community.chocolatey.org/install.ps1'
))
After installation, close and reopen PowerShell so the PATH is reloaded, then verify:
choco --version
# 2.x.x
# View Chocolatey environment info
choco config list
Chocolatey installs to C:ProgramDatachocolatey and adds this directory to the system PATH.
Step 2: Install, Uninstall, and Upgrade Packages
The core Chocolatey commands mirror familiar Linux package manager syntax:
# Install a single package (accepts license prompts automatically with -y)
choco install git -y
# Install a specific version
choco install nodejs --version=20.19.1 -y
# Install multiple packages in one command
choco install 7zip notepadplusplus googlechrome -y
# Install silently with no progress bars (good for scripts)
choco install git -y --no-progress
# Uninstall a package
choco uninstall git -y
# Upgrade a specific package to its latest version
choco upgrade nodejs -y
# Upgrade ALL installed Chocolatey packages
choco upgrade all -y
# Upgrade all packages — dry run (see what would change without doing it)
choco upgrade all --noop
Step 3: Search for and List Packages
# Search the Chocolatey Community Repository
choco search python
# Search with version details
choco search python --all-versions
# List all locally installed Chocolatey packages
choco list --local-only
# Short form (equivalent)
choco list -l
# Show which packages have newer versions available
choco outdated
# Get detailed info about a specific package
choco info nodejs
Step 4: Install the Chocolatey GUI
For administrators who prefer a graphical interface, Chocolatey GUI provides a Windows desktop application for browsing, installing, and managing packages:
# Install Chocolatey GUI
choco install chocolateygui -y
# Launch it
Start-Process chocolateygui
Chocolatey GUI displays installed packages, available updates, and lets you search the community repository with filtering and sorting. It also shows package details, screenshots, and release notes.
Step 5: Create a Custom Chocolatey Package
You can package any software — including internal applications — as a Chocolatey package. A package consists of a .nuspec metadata file and a chocolateyInstall.ps1 script.
# Create a new package scaffold
choco new MyInternalApp
# This creates the directory structure:
# MyInternalApp/
# MyInternalApp.nuspec
# tools/
# chocolateyInstall.ps1
# chocolateyUninstall.ps1 (optional)
Edit MyInternalApp.nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>MyInternalApp</id>
<version>1.4.2</version>
<title>My Internal App</title>
<authors>Corp IT</authors>
<description>Internal order processing application.</description>
<tags>internal corp</tags>
</metadata>
</package>
Edit toolschocolateyInstall.ps1:
$ErrorActionPreference = 'Stop'
$packageArgs = @{
packageName = 'MyInternalApp'
fileType = 'msi'
url64bit = 'https://intranet.corp.example.com/packages/MyInternalApp-1.4.2-x64.msi'
checksum64 = 'A1B2C3D4E5F6...'
checksumType64 = 'sha256'
silentArgs = '/quiet /norestart'
validExitCodes = @(0, 3010)
}
Install-ChocolateyPackage @packageArgs
Build the package into a .nupkg file:
Set-Location "C:choco-packagesMyInternalApp"
choco pack
# Output: MyInternalApp.1.4.2.nupkg
Step 6: Set Up an Internal Chocolatey Feed with Nexus
For air-gapped environments or when you need to control which packages are available, host an internal NuGet feed using Nexus Repository Manager or Artifactory:
# Install Nexus OSS via Chocolatey
choco install nexus-repository -y
# Start the Nexus service
Start-Service -Name "nexus"
# Default Nexus URL: http://localhost:8081
# Default admin credentials: admin / (check C:ProgramDatasonatype-worknexus3admin.password)
In the Nexus web UI:
- Create a new NuGet (hosted) repository named
chocolatey-internal. - Create a new NuGet (proxy) repository pointing to
https://community.chocolatey.org/api/v2/. - Create a NuGet (group) repository that combines both.
Configure Chocolatey to use your internal feed:
# Remove the default community source
choco source remove --name="chocolatey"
# Add your internal Nexus group feed
choco source add `
--name="nexus-internal" `
--source="http://nexus.corp.example.com:8081/repository/chocolatey-group/api/v2" `
--user="choco-consumer" `
--password="ChangeMe123" `
--priority=1
# Verify sources
choco source list
# Push your custom package to the internal hosted repo
choco push "MyInternalApp.1.4.2.nupkg" `
--source="http://nexus.corp.example.com:8081/repository/chocolatey-internal/api/v2" `
--api-key="YOUR_NEXUS_API_KEY"
Step 7: Automate Server Builds with a Packages Script
Define your entire server software baseline in a single PowerShell script that can be run on any fresh Windows Server 2025 installation:
# server-baseline.ps1
# Run as Administrator
# Ensure Chocolatey is installed
if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = 3072
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(
'https://community.chocolatey.org/install.ps1'
))
}
# Core tools
choco install 7zip git notepadplusplus -y
# Runtimes
choco install nodejs --version=20.19.1 -y
choco install dotnet-8.0-runtime -y
# Monitoring and management
choco install sysinternals -y
choco install openssh -y
Write-Host "Server baseline installation complete." -ForegroundColor Green
Conclusion
Chocolatey transforms Windows Server 2025 software management from a manual, GUI-driven process into a scriptable, repeatable, and auditable operation. Whether you are bootstrapping a new server, maintaining a consistent software inventory across dozens of machines, or distributing internal applications through a private Nexus feed, Chocolatey provides the tooling to do it efficiently. Combined with an internal repository for air-gapped environments and a baseline install script committed to source control, you can rebuild any server to a known good state in minutes rather than hours.