Showing posts with label Package Management. Show all posts
Showing posts with label Package Management. Show all posts

2019-10-03

Using Chocolatey to install your favorite software


This is a follow-up to one of my previous posts:
Chocolatey is like a package manager, but for Windows; a bit like the famous `apt-get` or `aptitude` for some GNU/Linux distros (...) I have created a curated list of my favorite ones; the ones I would install right away on a new computer, whether it is for work or even for home computing.

Therefore, to run any of the commands listed below, you will first need to install Chocolatey itself, which can be easily done with a simple command, so make sure you first check this post:

Install both Chocolatey and OpenSSH with SSHD in one Copy-Paste in Powershell







SUBSEQUENT CALLS


After completion, you may invoke commands such as:


# there were problems with former 'linkshellextension' installation
# and there was a bit of an overhead when issuing the commands...
#   choco install -y vcredist2015
#   choco install -y --ignore-checksums linkshellextension
# but it seems to work fine now.


choco install -y linkshellextension

choco install -y 7zip
choco install -y imagemagick
choco install -y git --version 2.21.0

choco install -y openvpn

choco install -y keepass
choco install -y notepadplusplus

choco install -y firefox
choco install -y googlechrome

choco install -y cherrytree --version 0.38.8
choco install -y guidgen-console
choco install -y lightshot
choco install -y synctrayzor
choco install -y winmerge

# java runtime environment
choco install -y jre8

# autoit minimum version: 3.3.8.1
# (autoit 3.3.6.1 not available via chocolatey)
choco install -y autoit --version 3.3.14.5

# scite4autoit3 minimum version: 3.5.4
# (scite4autoit3 3.2.0 not available via chocolatey)
choco install -y scite4autoit3 --version 19.102.1901.001






UNUSED


# git-lfs is already included in the main Git installer
# (this is true as of early 2019)
choco install -y git-lfs

# syncthing is already part of synctrayzor
choco install -y syncthing

# veracrypt competes with BitLocker on Windows, which works fine
choco install -y veracrypt

# As of May 2019, git-credential-manager-for-windows
does not seem to be automatically added to the path!
# However this might not be a big deal since it seems
# to have been included into the main Git installer.
choco install -y git-credential-manager-for-windows

# the winbtrfs driver does not work for me
# (but that has nothing to do with Chocolatey)
# I might give it another try at some point though...
choco install -y winbtrfs






DEFECTS


# As of 2019-05-10, choco installs older v18.2.1 of smartgit,
# which causes problems because we are forced to upgrade as
# soon as it is installed
choco install -y smartgit






OTHER COMMANDS: "CHOCO SEARCH"




If you want to check if an application is included to the Chocolatey distribution service, or if you want to know its exact name, you may use the "choco search" command.







OTHER COMMANDS: "CINST"






An even faster way to call for an installation of a piece of software is to use "cinst" instead of "choco install".

Also, according to the help instructions, it should be possible to specify multiple application after the "choco install/cinst" command.

So we can therefore condense the previous list of calls into on single command (although I wrote on multiple lines and escaped using the backtick character, we should be able to copy-paste it just like that):

Optional:
choco feature enable -n allowGlobalConfirmation;   


Default base install v2.0.2010.0:
cinst -y linkshellextension; `
cinst -y notepadplusplus; `
cinst -y winmerge; ` 
cinst -y 7zip; `
cinst -y git; `
 `
cinst -y tightvnc; `
cinst -y openvpn; `
 `
cinst -y firefox; ` 
cinst -y googlechrome; `
 `
cinst -y jre8; `
cinst -y --version 3.3.14.5 autoit; `
cinst -y --version 19.102.1901.001 scite4autoit3


REMARK #1: Some (generic) lists may include an install instruction multiple times, usually at the beginning or the end of the script, this is on purpose. Lists like this can have multiple purposes and can be partially copy-pasted if we're only interested in a subset of the list. And running the same install request multiple time will only cause it to be ignored (unless the "--force" parameter was used, which is not the case).


REMARK #2: Also some pieces of software require very specific configuration, such as a VNC server, and we're better off running them separately, or at the very beginning and letting the rest of the automated install to carry on...
- tightvnc


REMARK #3: Some software may not be suitable for being installed on the system disk if it deals with data located on an independent disk of a virtual machine, in which case it's advised to use a portable application which you would install manually:

- synctrayzor


REMARK #4: I personally use my favorite (and most important) software in the form of portable programs, which I update myself, in which case it has to be removed from the default list:

- notepadplusplus, keepass, firefox


Other, ready to paste, multi-line commands such as the one above, can be found at this address:



2018-07-26

Install both Chocolatey and OpenSSH with SSHD in one Copy-Paste in Powershell




TL;DR



Start a PowerShell console with Administrator privileges and run the following :


[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {[bool]1}; set-executionpolicy RemoteSigned -Force -EA 'SilentlyContinue'; iex ((new-object net.webclient).DownloadString('https://gist.githubusercontent.com/deskobj/f135af9b5404c594ee041c1688bc6f0a/raw')) 


After the command has exited, we can expect the following to be true:
  • CHOCO command available by default via PATH environment variable.
  • SSH command available by default via PATH environment variable.
  • SSHD service is running.






HISTORY OF THE ONE-LINER COMMAND
AND ITS BACK-END SCRIPT



The original command (from DarwinJS/ChocoPackages) reads as follows:
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {[bool]1};set-executionpolicy RemoteSigned -Force -EA 'SilentlyContinue';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/DarwinJS/ChocoPackages/master/openssh/InstallChoco_and_win32-openssh_with_server.ps1'))
Additionally:
  • JUL 26, 2018: Despite the recommendation "Not To", a cached (and modified) version of the script is made available.
  • AUG 28, 2018: Enforced TLS 1.2 security protocol use.
  • MAY 05, 2019: Added information about how to install Chocolatey on its own, using just a command line.




WHAT ABOUT INSTALLING CHOCOLATEY ONLY ?
(WITHOUT THE SSHD SERVICE)



To simply install Chocolatey, without SSH support, run the following PowerShell command, as Administrator:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; set-executionpolicy RemoteSigned -Force -EA 'SilentlyContinue'; iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

If you wish to install SSH later, you can still run the original command even if Chocolatey is already installed (the Choco installation step will just be skipped).





PREVENT SYSTEMATIC CONFIRMATIONS
(WHEN YOU KNOW WHAT YOU ARE DOING)



Chocolatey always asks if you are sure about installing a piece of software.

One way to address this problem is to always specify the `-y` switch when invoking `choco install`. For instance:

  • `choco install -y git`,
  • or the even shorter version being `cinst -y git`


But you can also disable this behavior altogether, on a global scale, forever, by running the following command:

choco feature enable -n allowGlobalConfirmation




It's probably a dangerous thing to set up, but it's really nice when you are familiar with the tool and use it repeatedly.




MORE SOFTWARE INSTALL SUGGESTIONS



Chocolatey is like a package manager, but for Windows; a bit like the famous `apt-get` or `aptitude` for some GNU/Linux distros (`dpkg` for Debian, `yum` for Fedora/RHEL/CentOS or `dnf` for RPM-based distros in general, `yast2` or `zypper` for OpenSuse, `emerge` for Gentoo, `pacman` for Arch). So it allows you to install software easily and effortlessly and the catalog of supported installs is growing.

I have created a curated list of my favorite ones; the ones I would install right away on a new computer, whether it is for work or even for home computing.

Read more:



Other, ready to paste, multi-line commands such as the one above, can be found on this page: