Windows 10 Install Notes

I'm setting up my Windows 10 workstation to use VirtualBox and Vagrant to manage a pool of virtual machines for development. I'm using Powershell to interact with Vagrant and manage creating/running the virtual machines. When a machine is running, I'm using Putty (and tmux) to interact w/ a somewhat persistant shell session.

I'm using git to manage repositories of Vagrant configurations and shell scripts that are used for each particular virtual machine. Essentially, I'm setting up access to git, vim, and vagrant in Powershell, which I can use to manage the configuration files and virtual machines. Putty is used to interact once the virtual machines are provisioned and running.


Getting Started

Instead of having to chase down and run a few dozen installers, I use Ninite to install all of the basic freeware apps that I use on my Windows machines. There's some paid apps I also recommend.

I remap the caps lock key to be a control key. There's alot of advantages to this when you do alot of work in a shell environment, especially if you use tmux. I found the easiest way to do this on Windows 10 is using SharpKeys.


Customizing the Sidebar

Remove 'One Drive', then disable One Drive startup

Remove 'Network' and customize 'This PC'




Setup Vim GUI and Powershell

We'll start by setting the correct execution policy. The referenced link explains it in more details. Basically, run this in PowerShell:

  Set-ExecutionPolicy RemoteSigned

Add to your $PROFILE.

  # this will open a notepad window to edit your profile
  notepad $PROFILE

  # add this line to enable 'vim' command
  set-alias vim "C:/Program Files (x86)/Vim/vim74/vim.exe"

The .vimrc file is stored in your user accounts home directory, in the _vimrc file.

I'm using this basic configuration


Setup Git and Unix Tools

Download and run the installer. During the install, opt for windows shell integration.

This guide explains all the ins and outs of the how the PATH is configured. I skipped the third step in the guide.


Setup Virtualbox and Vagrant

Download and install the latest version of Virtual box for best results, opting to install the necessary network drivers when prompted. In order to avoid issues, use a version newer than 5.0.2 with Windows 10.

Updated 12/30/2015 : After some automatic updates ran on my Windows 10 machine, VirtualBox would no longer start. I uninstalled VirtualBox and attempted to install the latest version (5.0.12) which failed. Installing version 5.0.10 also failed. I was able to restore functionality by installing 5.0.8. I didn't spend much time looking into this, so YMMV.

After installing VirtualBox, install the latest version of Vagrant next. Compared to previous versions of Windows and these two products, the installation process for use on Windows 10 is a much smoother process.




Setup 'unzip' Command in Powershell

Some scripts I work with expect the 'unzip' command. These can be installed from here, then add an alias in your $PROFILE ...

  # add this line to enable the 'unzip command'
  set-alias vim "C:/Program Files (x86)/Vim/vim74/vim.exe"

Setup 'curl' Command in Powershell

This can be a source of confusion, because Powershell provides a curl-like tool and provides an alias 'curl' to this. We need to install the real curl, then add a line to our $PROFILE to fix the alias as as explained here ...

  # remove powershell alias to curl-like functionality
  remove-item alias:curl

Working with Putty

I use Putty to connect over ssh to virtual machines, and configure Putty to connect to a tmux session on connection. I found a tool, Hosts File Editor, to make it easy to setup host names for IPs used by virtual machines.

To connect to an tmux session, configure Putty for this remote command ...

  # open configuration dialog, navigate to connection / ssh panel

  # in the command box
  tmux a -t *session name* || tmux new -s *session name*

I'm using Base 16 Colors all over, there are putty themes linked.

I'm using Source Code Pro fonts in my shell environments.


$PROFILE Configurations

The $PROFILE config in Powershell is similar to a .bashrc or .profile file. The syntax is specific to Powershell.

  # edit your profile in vim
  vim $PROFILE

I've written elsewhere about some git aliases I use in Bash, in Powershell ...

  # git aliases

  Function gs
  {
      echo ""
      git status
      echo ""
      echo "# Available Branches"
      git branch
      echo ""
  }

  Function gl
  {
      git log
  }

  Function gd
  {
      git diff
  }

And some others I use for working with VirtualBox and Nomadic ...

  # 'vstat', list all machines and machines running from VirtualBox
  Function vstat
  {
      echo ""
      echo "All VMs"
      & 'C:\Program Files\VirtualBox\VBoxManage.exe' list vms
      echo ""
      echo "Running VMs"
      & 'C:\Program Files\VirtualBox\VBoxManage.exe' list runningvms
      echo ""
  }

  # 'nomadic', a tool for creating new vagrant configurations
  Function nomadic($machine="")
  {
      $machineZip = $machine + '.zip'
      curl -L -o $machineZip https://github.com/vicgarcia/nomadic/archive/master.zip
      # the curl is provided by installing Git for Windows.
      unzip -d $machine -j $machineZip
      remove-item $machineZip
      echo "successfully created nomadic build named $machine"
  }

See why we configured 'curl' and 'unzip' like we did above?

This last one uses robocopy, an rsync-like cli tool for the Windows world ...

  # 'itunez', backup my iTunes files to an external drive
  Function itunez
  {
      $timeStamp = [datetime]::Now.ToString("yyyy-MM-dd-HH-mm")
      $logFile = 'F:\backup_log_' + $timeStamp + '.txt'
      robocopy "E:\iTunes\" "F:\iTunes\" /COPY:DAT /MIR /LOG:$logFile
      robocopy "E:\itunes\iTunes Media\Music" "E:\Dropbox\Music" /COPY:DAT /MIR
  }

For a good reference on Powershell, as well as Bash and OSX, check out ss64.com.

published on 2015-09-28
updated on 2015-12-30