Difference between revisions of "Install on WSL"

From ArchWiki
Jump to navigation Jump to search
(→‎Installation: Changed SystemV IPC issue)
(at archive category)
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[ja:WSL にインストール]]
#REDIRECT [[ArchWiki:Archive]]
[[ru:Install on WSL]]
[[zh-hans:Install on WSL]]
{{Archive|We don't have the human resources to handle the support requests encouraged by this article.|section=Category or archive}}
Windows 10 has a subsystem that emulates the Linux kernel interface to allow ordinary Linux applications to run. It is somewhat like the opposite of [[Wine]], but at a lower level. By default it comes with Ubuntu user space, but that can be replaced with Arch. To get it working properly you will require access to an existing Arch installation to build some packages. These instructions are based on [https://www.reddit.com/r/bashonubuntuonwindows/comments/5vnne8/howto_installing_arch_on_wsl_manually/ this guide].
{{Warning|A WSL install is NOT an Arch Linux installation, so is not supported in the Arch Community support channels.}}
== Preparation ==
{{Note|If you have used WSL prior to the Fall Creators Update, uninstall it first from the command prompt (you might want to save some data first):
> lxrun /uninstall /full /y
If you are running the Windows 10 Fall Creators Update or later, enable "Windows Subsystem for Linux" in ''Turn Windows features on or off''.
If you are on the Anniversary Update or Creators Update, follow the instructions [https://msdn.microsoft.com/en-gb/commandline/wsl/install_guide here] to enable it.
== Installation ==
{{Note|If you're using a Windows version older than the Fall Creators Update, use {{ic|%localappdata%\lxss\rootfs}} instead of {{ic|%localappdata%\Packages\CanonicalGroupLimited.UbuntuonWindows_*\LocalState\rootfs}}.}}
Install [https://www.microsoft.com/en-us/store/p/ubuntu/9nblggh4msv6 Ubuntu from the Windows Store].
Start Ubuntu from the Start Menu.
Make sure the Default user is root:
$ ubuntu config --default-user root
Download an Arch bootstrap .tar.gz from [https://www.archlinux.org/download/ Arch Linux Downloads], and extract it:
$ tar -zxvf /mnt/c/Users/''username''/Downloads/archlinux-bootstrap-''version''.tar.gz
Uncomment a server in {{ic|~/root.x86_64/etc/pacman.d/mirrorlist}}.
Make WSL autogenerate {{ic|/etc/resolv.conf}}:
$ echo "# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line." > ~/root.x86_64/etc/resolv.conf
Exit all bash prompts you have open.
In the Windows explorer, navigate to {{ic|%localappdata%\Packages}} and look for a folder called {{ic|CanonicalGroupLimited.UbuntuonWindows_*}} where the asterisk is a random string.
From {{ic|%localappdata%\Packages\CanonicalGroupLimited.UbuntuonWindows_*\LocalState\rootfs}}, delete {{ic|bin}}, {{ic|etc}}, {{ic|lib}}, {{ic|lib64}}, {{ic|sbin}}, {{ic|usr}} and {{ic|var}}.
Now move (do not copy) the same folders from {{ic|rootfs\root\root.x86_64}} to {{ic|rootfs}}
Using a Linux computer build {{Aur|fakeroot-tcp}} and {{Aur|glibc-wsl}}. Note that {{ic|--nocheck}} can be used with {{ic|makepkg}} to skip a very time-consuming test suite when building {{Aur|glibc-wsl}}.
Then copy the packages to your Windows PC. ''glibc-wsl'' has a workaround for [https://github.com/Microsoft/BashOnWindows/issues/1878 this bug], and ''fakeroot-tcp'' is necessary until System V IPC is fully implemented [https://github.com/Microsoft/WSL/issues/1443 (see here)]. This step will be unnecessary when those bugs are fixed.
Open bash again, and setup Arch:
# pacman-key --init
# pacman-key --populate archlinux
# pacman -U /mnt/c/Users/''username''/Downloads/glibc-wsl-2.25-2-x86_64.pkg.tar.xz
# pacman -U /mnt/c/Users/''username''/Downloads/fakeroot-tcp-1.21-2-x86_64.pkg.tar.xz
# pacman -Syyu base base-devel
Set up a user (does not have to be the same as your Windows username):
# useradd -m -G wheel -s /bin/bash ''username''
# passwd root
# passwd ''username''
Set the user as the default by running the following in a Windows command prompt:
{{Note|If you are running the Windows 10 Fall Creators Update or later, use this command: {{ic|ubuntu config --default-user username}}}}
> lxrun /setdefaultuser ''username''

Latest revision as of 17:53, 2 February 2018

Redirect to: