Chocolatey is a software management solution for Windows operating system. You can install a new software package, upgrade it or remove it. All from the command line 🙂 . If you ever worked with yum or apt on Linux, brew in MacOS you will love Chocolatey.
Many enterprises adopted Chocolatey (there is a paid and free version of the tool) to help them manage software packages management as well as Windows patches.
In an enterprise deployment, the default Chocolatey repository is being replaced by internal packages repository. So when you are trying to deploy software which is not on an internal repository, you will get an error
[NuGet] An error occurred while loading packages from ‘https://chocolatey.internal.local/packages’: The remote server returned an error: (404) Not Found.
PS C:\WINDOWS\system32> choco install xmind
Chocolatey v0.10.11
Installing the following packages:
xmind
By installing you accept licenses for the packages.
[NuGet] An error occurred while loading packages from 'https://chocolatey.org/packages': The remote server returned an error: (404) Not Found.
xmind not installed. The package was not found with the source(s) listed.
Source(s): 'https://chocolatey.internal.local/packages'
NOTE: When you specify explicit sources, it overrides default sources.
If the package version is a prerelease and you didn't specify `--pre`,
the package may not be found.
Please see https://chocolatey.org/docs/troubleshooting for more
assistance.
Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
When corporate IT adding internal repository into Chocolatey, by default, it overrides the community repository settings. In order to install software from the community repository, you need to community repository to Chocolatey. Run command; choco source add -n=chocolatey -s'https://chocolatey.org/api/v2/' --priority=1
List repository sources; choco source
PS C:\WINDOWS\system32> choco source
Chocolatey v0.10.11
InternalChocolatey - https://chocolatey.internal.local/packages (Authenticated)| Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
chocolatey - https://chocolatey.org/api/v2/ | Priority 1|Bypass Proxy - False|Self-Service - False|Admin Only - False.
PS C:\WINDOWS\system32>
Below I’m installing Xmind using chocolatey
PS C:\WINDOWS\system32> choco source add -n=chocolatey -s'https://chocolatey.org/api/v2/' --priority=1
Chocolatey v0.10.11
Added chocolatey - https://chocolatey.org/api/v2/ (Priority 1)
PS C:\WINDOWS\system32> choco install xmind
Chocolatey v0.10.11
Installing the following packages:
xmind
By installing you accept licenses for the packages.
Progress: Downloading xmind 8.9... 100%
xmind v8.9 [Approved]
xmind package files install completed. Performing other installation steps.
The package xmind wants to run 'chocolateyinstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[N]o/[P]rint): Y
Downloading xmind
from 'https://www.xmind.net/xmind/downloads/xmind-8-update9-windows.exe'
Progress: 100% - Completed download of C:\Users\artur.krzywdz\AppData\Local\Temp\chocolatey\xmind\8.9\xmind-8-update9-windows.exe (157.42 MB).
Download of xmind-8-update9-windows.exe (157.42 MB) completed.
Hashes match.
Installing xmind...
xmind has been installed.
xmind can be automatically uninstalled.
The install of xmind was successful.
Software installed to 'C:\Program Files (x86)\XMind\'
Chocolatey installed 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\WINDOWS\system32>
Another way to install software from Chocolatey community repository is by specifying a source repository in the choco
command PS> choco install xmind --source=https://chocolatey.org/api/v2/
Below you can find an example of the tools I’m deploying with Chocolatey on my Windows workstation box. List of all community packages can be found here
choco install -y powershell
choco install -y googlechrome
choco install -y firefox
choco install -y flashplayerplugin
choco install -y notepadplusplus
choco install -y 7zip
choco install -y jre8
choco install -y adobereader
choco install -y putty
choco install -y github
choco install -y winscp
choco install -y virtualbox