Windows_10_Bash - bootstraponline/meta GitHub Wiki

Known Issues

Enable

Search for Turn Windows Features On or Off then enable Windows Subsystem for Linux (Beta)

Add user

  • # adduser surface
  • # usermod -aG sudo surface
  • lxrun /setdefaultuser surface - Run in cmd.exe after creating the user via bash

Paths

Path to Bash filesystem: %localappdata%\Lxss

Windows file system is at: /mnt/c

Install Ruby

# code from https://github.com/instructure/dockerfiles/blob/master/ruby/2.3/Dockerfile
sudo -i
apt-add-repository -y ppa:brightbox/ruby-ng \
 && apt-get update \
 && apt-get install -y \
      ruby2.3 \
      ruby2.3-dev \
      make \
      imagemagick \
      libbz2-dev \
      libcurl4-openssl-dev \
      libevent-dev \
      libffi-dev \
      libglib2.0-dev \
      libjpeg-dev \
      libmagickcore-dev \
      libmagickwand-dev \
      libmysqlclient-dev \
      libncurses-dev \
      libpq-dev \
      libreadline-dev \
      libsqlite3-dev \
      libssl-dev \
      libxml2-dev \
      libxslt-dev \
      libyaml-dev \
      zlib1g-dev

Update RubyGems

sudo gem update --system

Install Git

sudo add-apt-repository ppa:git-core/ppa; \
sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get dist-upgrade -y; \
sudo apt-get autoremove -y; \
sudo apt-get install -y git

Configure Git

git config --global core.autocrlf true

Oh My ZSH

  • sudo apt-get install -y zsh
  • sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  • git clone https://github.com/powerline/fonts.git powerline_fonts
    • Double click to install fonts/Meslo/Meslo LG M DZ Regular for Powerline.otf
  • Install latest release of ConEmu
    • Configure font. Settings → Main → Main console font
    • Configure style. Settings → Features → Colors → Schemes → <Solarized (Luke Maciak)>
  • Edit ~/.zshrc and set theme to agnoster
  • Uncomment DISABLE_LS_COLORS="true" in ~/.zshrc
    • By default all permissions are 777 which makes the folders difficult to read when using ls coloring.
  • Edit ~/.bashrc to start with exec zsh. This will launch ZSH by default.
    • nano ~/.bashrc
      • Ctrl+O then Ctrl+X
  • Set bash as the default startup terminal.
    • Settings → Startup → Command line
  • Add custom method to go to code directory.
    • nano ~/.oh-my-zsh/custom/custom.zsh
# c loads the code directory
alias c="/mnt/c/Users/surface/code"

alias zshconfig="nano ~/.zshrc"
alias zshcustom="nano ~/.oh-my-zsh/custom/custom.zsh"
alias zshreload=". ~/.zshrc"

Update Ubuntu Release

Update to Xenial

  • Set update mode (normal or LTS)
    • nano /etc/update-manager/release-upgrades
  • Start dbus before installing apt packages
    • sudo service dbus start
  • Activate interactive sudo to prevent terminal from asking for a password.
    • sudo -i
  • sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get dist-upgrade -y; sudo apt-get autoremove -y
  • sudo do-release-upgrade -f DistUpgradeViewNonInteractive -d
    • Wait a while. Ignore any errors. May have to Ctrl+C and then invoke dpkg to finish package config.
  • echo 'yourpassword' | sudo -S dpkg --configure -a
  • sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get dist-upgrade -y; sudo apt-get autoremove -y

Verify Ubuntu version

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

Set default user on ZSH

  • Hide the user@hostname by modifying zshconfig

export DEFAULT_USER="`whoami`"

Sudo issues

  • sudo: unable to resolve host SURFACE
    • sudo nano /etc/hosts
    • Update with 127.0.0.1 localhost SURFACE
  • sudo: no tty present and no askpass program specified
    • Run zshcustom and add: alias sudo="sudo -S"

pbcopy / pbpaste

Xclip is currently broken on Windows due to lack of display emulation.

Error: Can't open display: (null)

  • sudo apt-get install -y xclip
$ zshcustom
alias pbcopy="xclip -selection clipboard"
$ zshreload

Reset Ubuntu (from cmd.exe)

lxrun /uninstall /full

lxrun /install /y

Fix bundler error

Notes