Skip to content

Instantly share code, notes, and snippets.

@tomsiwik
Last active November 17, 2021 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomsiwik/9c7d0a621ec1e17cdf568286eb0a97bf to your computer and use it in GitHub Desktop.
Save tomsiwik/9c7d0a621ec1e17cdf568286eb0a97bf to your computer and use it in GitHub Desktop.
Setup WSL with debian & docker
#!/bin/bash
sudo apt update -y && sudo apt upgrade -y
sudo apt install software-properties-common build-essential git wget curl zsh unzip neovim -y
sudo apt install --no-install-recommends apt-transport-https ca-certificates gnupg2 -y
# oh my zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# node
curl -fsSL https://fnm.vercel.app/install | bash
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
# setup console
sed -i -e 's/ZSH_THEME="robbyrussell"/ZSH_THEME="powerlevel10k\/powerlevel10k"/g' .zshrc
sed -i -e 's/plugins=(git)/plugins=(git debian deno docker ipfs kubectl minikube npm node pip python rust yarn fast-syntax-highlighting zsh-autosuggestions zsh-completions)/g' .zshrc
source .zshrc
# yarn, npm etc
fnm install 16
npm i -g npm@latest yarn@latest
# rust etc
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
# remove docker things - just in case
sudo apt remove docker docker-engine docker.io containerd runc
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
VERSION_CODENAME=$(dpkg --status tzdata|grep Provides|cut -f2 -d'-')
echo "deb [arch=amd64] https://download.docker.com/linux/debian ${VERSION_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
sudo groupmod -g 36257 docker
# setup shared socket
DOCKER_DIR=/mnt/wsl/shared-docker
mkdir -pm o=,ug=rwx "$DOCKER_DIR"
chgrp docker "$DOCKER_DIR"
sudo mkdir /etc/docker/
sudo bash -c 'cat << EOF > /etc/docker/daemon.json
{
"hosts": ["unix:///mnt/wsl/shared-docker/docker.sock"],
"iptables": false
}
EOF'
wsl --install -d Debian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment