Git Product home page Git Product logo

arch_linux_wsl2's Introduction

Arch Linux on WSL2

These are installation instructions for Arch Linux in WSL2 using the officially built bootstrap image.

Requirements

  1. Install WSL2
  2. Update to the latest kernel
  3. Set WSL2 as the default version wsl --set-default-version 2 (version 2 is set by default in newer windows builds)

Preparing the Image

In an existing linux install (another WSL distro, VM, or native), download the archlinux-bootstrap-<version>-x86_64.tar.gz bootstrap image from an arch mirror closest to you.

AS ROOT via sudo or a root user, run the following commands:

  1. Extract the downloaded image: tar -zxvf archlinux-bootstrap-<version>-x86_64.tar.gz
  2. Navigate into the extracted directory: cd root.x86_64
  3. Compress the contents of inside the directory: tar -zcvf arch_bootstrap.tar.gz .

The reason this must be done as root is to preserve file ownership of bootstrap filesystem when it is imported into WSL. If this is not done, you will likely experience permissions issues when interacting with imported the operating system.

Once the new archive is created, move the file to the machine Arch will be installed on (copy to usb drive, or move out of existing WSL).

Importing the Image

On the machine Arch will be installed on:

  1. Create a directory where the Arch virtual disk file will live, for example C:\Users{USER}\wsl
  2. Import the gzip archive into WSL, replacing the first path with the directory created in the previous, step and the second path with the path to the created archive from the previous section: wsl --import Arch C:\Users\{USER}\wsl C:\path\to\arch_bootstrap.tar.gz

Configuring Arch in WSL2

Arch can now be launched on the machine it was installed on. Some additional configuration will be needed to make this a fully functional arch install:

  1. Launch the installation: wsl -d Arch
  2. Initialize the keyring required to run pacman: pacman-key --init
  3. Fill the new keyring with Arch's latest set of keys: pacman-key --populate archlinux
  4. Pacman's mirrorlist is already installed but entirelly commented out. Fetch a new one and overrite the existing one: curl "https://archlinux.org/mirrorlist/?country=US&protocol=https&ip_version=4&use_mirror_status=on" | cut -c 2- > /etc/pacman.d/mirrorlist
  5. Update the repos and install the latest packages: pacman -Syu
  6. There will also be a handful of missing "base" packages that are always useful to have and can be installed with: pacman -S base base-devel

Next Steps

From here, you can continue setting up your new Arch Linux based WSL2 installation by following the Installation Guide. It is probably a good idea to set your locale, hostname, and to create yourself a new user to use. Keep in mind that you will not need to worry about your fstab or bootloader to use Arch in WSL. Installing an aur helper is also a good idea.

Additionally, if you use Windows Terminal you can set Arch to launch with your new user in its home directory by adding "commandline": "wsl ~ -u <username>" to the profile in the profile list. Arch must be the default WSL installation for this to work (which can be done with wsl --set-default Arch.

arch_linux_wsl2's People

Contributors

nckslvrmn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.