Script to enable systemd support on current Ubuntu WSL2 images from the Windows store. Script is unsupported and will no longer be maintained, but will be up here because it is used by quite some people. I am not responsible for broken installations, fights with your roommates and police ringing your door ;-).
Instructions from the snapcraft forum turned into a script. Thanks to Daniel on the Snapcraft forum!
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update -y
sudo apt-get install -y docker-ce
sudo usermod -aG docker $USER && newgrp docker
git https://github.com/antonchernik/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
bash ubuntu-wsl2-systemd-script.sh
# Enter your password and wait until the script has finished
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
sudo apt-get install apt-transport-https --yes
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
sudo apt install -y conntrack
sudo snap install microk8s --classic
sudo microk8s.start
sudo microk8s.enable dns helm3 storage ingress registry dashboard
sudo microk8s.status
sudo microk8s.inspect
File "/etc/docker/daemon.json" does not exist. You should create it and add the following lines:
{
"insecure-registries" : ["localhost:32000"]
}
sudo usermod -a -G microk8s $USER
mkdir ~/.kube
sudo chown -f -R $USER ~/.kube
newgrp microk8s
snap install kubectl --classic
microk8s.kubectl config view --raw > $HOME/.kube/config
echo 'export KUBECONFIG=$HOME/.kube/config' >> ~/.bash_profile
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get update
sudo apt install golang-go
cd /tmp
git clone https://github.com/derailed/k9s.git
cd k9s && make build
sudo mv ./execs/k9s /usr/local/bin/k9s