Chocolatey: Difference between revisions

From Omnia
Jump to navigation Jump to search
 
(35 intermediate revisions by the same user not shown)
Line 70: Line 70:


  %temp%\
  %temp%\
choco install choco-cleaner
=== choco-cleaner ===
choco install choco-cleaner
ref: https://superuser.com/questions/1371668/how-to-clear-chocolatey-cache-in-the-free-version


== Logs ==
== Logs ==
Line 91: Line 99:
choco install -y gnuwin32-coreutils.install
choco install -y gnuwin32-coreutils.install
choco install -y microsoft-windows-terminal
choco install -y microsoft-windows-terminal
# choco install -y microsoft-windows-terminal --pre
choco install -y git
choco install -y git
choco install -y greenshot
choco install -y greenshot
choco install -y pwsh
choco install -y pwsh
choco install -y procexp
choco install -y wget
choco install -y gnuwin
choco install -y ptime
</pre>
</pre>


All:
All:
  choco install -y putty kitty notepadplusplus cygwin cyg-get 7zip openhashtab filezilla irfanview irfanviewplugins winmerge rsync openssh grep gnuwin32-coreutils.install microsoft-windows-terminal git greenshot pwsh
  choco install -y putty kitty notepadplusplus cygwin cyg-get 7zip openhashtab filezilla irfanview irfanviewplugins winmerge rsync openssh grep gnuwin32-coreutils.install microsoft-windows-terminal git greenshot pwsh procexp wget gnuwin ptime


  # for "watch"
  # procps-ng for "watch", moreutils for "ts"
  cyg-get procps-ng
  cyg-get procps-ng moreutils


=== putty ===
=== putty ===
Line 152: Line 165:
Installs to:
Installs to:
  C:\ProgramData\chocolatey\lib\openssh
  C:\ProgramData\chocolatey\lib\openssh
Reinstall:
choco install openssh --params "/SSHServerFeature" --force


==== Install opensshd ====
==== Install opensshd ====


Script:
  "C:\Program Files\OpenSSH-Win64\install-sshd.ps1"
  "C:\Program Files\OpenSSH-Win64\install-sshd.ps1"
Install with:
powershell -file "C:\Program Files\OpenSSH-Win64\install-sshd.ps1"


Generate host private keys:
Generate host private keys:
Line 162: Line 182:
Access to those hosts private keys
Access to those hosts private keys
<pre>
<pre>
   Get-ChildItem -Path 'C:\Program Files\OpenSSH\ssh_host_*_key' | % {     
   Get-ChildItem -Path 'C:\Program Files\OpenSSH-Win64\ssh_host_*_key' | % {     
  $acl = get-acl $_.FullName
  $acl = get-acl $_.FullName
  $ar = New-Object  System.Security.AccessControl.FileSystemAccessRule("NT Service\sshd", "Read", "Allow")
  $ar = New-Object  System.Security.AccessControl.FileSystemAccessRule("NT Service\sshd", "Read", "Allow")
Line 168: Line 188:
  Set-Acl $_.FullName $acl
  Set-Acl $_.FullName $acl
}
}
</pre>
TODO:
* need to comment out these to not break:
<pre>
#Match Group administrators
#      AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
</pre>
</pre>


Line 176: Line 203:
  Set-Service SSHD -StartupType Automatic
  Set-Service SSHD -StartupType Automatic
  Set-Service SSH-Agent -StartupType Automatic
  Set-Service SSH-Agent -StartupType Automatic
Might need to copy default config:
dir "C:\Program Files\OpenSSH-Win64\sshd_config"
# if not found...
Copy-Item "C:\Program Files\OpenSSH-Win64\sshd_config_default" "C:\Program Files\OpenSSH-Win64\sshd_config"


Modify the Password Authentication and add the Powershell Subsystem
Modify the Password Authentication and add the Powershell Subsystem
  $FilePath = "C:\Program Files\OpenSSH-Win64\sshd_config"
  $FilePath = "C:\Program Files\OpenSSH-Win64\sshd_config"
  $FileData = (Get-Content $FilePath).Replace('#PasswordAuthentication yes','PasswordAuthentication yes')  
  $FileData = (Get-Content $FilePath).Replace('#PasswordAuthentication yes','PasswordAuthentication yes')
  $FileData += 'Subsystem powershell C:\Program Files\PowerShell\6.0.0-alpha.18\powershell.exe -sshs -NoLogo -NoProfile'  
# $FileData += 'Subsystem powershell C:\Program Files\PowerShell\6.0.0-alpha.18\powershell.exe -sshs -NoLogo -NoProfile'
$FileData += 'Subsystem powershell C:\Program Files\PowerShell\7\powershell.exe -sshs -NoLogo -NoProfile'
  $FileData | Out-File $FilePath -Force
  $FileData | Out-File $FilePath -Force


Restart service:
Restart service:
  Restart-Service sshd
  Restart-Service sshd
NOTE: If service fails to start, check event log.


Remote to Linux server:
Remote to Linux server:
  Enter-PSSession -HostName $LinuxServerIP -UserName administrator
  Enter-PSSession -HostName $LinuxServerIP -UserName administrator
Query service:
sc query sshd
=== Install ptime ===
:"ptime will run any specified command and parameters, and measure the execution time (run time) in seconds, accurate to 5 millisecond or better. It is an automatic process timer, or program timer used for benchmark purposes."
similar to linux 'time' command to time commands'
choco install ptime
choco ptime - https://community.chocolatey.org/packages/ptime
http://www.pc-tools.net/files/win32/freeware/ptime-10.zip
ref: [https://superuser.com/questions/228056/windows-equivalent-to-unix-time-command] [https://www.pc-tools.net/win32/ptime/]


== More Packages ==
== More Packages ==
Line 193: Line 244:
=== greenshot ===
=== greenshot ===
  choco install greenshot
  choco install greenshot
=== Open Java JDK ===
choco install openjdk
* https://download.java.net/java/GA/jdk22.0.2/c9ecb94cd31b495da20a27d4581645e8/9/GPL/openjdk-22.0.2_windows-x64_bin.zip
** C:\Users\USER\AppData\Local\Temp\chocolatey\openjdk\22.0.2\openjdk-22.0.2_windows-x64_bin.zip
** C:\Program Files\OpenJDK
** PATH environment variable does not have C:\Program Files\OpenJDK\jdk-22.0.2\bin
ref: https://community.chocolatey.org/packages/openjdk
=== keeper password security ===
choco install microsoft-vclibs-140-00 keeper
* https://aka.ms/Microsoft.VCLibs.x86.14.00.Desktop.appx
** C:\ProgramData\chocolatey\lib\microsoft-vclibs-140-00\tools\Microsoft.VCLibs.x64.14.00.Desktop.appx
=== firefox ===
=== firefox ===
  choco install firefox
  choco install firefox
Package Source: https://download.mozilla.org/?product=firefox-129.0.1-ssl&os=win64&lang=en-US
=== googlechrome ===
=== googlechrome ===
  choco install googlechrome
  choco install googlechrome
Line 207: Line 280:
  choco install -y postman
  choco install -y postman
=== vscode ===
=== vscode ===
visual code
  choco install -y vscode
  choco install -y vscode
https://update.code.visualstudio.com/1.94.0/win32-x64/stable
  C:\Users\USER\AppData\Local\Temp\chocolatey\vscode.install\1.94.0\VSCodeSetup-x64-1.94.0.exe
  C:\Program Files\Microsoft VS Code\
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio Code\Visual Studio Code.lnk
  "C:\Program Files\Microsoft VS Code\Code.exe"
=== slack ===
=== slack ===
  choco install -y slack
  choco install -y slack
Line 213: Line 297:
=== git ===
=== git ===
  choco install git
  choco install git
=== gh ===
==== GitHub CLI ====
choco install gh
=== gimp ===
=== gimp ===
  choco install gimp
  choco install gimp
Line 224: Line 315:
  choco install microsoft-windows-terminal
  choco install microsoft-windows-terminal


ref: https://github.com/microsoft/terminal
ref: https://github.com/microsoft/terminal
 
=== Windows Terminal Preview ===
 
Beta
 
choco install microsoft-windows-terminal --pre
 
ref: https://community.chocolatey.org/packages/microsoft-windows-terminal
 
=== ipmicfg ===
 
choco install ipmicfg
 
ERROR: The remote name could not be resolved: 'ftp.supermicro.com'
(blocked by firewall)
 
ref: https://community.chocolatey.org/packages/ipmicfg
 
package source: ftp://ftp.supermicro.com/utility/IPMICFG/IPMICFG_1.27.1_build.170901.zip


=== Gnu CoreUtils ===
=== Gnu CoreUtils ===
Line 243: Line 353:


Alternative is to add Cygwin bin to your path!
Alternative is to add Cygwin bin to your path!
http://sourceforge.net/projects/gnuwin32/files/coreutils/5.3.0/coreutils-5.3.0.exe
$url = 'http://sourceforge.net/projects/gnuwin32/files/coreutils/5.3.0/coreutils-5.3.0.exe'
$silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART' #InnoSetup
C:\Program Files (x86)\GnuWin32\bin
==== GnuWin ====
:"The GnuWin project provides Win32-versions of GNU tools, or tools with a similar open source licence. The ports are native ports, that is they rely only on libraries provided with any standard 32-bits MS-Windows operating system. Unlike CygWin or Msys, native ports do not rely on some kind of Unix emulation, so that there is no need to install additional emulation libraries."
choco install gnuwin
http://downloads.sourceforge.net/project/getgnuwin32/getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe
https://community.chocolatey.org/packages/GnuWin


=== Artifactory JFrog CLI ===
=== Artifactory JFrog CLI ===
Line 259: Line 384:
See https://community.chocolatey.org/packages/pwsh
See https://community.chocolatey.org/packages/pwsh
  choco install pwsh
  choco install pwsh
=== Process Explorer ===
choco install procexp
run with:
procexp
This path is in %PATH%
C:\ProgramData\chocolatey\lib\procexp\tools
Process Explorer
https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
=== Apache ===
choco install apache-httpd
=== OpenJDK ===
choco install openjdk
choco install openjdk --version=21.0.2
ref: https://community.chocolatey.org/packages/openjdk/21.0.2
=== Paint.net ===
choco install paint.net
=== HW Monitor ===
choco install hwmonitor
Package Source: https://www.cpuid.com/downloads/hwmonitor/hwmonitor_1.54.exe
See also [[#Heavy Load]]
=== CPU-Z ===
choco install cpu-z
aka cpuid cpuz
=== Heavy Load ===
choco install heavyload
Package Source: https://downloads.jam-software.de/heavyload/archive/v3.9.1.354/HeavyLoad-x64-Setup.exe
See also [[#HW Monitor]]


== 64bit Python 3 ==
== 64bit Python 3 ==
Line 285: Line 461:


== Keywords ==
== Keywords ==
[[Category:Windows Package Management]]
[[Category:Windows Command Line Package Management]]

Latest revision as of 00:30, 29 October 2024

Install Chocolatey

Install with PowerShell...

Note: With PowerShell, you must ensure Get-ExecutionPolicy is not Restricted. We suggest using Bypass to bypass the policy to get things installed or AllSigned for quite a bit more security.

Run:

Get-ExecutionPolicy.

If it returns Restricted, then run:

Set-ExecutionPolicy AllSigned
# or
Set-ExecutionPolicy Bypass -Scope Process

Then run:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

ref: https://chocolatey.org/install

---

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

Ref: http://www.hanselman.com/blog/IsTheWindowsUserReadyForAptget.aspx

Install Package

choco install [PACKAGE]
# or
cinst [PACKAGE]

List Intalled

choco list

Remove Package

choco uninstall [PACKAGE]

Upgrade Package

chocolatey upgrade [PACKAGE]
# OR (warning shim is being removed)
cup [PACKAGE]

Upgrade All Packages

choco upgrade all
choco upgrade all -y
# OR (warning this shim is being removed)
cup all

ref: [1]

Package List Online

https://community.chocolatey.org/packages

Install Custom Package From Source Path

choco install [PACKAGE] --source //smb.oeey.com/chocolatey/packages

Clear Cache

%temp%\Chocolatey
%temp%\
choco install choco-cleaner

choco-cleaner

choco install choco-cleaner

ref: https://superuser.com/questions/1371668/how-to-clear-chocolatey-cache-in-the-free-version

Logs

C:\ProgramData\chocolatey\logs

Favorite Packages

choco install -y putty
choco install -y kitty
choco install -y notepadplusplus
choco install -y cygwin cyg-get
choco install -y 7zip
choco install -y openhashtab
choco install -y filezilla
choco install -y irfanview irfanviewplugins
choco install -y winmerge
choco install -y openssh
choco install -y grep
choco install -y gnuwin32-coreutils.install
choco install -y microsoft-windows-terminal
# choco install -y microsoft-windows-terminal --pre
choco install -y git
choco install -y greenshot
choco install -y pwsh
choco install -y procexp
choco install -y wget
choco install -y gnuwin
choco install -y ptime

All:

choco install -y putty kitty notepadplusplus cygwin cyg-get 7zip openhashtab filezilla irfanview irfanviewplugins winmerge rsync openssh grep gnuwin32-coreutils.install microsoft-windows-terminal git greenshot pwsh procexp wget gnuwin ptime
# procps-ng for "watch", moreutils for "ts"
cyg-get procps-ng moreutils

putty

choco install -y putty

kitty

choco install -y kitty

notepadplusplus

choco install -y notepadplusplus

cygwin

choco install -y cygwin

Manually add cygwin bins to path:

setx PATH "%PATH%;C:\ProgramData\chocolatey\bin"

Note: "For better functionality, it is recommended you install the cyg-get package. Use the cyg-get utility to add packages to your Cygwin installation."

cygwin cyg-get

choco install cyg-get

ref: https://community.chocolatey.org/packages/cyg-get

watch

Install the standard linux "watch" command... [1]

cyg-get procps-ng
watch ls /

7zip

choco install -y 7zip

openhashtab

choco install -y openhashtab

filezilla

choco install -y filezilla

Irfanview

choco install -y irfanview irfanviewplugins

winmerge

choco install -y winmerge

rsync

choco install -y rsync

grep

choco install -y grep

openssh

choco install -y openssh
Installing OpenSSH on Windows 10
https://dejulia489.github.io/2017-05-07-InstallingOpenSSHOnWindows10/

Installs to:

C:\ProgramData\chocolatey\lib\openssh

Reinstall:

choco install openssh --params "/SSHServerFeature" --force

Install opensshd

Script:

"C:\Program Files\OpenSSH-Win64\install-sshd.ps1"

Install with:

powershell -file "C:\Program Files\OpenSSH-Win64\install-sshd.ps1"

Generate host private keys:

 "C:\Program Files\OpenSSH-Win64\ssh-keygen.exe" -A

Access to those hosts private keys

   Get-ChildItem -Path 'C:\Program Files\OpenSSH-Win64\ssh_host_*_key' | % {    
	   $acl = get-acl $_.FullName
	   $ar = New-Object  System.Security.AccessControl.FileSystemAccessRule("NT Service\sshd", "Read", "Allow")
	   $acl.SetAccessRule($ar)
	   Set-Acl $_.FullName $acl
	}

TODO:

  • need to comment out these to not break:
#Match Group administrators
#       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

Firewall:

New-NetFirewallRule -Protocol TCP -LocalPort 22 -Direction Inbound -Action Allow -DisplayName SSH

Auto start service after reboot:

Set-Service SSHD -StartupType Automatic
Set-Service SSH-Agent -StartupType Automatic

Might need to copy default config:

dir "C:\Program Files\OpenSSH-Win64\sshd_config"
# if not found...
Copy-Item "C:\Program Files\OpenSSH-Win64\sshd_config_default" "C:\Program Files\OpenSSH-Win64\sshd_config"

Modify the Password Authentication and add the Powershell Subsystem

$FilePath = "C:\Program Files\OpenSSH-Win64\sshd_config"
$FileData = (Get-Content $FilePath).Replace('#PasswordAuthentication yes','PasswordAuthentication yes')
#  $FileData += 'Subsystem	powershell C:\Program Files\PowerShell\6.0.0-alpha.18\powershell.exe -sshs -NoLogo -NoProfile' 
$FileData += 'Subsystem powershell C:\Program Files\PowerShell\7\powershell.exe -sshs -NoLogo -NoProfile'
$FileData | Out-File $FilePath -Force

Restart service:

Restart-Service sshd

NOTE: If service fails to start, check event log.

Remote to Linux server:

Enter-PSSession -HostName $LinuxServerIP -UserName administrator

Query service:

sc query sshd

Install ptime

"ptime will run any specified command and parameters, and measure the execution time (run time) in seconds, accurate to 5 millisecond or better. It is an automatic process timer, or program timer used for benchmark purposes."

similar to linux 'time' command to time commands'

choco install ptime

choco ptime - https://community.chocolatey.org/packages/ptime

http://www.pc-tools.net/files/win32/freeware/ptime-10.zip

ref: [2] [3]

More Packages

greenshot

choco install greenshot

Open Java JDK

choco install openjdk

ref: https://community.chocolatey.org/packages/openjdk

keeper password security

choco install microsoft-vclibs-140-00 keeper

firefox

choco install firefox
Package Source: https://download.mozilla.org/?product=firefox-129.0.1-ssl&os=win64&lang=en-US

googlechrome

choco install googlechrome

vlc

choco install -y vlc

adobereader

choco install adobereader

wsl

choco install -y wsl 
choco install wsl-ubuntu-1804

postman

choco install -y postman

vscode

visual code

choco install -y vscode
https://update.code.visualstudio.com/1.94.0/win32-x64/stable
 C:\Users\USER\AppData\Local\Temp\chocolatey\vscode.install\1.94.0\VSCodeSetup-x64-1.94.0.exe
  C:\Program Files\Microsoft VS Code\
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio Code\Visual Studio Code.lnk
 "C:\Program Files\Microsoft VS Code\Code.exe"

slack

choco install -y slack

git

choco install git

gh

GitHub CLI

choco install gh

gimp

choco install gimp

ccleaner

choco install ccleaner

winscp

choco install winscp

Windows Terminal

choco install microsoft-windows-terminal
ref: https://github.com/microsoft/terminal

Windows Terminal Preview

Beta
choco install microsoft-windows-terminal --pre 
ref: https://community.chocolatey.org/packages/microsoft-windows-terminal

ipmicfg

choco install ipmicfg
ERROR: The remote name could not be resolved: 'ftp.supermicro.com'
(blocked by firewall) 
ref: https://community.chocolatey.org/packages/ipmicfg
package source: ftp://ftp.supermicro.com/utility/IPMICFG/IPMICFG_1.27.1_build.170901.zip

Gnu CoreUtils

CoreUtils includes things like cat, tail, etc...

choco install gnuwin32-coreutils.install
https://www.gnu.org/software/coreutils/

List of utilities:

https://gnuwin32.sourceforge.net/packages/coreutils.htm

ref: https://community.chocolatey.org/packages/gnuwin32-coreutils.install

NOTE: Need to manually add "C:\Program Files (x86)\GnuWin32\bin" to your PATH

setx PATH "%PATH%;C:\Program Files (x86)\GnuWin32\bin"

Alternative is to add Cygwin bin to your path!

http://sourceforge.net/projects/gnuwin32/files/coreutils/5.3.0/coreutils-5.3.0.exe
$url = 'http://sourceforge.net/projects/gnuwin32/files/coreutils/5.3.0/coreutils-5.3.0.exe'
$silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART' #InnoSetup
C:\Program Files (x86)\GnuWin32\bin

GnuWin

"The GnuWin project provides Win32-versions of GNU tools, or tools with a similar open source licence. The ports are native ports, that is they rely only on libraries provided with any standard 32-bits MS-Windows operating system. Unlike CygWin or Msys, native ports do not rely on some kind of Unix emulation, so that there is no need to install additional emulation libraries."
choco install gnuwin
http://downloads.sourceforge.net/project/getgnuwin32/getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe

https://community.chocolatey.org/packages/GnuWin

Artifactory JFrog CLI

choco install jfrog-cli

Powershell

See https://community.chocolatey.org/packages/powershell

choco install powershell

Powershell Core

"PowerShell Core is the open source multiplatform version of PowerShell"

See https://community.chocolatey.org/packages/pwsh

choco install pwsh

Process Explorer

choco install procexp

run with:

procexp

This path is in %PATH%

C:\ProgramData\chocolatey\lib\procexp\tools
Process Explorer
https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer

Apache

choco install apache-httpd

OpenJDK

choco install openjdk
choco install openjdk --version=21.0.2

ref: https://community.chocolatey.org/packages/openjdk/21.0.2

Paint.net

choco install paint.net

HW Monitor

choco install hwmonitor
Package Source: https://www.cpuid.com/downloads/hwmonitor/hwmonitor_1.54.exe

See also #Heavy Load

CPU-Z

choco install cpu-z

aka cpuid cpuz

Heavy Load

choco install heavyload
Package Source: https://downloads.jam-software.de/heavyload/archive/v3.9.1.354/HeavyLoad-x64-Setup.exe

See also #HW Monitor

64bit Python 3

Install:

choco install -y python3

Ref: https://chocolatey.org/packages/python3

Deprecated Packages

32bit Python 2.7

Install:

choco install -y python2-x86_32
choco install -y python2-x86_32 pip

Ref: https://chocolatey.org/packages/python2-x86_32

64bit Python 2.7

Install:

choco install -y python2

Ref: https://chocolatey.org/packages/python2

Keywords