Skip to content

KevinSilvester/wsl-backup

Repository files navigation

WSL Backup


Setup VcXSrv for use with WSL2

This set up is to enable x11 forwarding without disabling access control

In WSL distro

  1. Install xauth, md5sum and gawk or awk
sudo apt install -y xauth coreutils gawk gnome-terminal

xauth list # this should be an empty list

magiccookie=$(echo '{some-pass-phrase}'|tr -d '\n\r'|md5sum|gawk '{print $1}')
wslip=$(ip route list default | awk '{print $3}'):0

rm -f ~/.Xauthority && touch ~/.Xauthority && xauth add $wslip . $magiccookie

cp ~/.Xauthority /mnt/c/Users/{WindowsUserName}
  1. Set the DISPLAY environment variable
export DISPLAY=$(xauth list | awk '{print $1}')
  1. Update the following entries in the SSH config file
sudo vim /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
XAuthLocation /usr/bin/X11/xauth

In Windows host

  1. Install wget and vcxsrv using scoop
scoop install wget vcxsrv
  1. Download the powershell script to create/update the inbound firelwall rules and to start the vcxsrv server
# create a folder in user home directory to house scripts
if (-Not (Test-Path -Path "$env:HOMEPATH\scripts")) { mkdir "$env:HOMEPATH\scripts" }

# Download the batch file
wget -O "$env:HOMEPATH\scripts\wsl-x11.bat" "https://gist.githubusercontent.com/KevinSilvester/bf6596393dac89a15ab2b3e0fd40acc9/raw/fe5db1fc07ca8b99601a8ab803fb28f933daae43/wsl-x11.bat"

# Download the powershell script
wget -O "$env:HOMEPATH\scripts\wsl-x11.ps1" "https://gist.githubusercontent.com/KevinSilvester/2976fc9bcbb716b1731ebb26af403580/raw/b8d6eba678a4250ed29c0e3863560e84fc56058f/wsl-x11.ps1"
  1. Run the batch file start the set up
"$env:HOMEPATH\scripts\wsl-x11.bat"

Essentials

Sudo

apt update
apt-get install sudo -y

Tools

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install git zsh curl
sudo apt-get update && sudo apt-get upgrade
# instal omz
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# make zsh default shell
chsh -s $(which zsh)

Create '__root__' folder

cd $HOME
git clone https://github.com/KevinSilvester/wsl-backup.git __root__

ZSH

cd $ROOT/zsh
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
cd $ROOT/zsh
git clone https://github.com/zsh-users/zsh-autosuggestions.git
cd $ROOT/zsh
git clone https://github.com/supercrabtree/k.git
cd $ROOT/zsh
mkdir extract
cd extract
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/extract/extract.plugin.zsh
cd $ROOT/zsh
mkdir colorize
cd colorize
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/colorize/colorize.plugin.zsh

ZSH Custom Theme

ln -s $ROOT/zsh/smushed.zsh-theme $HOME/.oh-my-zsh/custom/themes/smushed.zsh-theme

Based on default Robby Russel theme and Passion theme https://github.com/ChesterYue/ohmyzsh-theme-passion


mlocate

Install 'mlocate' to fix dpkg errors

# install mlocate
sudo bash -c "apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get -y clean"
sudo apt-get install mlocate
sudo updatedb

# add '/mnt' to PRUNEPATHS in /etc/updatedb.conf to avoid indexing windows files when running fix
# :q! >> exit without saving
# :wq >> exit and save
sudo vi /etc/updatedb.conf

To fix dpgk errors run

sudo dpkg --configure -a

NodeJS

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install --lts --latest-npm

Rust and Python

# python
sudo bash -c "apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get -y clean"
sudo apt install python3
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

# rust
# check at https://www.rust-lang.org/tools/install
sudo bash -c "apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get -y clean"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Dotfiles

# remove default config
cd $HOME
rm .zshrc .zshenv .zprofile .bashrc .bash_profile .gitconfig .nanorc

# replace with new config
ln -s $ROOT/dotfiles/.zshrc $HOME/.zshrc
ln -s $ROOT/dotfiles/.zshenv $HOME/.zshenv
ln -s $ROOT/dotfiles/.zprofile $HOME/.zprofile
ln -s $ROOT/dotfiles/.bashrc $HOME/.bashrc
ln -s $ROOT/dotfiles/.bash_profile $HOME/.bash_profile
ln -s $ROOT/dotfiles/.gitconfig $HOME/.gitconfig
ln -s $ROOT/dotfiles/.nanorc $HOME/.nanorc


Other Utilities

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
sudo bash -c "apt-get update && apt-get -y upgrade && apt-get -y autoremove && apt-get -y clean"

# ffmpeg: preview video thumbnail 
# w3m: preview html pages
# jq: preview json
# highlight: syntax highlighting
# mediainfo: info about media files
sudo apt-get install ranger ffmpeg w3m jq highlight mediainfo

## RANGER IMAGE PREVIEW DOES NOT WORK IN WSL
# ueberzug: image preview utility for ranger
# sudo apt install python3 libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev libx11-dev python3-distutil
# pip3 install ueberzug

# file icons for ranger
git clone https://github.com/alexanderjeurissen/ranger_devicons ~/.config/ranger/plugins/ranger_devicons

# add ranger config
echo "default_linemode devicons
set show_hidden true
set preview_images false" >> ~/.config/ranger/rc.conf

termimage: terminal image preview in rush

cargo install termimage

neofetch: view machine and distro info

sudo apt-get neofetch

ncdu: storage usage monitor

sudo apt install ncdu

(~ ̄▽ ̄)~ (~ ̄▽ ̄)~ (~ ̄▽ ̄)~

sudo apt-get install cmatrix hollywood sl

About

dotfiles for wsl

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published