Setting up a dev box in Windows

Using Windows as a development environment can be tricky to set up, this guide shows a few tools and technologies to help bridge the gap and provide you with a wicked development environment in Windows.

Setting up a dev box in Windows
Photo by Luca Bravo / Unsplash

Setting up an efficient development environment on Windows can significantly enhance productivity. This guide covers essential tools and steps to create a robust Windows development setup, focusing on cmder, Chocolatey, Visual Studio Code, Docker, and SSH key management.

cmder: A Powerful CLI for Windows

cmder is an enhanced command line interface for Windows, built on top of ConEmu. It offers a more powerful and user-friendly experience compared to the default Windows command prompt.

Installing cmder

  1. Download the Full version (100Mb zip) from cmder Official Website.
  2. Extract the files to C:/cmder.
  3. Launch cmder.exe and accept the User Account Control (UAC) prompts.

NB: if you've installed choco first you can also run choco install Cmder in a console to install cmder via the chocolatey package manager.

Launching admin sessions

When you open a new cmder window using ctrl+t you can initiate an admin console by checking the appropriate box on the bottom left of the popup that appears:

Incidentally, you can split the console in multiple windows using the New console split options (middle-right) ... supper handy for monitoring logs on multiple VM's 😀

Setting Up Aliases in cmder

cmder allows the creation of custom aliases for frequently used commands. This can be done as follows:

  1. Open cmder.
  2. Type code c:\cmder\config\user_aliases.cmd to open the configuration file in Visual Studio Code
  3. Add aliases in the format {alias}={command}. For example:
    • ll=ls -lah $*
    • dc=docker-compose $*
    • cdd=cd c:\Users\{username}\development\$*
    • Note: $* allows passing additional parameters

Chocolatey: Windows Package Manager

Chocolatey simplifies the installation of software on Windows, akin to package managers in Linux distributions.

Installing Chocolatey

  1. Visit Chocolatey Installation Guide and follow the instructions.
  2. As an administrator, open cmder and run the installation command provided on the Chocolatey website.

Using Chocolatey to Install Packages

  1. Open cmder as an administrator.
  2. Search for packages with choco search {package}, like choco search vim.
  3. Install the desired package with choco install -y {package}.

Visual Studio Code: A Versatile Code Editor

Visual Studio Code (VSCode) is a popular code editor supporting multiple languages and technologies.

Installing and Configuring VSCode

Install VSCode via Chocolatey with choco install -y vscode.

  1. Configure VSCode settings for line endings, tab size, and spaces vs tabs under File → Preferences → Settings.

You can also download it from the official website if you prefer at https://code.visualstudio.com

  • markdownlint: For Markdown linting and style checks.
  • ESLint: Integrates ESLint for JavaScript.
  • Docker: Enhances Dockerfile and docker-compose file support.
  • shell-format: Aids in formatting shell scripts.

Docker for Windows: Container Management

Docker for Windows allows running containers natively on Windows 10 Pro and Windows 11 Pro.

Installing Docker for Windows

  1. Enable Hyper-V from Windows Features.
  2. Download and install Docker from Docker Hub.
  3. Configure Docker settings, such as shared drives and proxies, from the system tray icon.

If you need to install Hyper-V, it's under the following:

SSH and Managing Keys

Effectively managing SSH keys is crucial for secure access to various services.

  1. Create a .ssh directory in your user folder and a keys subdirectory for storing different SSH keys i.e. keys/dev or keys/prod if you have a looooot of keys
  2. Generate SSH keys using ssh-keygen and save them in the keys directory.
  3. Create config.{type} files for different services and merge them into a single config file using a custom script.

The bash script for this can be found at https://github.com/GizzmoAsus/sshgenconf but is essentially a script that concatenates all of the config.* files into a single config file.

Conclusion

By leveraging these tools and practices, you can create a highly efficient and customized development environment on Windows. This setup enhances productivity and streamlines your development workflow.