Skip to content

Instantly share code, notes, and snippets.

@maxgio92
Last active June 23, 2021 12:45
Show Gist options
  • Save maxgio92/15c371e19737906beb44f9a543c9cfc8 to your computer and use it in GitHub Desktop.
Save maxgio92/15c371e19737906beb44f9a543c9cfc8 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Get Arch Linux rootfs
mkdir rootfs && \
docker export \
$(docker create archlinux:latest) \
> archlinux-rootfs.x86_64.tar
mv archlinux-rootfs.x86_64.tar /mount/c/Users/myuser/archlinux-rootfs.x86_64.tar
# Import Arch Linux rootfs on a new WSL instance (on Windows)
# mkdir c:\Users\myuser\WSL\ArchLinux
# wsl --import ArchLinux c:\Users\myuser\WSL\ArchLinux c:\Users\myuser\archlinux-rootfs.x86_64.tar
# wsl -d ArchLinux
# On WSL - ArchLinux
# Choose repositories (/etc/pacman.conf)
# ...
# Update Pacman GPG keys
pacman-key --init
pacman-key --populate archlinux
pacman-key --refresh-keys
pacman -Sy archlinux-keyring
# Update all packages
pacman -Syyu
# Configure Pacman to extract man pages
sed -i '/NoExtract\ \ =\ usr\/share\/man\/\*\ usr\/share\/info\/\*/d' /etc/pacman.conf
pacman -S coreutils # re-install GNU coreutils with man pages extracted
# Setup myuser user
pacman -S sudo
groupadd wheel | true
sed -i 's/#\ %wheel\ ALL=\(ALL\)\ NOPASSWD:\ ALL/%wheel\ ALL=(ALL)\ NOPASSWD:\ ALL/g' /ets/sudoers
useradd -mG wheel myuser
su - myuser
passwd
exit
# Setup dotfiles
su - myuser
pacman -S git zsh vim
mkdir src
git clone https://github.com/maxgio92/dotfiles src/dotfiles
pushd src/dotfiles
make
popd
# Install Yay
sudo pacman -S base-devel
git clone https:/nux.org/yay-git.git src/yay
pushd src/yay
makepkg -si
yay -Syu
popd
rm -rf src/yay
# Change default user on login (on Windows)
# regedit
# Look for HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
# Set DWORD DefaultUid value to decimal user id of the new created myuser (by default 1000, or run id myuser in WSL)
# Upgrade WSL Linux kernel (on Windows)
# run the related msi file inside the cab one: https://www.catalog.update.microsoft.com/Search.aspx?q=wsl
# wsl --shutdown
# Thanks to
#https://blog.depau.eu/2020/03/05/installing-arch-wsl-manually
#https://github.com/yuk7/ArchWSL
#https://archlinux.org/download/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment