-
-
Save bdwyertech/b065086f721fbe89d73a9b89a2fc0af2 to your computer and use it in GitHub Desktop.
# Update to Latest Windows 10 Spring Refresh | |
# Install WSL | |
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux | |
# Get Ubuntu installed - https://docs.microsoft.com/en-us/windows/wsl/install-on-server | |
wsl.exe | |
# Install ChefDK deb package | |
# Symlink Relevant Home Folders | |
cd ~ | |
ln -s /mnt/c/Users/DwyerB/.aws/ . | |
ln -s /mnt/c/Users/DwyerB/.chef/ . | |
ln -s /mnt/c/Users/DwyerB/.ssh/ . | |
# Enable Regular Permissions | |
# /etc/wsl.conf | |
[automount] | |
enabled = true | |
options = "metadata,umask=77" # fmask=111 ? Not sure what fmask does yet | |
# Make it take effect Immediately | |
sudo umount /mnt/c | |
sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=77 | |
# Create Relevant PowerShell Functions | |
function kitchen | |
{ | |
wsl kitchen $args | |
} | |
function knife | |
{ | |
wsl knife $args | |
} |
My experience was a little different. Needed to run an elevated PowerShell session by creating a cmd file to execute PowerShell and launched by right-clicking the cmd file and running elevated with avecto. This allowed me to run the Enable-WindowsOptionalFeature as above to get wsl enabled but there was no wsl.exe. I then downloaded the Ubuntu distro, enabled sideloading but ended up stuck. After enabling developer mode I was able to execute bash from an elevated ps session. This triggered a download of ubuntu which then downloaded. It's still "extracting the filesystem" though so ymmv.
Probably want something like this in /etc/sudoers.d too
%myyusername ALL=NOPASSWD:ALL
Defaults env_keep += "http_proxy https_proxy no_proxy"
You can use Chocolatey's Shimgen to create links to Linux tools...
This can come in handy for getting linters and such to work correctly in Atom
# Shellcheck
C:\ProgramData\chocolatey\tools\shimgen.exe -p $(which wsl).Source -c 'shellcheck' -o 'C:\ProgramData\chocolatey\bin\shellcheck.exe'
# Rubocop
C:\ProgramData\chocolatey\tools\shimgen.exe -p 'C:\opscode\chefdk\embedded\bin\rubocop.bat' -o C:\ProgramData\chocolatey\bin\rubocop.exe
C:\ProgramData\chocolatey\tools\shimgen.exe -p $(which wsl).Source -c 'chef exec rubocop' -o C:\ProgramData\chocolatey\bin\rubocop.exe
For GPG behind a proxy
RVM Installation
sudo apt-key adv --keyserver keyserver.ubuntu.com --keyserver-options http-proxy=$http_proxy --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
@bschmoll that was basically my experience as well, although i first tried the Debian install. I eventually found this article that just led me to execute bash
in a cmd window, and it worked.
The symlinks in the OP's gist are very helpful; now I'm trying to figure out how to get knife and kitchen to work. The error i get is:
bash: /mnt/c/opscode/chefdk/bin/kitchen: C:/opscode/chefdk/embedded/bin/ruby.exe: bad interpreter: No such file or directory
So i think i have to set a new ruby PATH? I'm not very good at this kind of thing - i get it, but i tend to not know where to look.
Probably also want this in your
~/.bashrc
to autoload SSH key into SSH Agent