Skip to content

Instantly share code, notes, and snippets.

@litan1106
Last active December 18, 2024 22:48
Show Gist options
  • Save litan1106/b7752acaa371f89660c7b83f27f71577 to your computer and use it in GitHub Desktop.
Save litan1106/b7752acaa371f89660c7b83f27f71577 to your computer and use it in GitHub Desktop.
wsl-systemd
# Install the latest wsl2 with systemd support
# https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/
# Update the latest wsl
wsl --update --web-download
# Install Ubuntu with username vagrant
wsl --install -d Ubuntu-22.04
# Set Ubuntu as default distro
wsl --set-default Ubuntu-22.04
# Setup systemd
echo "
[boot]
systemd=true
" | sudo tee /etc/wsl.conf
# Set nameserver
echo 'echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf' >> /home/vagrant/.profile
# Setup sudoe
echo "vagrant ALL=NOPASSWD:ALL" | sudo tee /etc/sudoers.d/vagrant
# Restart wsl
wsl --shutdown
wsl -d Ubuntu
# Check IP in wsl
ip a
# Process the Homestead WSL installation
```bash
cd /mnt/c/Homestead
sudo ./bin/wsl-init
[sudo] password for vagrant:
What is your WSL user name?
vagrant
What is your WSL user group? (Same as username if you're unsure)
vagrant
```
```bash
mkdir -p ~/.homestead-features/
./bin/homestead wsl:apply-features
./bin/homestead wsl:create-sites
./bin/homestead wsl:create-databases
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment