Deploy Arch Linux on Windows Subsystem for Linux “WSL”
WSL brings few advantages over VM installation “Install Arch Linux on Windows 10 Hyper-V” Originally WSL was running Ubuntu 14.4 and now you can find few more options in Windows Store. I was unable to find my preferred distribution Arch Linux. Few option is available off shell and in current document will describe how to install and configure Arch Linux under WSL using ArchWSL.
Installation procedure is straightforward.
Requirements
- Download latest ArchWSL
- Install Windows Subsystem for Linux “WSL”
- Follow Installation instructions from ArchWSL
- Once Up and Running let’s follow below setup
Install development tools
pacman -Syyu
pacman -S base-devel
pacman -S p7zip unzip pygmentize docker vim htop git jq openssh rsync
Install additional tools if you want like tmux, python, go etc
pacman -S packer-io terraform tmux go python
Next we will try to deploy AUR where we can find additional software maintained by community for Arch Linux.
nano /etc/pacman.conf[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
Sync pacman and install yaourt
pacman -Syyu && pacman -S yaourt && yaourt -Syyu
Let’s create a user as we don’t want to run with root all the time
- Create user
useradd -m -g users -s /bin/bash your_user_name
passwd your_user_name
usermod -aG wheel your_user_namevisudo%wheel ALL=(ALL) NOPASSWD: ALL
I prefer pacur instead of yaourt, Pacaur requires additional dependencies to be installed under WSL
Install pacaur and dependencies
- Add gpg key
gpg — recv-key 1EB2638FF56C0C53
- Install fakeroot-tcp by creating and running script
#!/bin/bashmkdir sources
cd sources
wget http://ftp.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.22.orig.tar.bz2tar xvf fakeroot_1.22.orig.tar.bz2
cd fakeroot-1.22/
./bootstrap
./configure — prefix=/opt/fakeroot \
— libdir=/opt/fakeroot/libs \
— disable-static \
— with-ipc=tcpmake
sudo make install
- Add fakeroot to the path
nano /etc/profile# If user ID is greater than or equal to 1000 & if /opt/fakeroot/bin exists and is a directory & if /opt/fakeroot/bin is not already in your $PATH
# then export ~/bin to your $PATH.if [[ $UID -ge 1000 && -d /opt/fakeroot/bin && -z $(echo $PATH | grep -o /opt/fakeroot/bin ) ]]thenexport PATH=”${PATH}:/opt/fakeroot/bin”fi
Install pacaur and additional packages in this case kubernetes specific
yaourt -S pacaur
pacaur -Syyuasudo pacman -R fakeroot
pacaur -S kubernetes-kubectl kubernetes-helm istio
Create shortcut for Windows to start WSL with created user
Arch.exe config — default-user your_user_name
Additional you can run docker by installing docker binary “sudo pacman -S docker” but in order to used docker in WSL you need to have Docker installed in Windows and expose Docker API to tcp://0.0.0.0:2375
In .bashrc add below entry to allow docker from WSL access Windows Docker
export DOCKER_HOST=tcp://0.0.0.0:2375