How to install Chocolatey / choco in Windows

Steps to Install chocolatey/choco on Windows

  1. Go to Start and type “powershell
  2. Right-click Windows Powershell and select “Run as Administrator
  3. Paste the following command into Powershell and press enter.
    • Set-ExecutionPolicy Bypass -Scope Process -Force; `
        iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
  4. Answer Yes when prompted
  5. Close and reopen PowerShell window to start using choco

Choco is now installed and can be used from a PowerShell or Command prompt  windows to install different software packages. Whichever one you use, just make sure you run choco from a powershell/command prompt window.

Package Search with choco

choco search [keyword]

You can search the choco repository to see exactly what software chocolatey can install.

C:\>choco search hugo
Chocolatey v0.10.8
hugo 0.32.2 [Approved] Downloads cached for licensed users
pcwrunas 0.4.0.20161129 [Approved] Downloads cached for licensed users
lightworks 14.0.0.20171007 [Approved]
3 packages found.

Passing in the -v flag will give you more detailed information about each package.

choco search hugo -v

I commonly use choco to install & update Hugo and sometimes Python3. Hugo is a excellent Static Website Generator written Go. Let’s try installing it!

Install software with choco

choco install [packagename]

C:\WINDOWS\system32>choco install hugo
Chocolatey v0.10.8
Installing the following packages:
hugo
By installing you accept licenses for the packages.
Progress: Downloading hugo 0.32.2... 100%
hugo v0.32.2 [Approved]
hugo package files install completed. Performing other installation steps.
The package hugo 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 hugo 64 bit
...
 The install of hugo was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\hugo\tools'
Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).


Upgrade software with choco

choco upgrade [packagename]

C:\>choco upgrade hugo
Chocolatey v0.10.8
Upgrading the following packages:
hugo
By upgrading you accept licenses for the packages.
hugo v0.32.2 is the latest version available based on your source(s).
Chocolatey upgraded 0/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).


Installing choco updates

choco upgrade chocolatey

Choco can also upgrade itself.

C:\>choco upgrade chocolatey
Chocolatey v0.10.8
Chocolatey detected you are not running from an elevated command shell
 (cmd/powershell).

 You may experience errors - many functions/packages
 require admin rights. Only advanced users should run choco w/out an
 elevated shell. When you open the command shell, you should ensure
 that you do so with "Run as Administrator" selected. If you are
 attempting to use Chocolatey in a non-administrator setting, you
 must select a different location other than the default install
 location. See
 https://chocolatey.org/install#non-administrative-install for details.


 Do you want to continue?([Y]es/[N]o): Y

Upgrading the following packages:
chocolatey
By upgrading you accept licenses for the packages.
chocolatey v0.10.8 is the latest version available based on your source(s).

Chocolatey upgraded 0/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).


List Packages installed by Choco

choco list --local-only

C:\>choco list --local-only
Chocolatey v0.10.8
7zip 16.4.0.20170506
chocolatey 0.10.8
chocolatey-core.extension 1.3.1
hugo 0.31.1
4 packages installed.

Conclusion

Hope you like this post. Please share you thoughts, doubts and questions through comments under this post. Thanks for reading this. I also have a youtube channel, watch and support my channel.


If you find something really helpful, please donate me @paypal

Comments