Last active
June 25, 2024 13:46
-
-
Save ilude/3354dfef63cdb9e24370d5074b7aa11e to your computer and use it in GitHub Desktop.
Windows Subsystem for Linux v2 setup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy and run in an administrator powershell | |
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/ilude/WindowsPowerShell/master/choco_install_development.ps1')) | |
bash -c "curl -sSL https://gist.githubusercontent.com/ilude/3354dfef63cdb9e24370d5074b7aa11e/raw/wsl_init.sh | bash -s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# exit if any of these commands fail | |
set -e | |
# setup sudoers | |
echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/$USER | |
# check the syntax of the sudoer file that was created | |
visudo -cf /etc/sudoers.d/$USER | |
# install zsh and plugins | |
sudo apt update | |
sudo apt dist-upgrade -y | |
sudo apt install -y git nano zsh zsh-autosuggestions zsh-syntax-highlighting | |
# install oh-my-zsh | |
curl -sLO "https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh" | sudo bash -s | |
# install zshrc file | |
curl -sSL https://raw.githubusercontent.com/ilude/ansible-k3s-cluster/production/config/zshrc > ~/.zshrc | |
echo "cd ~" >> ~/.zshrc | |
# allow chsh to run without a password prompt | |
sudo sed s/required/sufficient/g -i /etc/pam.d/chsh | |
# change current user's shell to zsh | |
# https://askubuntu.com/a/131838 | |
chsh -s $(which zsh) | |
curl -sSL https://gist.githubusercontent.com/ilude/e2342829a97c3c3d3da5f9c73976c4ec/raw/gitconfig > ~/.gitconfig | |
git config --global --add core.editor "nano -w" | |
git config --global --add branch.autosetuprebase always | |
git config --global --add diff.tool p4merge | |
git config --global --add difftool.prompt false | |
git config --global --add difftool.p4merge.cmd "/mnt/c/Program\ Files/Perforce/p4merge.exe '\$(wslpath -aw $LOCAL)' '\$(wslpath -aw $REMOTE)'" | |
git config --global --add merge.tool p4merge | |
git config --global --add mergetool.prompt false | |
git config --global --add mergetool.keepbackup false | |
git config --global --add mergetool.p4merge.trustexitcode false | |
git config --global --add mergetool.p4merge.cmd "/mnt/c/Program\ Files/Perforce/p4merge.exe '\$(wslpath -aw $BASE)' '\$(wslpath -aw $LOCAL)' '\$(wslpath -aw $REMOTE)' '\$(wslpath -aw $MERGED)'" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment