Preparing test environments with ease with all required software

In this article, we will discuss how to easily install and configure softwares like Browser (Chrome), build tools (ANT, Maven), Programming language SDKs (Java, Python, NodeJS) including specific libraries from respective language, other softwares like Docker, VNC and 7Zip. This article will be useful providing some tips about using Package Manager to simplify/unify process of setup preparation with all necessary softwares just by running set of commands, rather than clicking on next multiple times in various installer wizards. Also for most of the softwares, environment variables are (*_HOME and PATH) are automatically set. 

Below environment preparation examples are used by me for preparing a development/test environment for Cumulocity Cloud, but same idea can be used for other environment preparations.

Install Windows Package Manager - chocolatey/choco

By running below command from administrative command prompt:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Install Software using choco

Installing Build tools

  1. Install Maven
    • choco install maven -y
    • Verify it by typing mvn -version. If required execute refreshenv, to refresh latest env variables in your current command prompt.
    • Note: This also install latest JDK as well.
  2. Install ANT
    • choco install ant -y
    • Verify it by typing ant -version. If required execute refreshenv, to refresh latest env variables in your current command prompt.
    • As this command is setting only ANT_HOME, but not updating PATH variable, please append %ANT_HOME%/bin
    • Note: This also install latest JRE as well.

Installing Programming Language SDKs and some sample libs using respective package mangers

  1. Install jdk8 (Skip this step if you installed maven via choco)
    • choco install jdk -y
    • Verify it by typing java -version and javac -version. If required execute refreshenv, to refresh latest env variables in your current command prompt.
  2. Install Python
    • choco install python -y
    • Verify it by typing py or python, it prints version of python opening up a python command prompt. If required execute refreshenv, to refresh latest env variables in your current command prompt. To exit from python command prompt type exit() and enter.
    • Note, python intstallation automatically installs pip - Python package manager. So if you want to install any python libs, you can just execute as examples below:
      • pip install paho-mqtt
      • pip install requests
  3. Install npm - nodejs package manager, by intalling full nodejs
    • choco install nodejs.install -y
    • Verify it by typing node -v, it prints version of nodejs. If required execute refreshenv, to refresh latest env variables in your current command prompt.
    • Install nodejs packages as required with npm(nodejs package manager), which comes along nodejs installation.
    • npm i cumulocity-tools -g

Other softwares

  1. Install yarn - package manager for code.
    • Note: Yarn required nodejs to be installed already (make sure you execute above step "choco install nodejs.install -y" )
    • choco install yarn -y
    • Verify it by typing yarn --version, it prints version of nodejs. If required execute refreshenv, to refresh latest env variables in your current command prompt.
  2. Install docker-toolbox
    • choco install docker-toolbox --version 18.03.0 -y -ia /TASKS="desktopicon,modifypath,upgradevm"
    • choco install virtualbox
    • docker-machine create -d virtualbox default
    • Right click on docker quickstart terminal shortcut on desktop and say run as administrator, this should start docker-machine and should be accessible from local client, which can be verified by typing
    • docker info
  3. Install 7zip
    • choco install 7zip.install --version 18.6 -y
  4. Install vnc server
    • choco install tightvnc -y
    • Note: On installation, you may need to configure password required to access the machine via VNC client.
  5. Install Browser - Chrome
    • choco install googlechrome -y

Additional tip :) - Installing any program as a service

This is useful if you would like to start any program automatically as a service at boot time. Below is an example to register a service, which automatically starts docker-machine as soon a system is restarted.

  1. Download and extract https://nssm.cc/release/nssm-2.24.zip
  2. Goto nssm.exe directory and execute command below and provide path to application and arguments in command prompt that appears
  3. provide login info in same prompt
  4. Click on Install service, a confirmation should appear saying that service installed successfully.