windows-10 Getting started with windows-10 OneGet and packet managers


Example

OneGet was originally a product from the Open Source Technology Center at Microsoft. Not only is it inspired by open-source Linux package managers, OneGet itself is also open source. It's now part of PowerShell

As opposed to Unix based package managers (such as apt-get, yum, or dpkg), Windows allows usage of Oneget through PowerShell. To do this, you first need to open a Powershell as Admin and run Set-ExecutionPolicy RemoteSigned. This is to ensure that the Powershell scripts available in Oneget are allowed to run. Then (using the same PowerShell instance), run Import-Module –Name OneGet. This imports the PoerShell module. Then restart your powershell instance, and run Get-Command –Module OneGet to see all available commands. To install a package, run the command Find-Package | <Package_Name. When prompted to install Nuget, click yes.

Adding Chocolatey as provider to OneGet

Unfortunately, OneGet doesn't have the chocolatey package provider installed by default, but it is possible to add it.

Open a powershell window and run get-packageprovider -name chocolatey. You should then see the below message:

The provider 'chocolatey v2.8.5.130' is not installed. chocolatey may be manually downloaded from https://oneget.org/ChocolateyPrototype-2.8.5.130.exe and installed. Would you like PackageManagement to automatically download and install 'chocolatey'?

[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):

Type 'Y' then press enter.

Name                     Version          
----                     -------           
Chocolatey               2.8.5.130

Finding packages

For most well known programs, the name of the app usually works (for example, Chrome). but, just as chocolatey can be hard to navigate, so can OneGet. Luckily, OneGet has an implementation of choco search. This command is now find-package <Package Name>. This will give you a list of packages as seen below:

Name                           Version          Source                         Summary
----                           -------          ------                         -------
thunderbird                    45.2.0           chocolatey                     A free email client from Mozilla
Google Chrome                  47.5.8           OneGet                         A high end web browser

Installing packages

To install a package, you need to run a PowerShell as admin, and run the command install-package <PAckage Name>

The package(s) come from a package source that is not marked as trusted. Are you sure you want to install software from 'chocolatey'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):

To this you can just press y and/or enter. You will then see a display similar to the one below

Name                           Version          Source           Summary
----                           -------          ------           -------
<Package Name>                 <Most recent>    <Server name>    <Description>

Uninstalling

To uninstall a package, you just use the below command

uninstall-package vlc