How to Use Chocolatey: A Delicious Windows Package Manager

0


[ad_1]

Most Windows users do not pay much attention to the way desktop programs are installed on their system. For years, we’ve been trained to find a website, download an EXE or MSI file, and then click, click, click through installation.

It is a simple method, but it also takes a long time due to the manual interaction.

A booming project called Chocolatey wants to make it easier to install desktop apps without having to click through endless numbers of install windows.

What is chocolate?

Chocolatey is a command line application installer for Windows based on a developer-centric package manager called NuGet. Unlike manual installations, Chocolatey adds, updates, and uninstalls background programs that require very little user interaction.

Chocolatey has its own package feed which is created and maintained by members of the project community.

Behind the scenes, most Chocolatey packages simply download a program’s official executable and install it without any further user interaction.

You lost me in the “command line”

No, wait, listen to me!

Getting new programs the old fashioned way is very easy, but manual installations are also inefficient. Don’t you prefer to spend your time watching the latest cat videos on YouTube while your PC takes care of installing programs on its own?

With a single console command, Chocolatey downloads the installation file from the Internet and takes care of the installation for you.

That’s Chocolatey’s promise. If the program has any dependencies, such as the .NET framework, Chocolatey will install them as well.

Chocolatey can also take care of multiple program installations.

Imagine opening a new PC, downloading Chocolatey, then typing a one-line command to install all the programs you would like to have on your new machine. That’s what Chocolatey does.

Installing Chocolatey

Installing Chocolatey on your system is very easy since commands can be copied and pasted into your command prompt from Chocolatey.org. To get started, you need to open an elevated command prompt.

Command prompt run as administrator

To open an elevated Command Prompt, right-click the Command Prompt launcher and select Execute as administrator.

To do this in Windows 8.1, click the Start button and go to the all apps screen. Under the Windows System heading, find Command Prompt, right-click it and select Execute as administrator. When the User Account Control window opens, authorize it by clicking Yes.

A command prompt window should open with something like C: WINDOWSsystem32.

Then visit Chocolatey.org and copy the first box. At the time of this writing, the commands were:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin

Paste it in the prompt, press Enter and your PC will take care of the rest.

install chocolatey 3

Installing Chocolatey is almost as easy as installing software with it.

It is generally not advisable to copy and paste commands, but in this case it is fine.

To make it easier for you to rest, let’s break down the instructions a bit: These commands tell your PC to launch PowerShell and not load any custom profiles that a power user might have. Then it tells Windows to set the execution policy to unlimited to allow any PowerShell script to run, and then download and run the Chocolatey install script.

Chocolate bases

Installing the Chocolate Style programs

Once Chocolatey is up and running, it’s time to start installing programs. Open an administrative command prompt again and type cinst [program name]. If you wanted to install VLC, you would type:

cinst vlc
choco install vlc 2

When using Chocolatey, you must accept the license agreements for the software you will be using.

choco install vlc 3

Chocolatey will download the installation file for you from the web.

Pretty easy, right? The trick is that you need to know the exact name Chocolatey uses for each program. You can’t just type Chrome Where Google-Chrome and expect Chocolatey to figure it out.

To find the names of the programs, you can try playing on the command line with the trial and error method (which works more often than you might think). If you don’t have that kind of time, look for the programs in Chocolatey.org’s online package catalog. You can also search for packages directly on the command line:

choco search 

Multiple installations

There are two ways to install multiple programs at once with Chocolatey. The first is to enter multiple arguments on the command line. If you want to install VLC, GIMP and Firefox, you need to type:

cinst vlc gimp Firefox 

However, for much larger batches of programs, it is better to create an XML document with a .config file extension and format it like this:



    
    
    

This basic document structure can include as many programs as you want, and can even include alternative sources other than the Chocolatey Community Feed. For a more complete tutorial on creating a multi-install file, see developerFusion.

Uninstall and update

Updating installed programs through Chocolatey is also straightforward. Type cup [program name] in an administrative command. To update DosBox, for example, type:

cup dosbox

You can also update all your programs by typing cup all. If your package uses an alternate source other than the main Chocolatey package feed, you can enter:

cup [package name] –source [source URL]

Uninstalling a package is a bit different. Going back to our example, you need to type the following to uninstall DosBox:

choco uninstall dosbox

On the next page, we’ll cover standard controls and security issues.

A word on standardization

Anyone familiar with a Linux package manager will immediately notice that Chocolatey uses three different commands (cinst, Cup, and choco) to perform operations. It’s a very non-standard way of doing things compared to Linux apt-get Where Pac-Man, which start each command with apt-get and pacman, respectively.

To better standardize the use, you can use the command format choco [command] to summon Chocolatey. So instead of typing cinst dosbox, you can use the to install order:

choco install dosbox

To update you can use the update order:

choco update dosbox

While the standardized approach is preferred, Chocolatey creator Rob Reynolds says shorthand commands will remain part of the project. So feel free to use whatever group of commands you find easiest.

But what about security?

Chocolatey is handy, but there’s no getting around the fact that it’s not an ideal choice if you’re currently concerned about your PC’s security. Installing programs with Chocolatey requires that you trust the creator of the package.

You can monitor Chocolatey while it installs your programs to see which sites the downloads are coming from, but this defeats the convenience of using Chocolatey as an automated process.

The implicit trust model probably means that pulling from the Chocolatey community feed wouldn’t be the best choice for large companies or even small businesses. That said, Chocolatey can be tuned to rely on a corporate controlled private flow where all packages are verified by IT.

While security isn’t ideal at the moment, Reynolds says big changes are underway for future versions of Chocolatey. Over the next year or so, trusted members of the community will start moderating the stable feed and all packages will be reviewed before they are added. Approved packages will include the cryptographic signature by the moderator who approved it.

Future versions of Chocolatey will include a scanning algorithm to detect packets with malicious intent. Users will also be able to control who they trust by accepting or rejecting packages based on public key signatures, just like package managers on Linux.

Chocolate alternatives

In April, the company introduced OneGet, a package manager interface for PowerShell 5.0. OneGet is basically a package manager manager that allows you to access downloads from multiple package managers, such as Chocolatey and NuGet, in one place. The first version of OneGet relies solely on the Chocolatey packet feed.

Microsoft’s project is still ongoing and appears to be primarily a tool for system administrators. Chocolatey, by comparison, is for any Windows user wanting to give it a try.

You can’t live off Chocolatey alone

While Chocolatey looks quite tasty, it’s not for all programs. You cannot use Chocolatey for a program blocked behind a paywall, for example. However, all programs that are free to download and require a purchase or license key are fair play.

Unless you want to start researching new sources or building your own packages, you’re limited to what’s in the community feed.

The current feed is quite large, with over 2,000 unique packages and over 8,000 in total at the time of writing. It includes a variety of programs including all major third-party web browsers, uTorrent, Vuze, Notepad ++, Sublime Text (versions 2 and 3), VLC, Office 365 Home Premium, CCleaner, GIMP, IrfanView, Skype and more. ‘others.

Chocolatey might not be for all Windows users, but anyone who wants to get their hands a bit dirty on the command line will find this package manager for Windows a very useful tool.

[ad_2]

Share.

Comments are closed.