Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Deploy Arch Linux on Windows Subsystem for Linux “WSL”

DZone's Guide to

Deploy Arch Linux on Windows Subsystem for Linux “WSL”

This quick tutorial will show you how you can install and configure Arch Linux on Linux WSL with additional dependencies.

· Open Source Zone ·
Free Resource

DON’T STRESS! Assess your OSS. Get your free code scanner from FlexeraFlexNet Code Aware scans Java, NuGet, and NPM packages.

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 a few more options in the Windows Store. I was unable to find my preferred distribution, Arch Linux. There are a few options available off the shelf, and this document will describe how to install and configure Arch Linux under WSL using ArchWSL.

The installation procedure is straightforward.

Requirements

  • Download latest ArchWSL
  • Install Windows Subsystem for Linux “WSL”

Image title

  • Follow Installation instructions from ArchWSL
  • Once you're up and running let’s follow the setup below:

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 the 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.

useradd -m -g users -s /bin/bash your_user_name
passwd your_user_name
usermod -aG wheel your_user_name

visudo

%wheel ALL=(ALL) NOPASSWD: ALL


I prefer pacaur 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 the script:

#!/bin/bash

mkdir sources
cd sources
wget http://ftp.debian.org/debian/pool/main/f/fakeroot/fakeroot_1.22.orig.tar.bz2

tar xvf fakeroot_1.22.orig.tar.bz2
cd fakeroot-1.22/
./bootstrap
./configure — prefix=/opt/fakeroot \
 — libdir=/opt/fakeroot/libs \
 — disable-static \
 — with-ipc=tcp

make
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 ) ]]
then
export PATH=”${PATH}:/opt/fakeroot/bin”
fi


Install pacaur and additional packages, in this case, Kubernetes-specific packages:

yaourt -S pacaur
pacaur -Syyua

sudo pacman -R fakeroot
pacaur -S kubernetes-kubectl kubernetes-helm istio


Create a shortcut for Windows to start WSL with created user

Arch.exe config — default-user your_user_name


Additionally, you can run Docker by installing the Docker binary  sudo pacman -S docker , but in order to use Docker in WSL, you need to have Docker installed in Windows and expose the Docker API to tcp://0.0.0.0:2375.

In .bashrc, add the below entry to allow Docker from WSL  to access Windows Docker.

export DOCKER_HOST=tcp://0.0.0.0:2375

Try FlexNet Code Aware Today! A free scan tool for developers. Scan Java, NuGet, and NPM packages for open source security and license compliance issues.

Topics:
arch linux ,windows 10 ,wsl ,installation ,open source

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}