My Windows Setup Process

Series: tutorial December 30, 2017

There tends to be a lot I want to do with a new (Personal) Windows PC. It can be quite a bit to manage. On most PCs, I like to:

  • Install custom fonts
  • Install the Windows Subsystem for Linux
  • Install web browsers
  • Install docker
  • Install Sublime Text
  • Install cmder
  • [Depending on the PC] Install Steam and Streaming software
  • Remove a bunch of software that comes pre-installed
  • Change a variety of default settings.
  • Name the computer.
  • Setup my default linux configuration in Ubuntu.

This document is an attempt to walk through the manual and automatic setup process for a new computer.

Boxstarter

I recently heard about Boxstarter via Jessie Frazelle’s Blog. It allows me to run a script to setup my computer the way I like it.

By running one simple script in PowerShell, I can get quite a lot of my setup done.

# Run PowerShell as Admin.
# Note that the current Boxstarter file does not have $gaming = $True

Set-ExecutionPolicy RemoteSigned

. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force

start http://boxstarter.org/package/nr/url?https://gist.github.com/CJKinni/de205822b0dddd2b18054fe7a29f72bc

Cmder

I then pin Cmder C:\tools\cmder\cmder.exe to the taskbar manually.

I then File/Icon -> Settings -> Reset... -> Yes

Under ‘Choose your startup task or even a shell with arguments:’ I set:

%windir%\system32\bash.exe ~ --login
  • Ok
  • Save Settings
  • Restart the application and if everything went according to plan, you’ll be in a bash prompt!

WSL

Interacting with Windows

I like to be able to interact with development projects in both Windows and WSL. So I create a link between a code folder in my home directory on Windows and Ubuntu:

cd /mnt/c/Users/[Username]
mkdir code
ln -s /mnt/c/Users/[Username]/code ~/code
cd ~/code

This way, I can modify files on both systems. Allowing me to, for example, run a Rails server on Ubuntu while editing its code in Sublime Text on Windows.

SSH Keys

cd ~
mkdir .ssh

I then copy my id_rsa and id_rsa.pub files into ~/.ssh/.

I also change the priviledges of the private key:

chmod 400 id_rsa

Dotfiles

I currently keep my dotfiles private. Eventually I’ll go through them to ensure nothing secure is in them. But for now, this section is of less use to anyone but myself.

sudo apt-get install make
cd ~/code
git clone git@github.com:CJKinni/dotfiles.git
cd dotfiles
make dotfiles

Then I can restart my shell for the dotfiles to take affect.

Easy Installations

Apt

Inside my dotfile’s Makefile, I have the ability to install a variety of frequently used packages.

cd ~/code/dotfiles
sudo make apt

Docker

Inside my dotfile’s Makefile, I also have the ability to install Docker. This speeds up the docker install process.

cd ~/code/dotfiles
sudo make docker

Note: Docker won’t actually run under WSL. However, since I’ve also installed Docker for Windows via Boxstarter, I have the following code in my .bashrc to use Docker for Windows within bash. This requires one change to be made in windows. Docker -> Settings... and check ‘Expose daemon on tcp://localhost:2375 without TLS’. We also have to bind /mnt/c to /c so that Docker for Windows will look at the right place for volumes. make wsl handles this for me. This does mean that our home is the dotfiles git folder. This is the easiest option, since symlinks won’t work otherwise, and I use my dotfiles to power some containers

#!/bin/bash

if grep -qE "(Microsoft|WSL)" /proc/version &> /dev/null ; then
  # Use Docker on Windows if using WSL
  export DOCKER_HOST="tcp://0.0.0.0:2375"

  # Move Home to a volume accessable to Windows
  export HOME='/c/Users/ckinn/code/dotfiles/'
  cd $HOME
fi

Burning it to the ground

In the event that you want to reinstall the WSL Ubuntu Environment and rebuild:

lxrun /uninstall /full
lxrun /install /y

You can remove /full if you don’t want to get rid of your home folder.


built with , Jekyll, and GitHub Pages — read the fine print