A few settings files for my current development setup
I'm running Windows 10, using WSL2 with Ubuntu for development.
I prefer to use Docker Desktop and configure VS Code to use that as a remote interpreter. I also develop with Pycharm in a similar way but have issues with the debugger so I've been leaning on VS Code.
Project files are kept inside a WSL2 folder location.
Inspired by https://github.com/nickjj/dotfiles
https://docs.microsoft.com/en-us/windows/wsl/install-win10
Afterwards you can install Ubuntu or Debian or another distro
There is a possible bug related to the $PATH variables loading into WSL2. If you find you can't launch Windows binaries from inside WSL2 (like code .
, they may not be in your PATH due to microsoft/WSL#5779 . The solution is to remove the following lines from /etc/profile
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
I have sometimes had a lot of difficulty maintaining an internet connection inside the WSL2 environment. This is always due to something about /etc/resolv.conf
, which WSL tries to automatically set. Docker Desktop seems to interfere, and VPNs will definitely mess this up. I generally fix it by removing the "auto-generated" file (which sometimes is just a symlink that doesn't actually point to a file??) and replacing it with a file that has the following contents: nameserver 8.8.8.8
(google's nameserver), or if I'm behind a VPN I look up the specific nameservers I will need. I don't know enough about networking to understand this issue deeper.
sudo apt update && sudo apt install -y \
curl \
ffmpeg \
git \
htop \
python3-pip \
python3-venv \
rsync \
unzip \
vim \
tmux \
neovim
Close wsl2 and re-open (or logout/login) so PATH can be updated
Pyenv and Poetry are best installed through their installer scripts called out in their documentation.
ensure the following:
chmod 700 ~/.ssh/
chmod 644 ~/.ssh/<publickey>.pub
chmod 600 ~/.ssh/<privatekey>
Probably want to set up ssh-agent (if below command doesn't work, you may need to specify filepath specifically):
ssh-add -l
To start:
eval `ssh-agent`
SSH
git clone git@github.com:rengler33/dotfiles.git ~/github/dotfiles/
ln -s ~/github/dotfiles/.bash_aliases ~/.bash_aliases && \
ln -s ~/github/dotfiles/.gitconfig ~/.gitconfig && \
ln -s ~/github/dotfiles/.vimrc ~/.vimrc && \
sudo ln -s ~/github/dotfiles/etc/wsl.conf /etc/wsl.conf
cp ~/github/dotfiles/.gitconfig.user ~/.gitconfig.user
My example file has the nameservers for NordVPN
sudo rm -r /etc/resolv.conf && sudo cp ~/github/dotfiles/etc/resolv.conf /etc/resolv.conf
Note: if the file is designated "immutable", you will need to use chattr
to first be able to edit it. As superuser and owner of the file (root):
chattr -i /etc/resolv.conf
vim /etc/resolv.conf
chattr +i /etc/resolv.conf
Go to /etc/inputrc and (as privileged user) umcomment/add line set bell-style none
Install pip if needed
sudo apt update
sudo apt install python3-pip
Install pipx
python3 -m pip install --user pipx
python3 -m pipx ensurepath
Install global python packages with pipx
pipx install \
pipenv \
cookiecutter \
flake8 \
black \
isort \
pytest \
pre-commit \
youtube-dl
Install AWS CLI V2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip && sudo ./aws/install && rm awscliv2.zip
https://chocolatey.org/install
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y `
firefox `
googlechrome `
nordvpn `
microsoft-windows-terminal `
powertoys `
autohotkey `
7zip.install `
putty.install `
curl `
ffmpeg `
kodi `
vlc `
winscp.install `
qbittorrent `
zoom `
obs-studio `
sizer `
calibre `
kindle `
vim `
markdownmonster `
steam `
git.install `
docker-desktop `
pycharm `
vscode `
vscode-insiders `
postman
Install MesloLGS NF font https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFonts (this is a good font that works well with oh-my-zsh and powerlevel10k)
Copy the items in the C/ folder manually to the Windows system if they're needed.
Note that the _vimrc
file needs the directory ~\vimtmp
to be created in order to store temporary files there specifically, otherwise it will use current directory.
One AHK script I like to have is a minimize/un-minimize option for WindowsTerminal.exe, you can make it startup at login by placing the script in C:\Users\
[your username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
You can change the default profile of windows terminal to be a WSL distro. You can also change the starting directory in the settings. See the example file.
Additionally you can create your own shortcut for windows terminal to open multiple tabs or panes using a target like this:
wt -p "Ubuntu"; split-pane -p "Ubuntu"; new-tab -p "Windows PowerShell"; focus-tab -t 0
See more about this here https://docs.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows
Start with installing the "Remote Development" extension pack, a group of useful remote extensions.
- Remote Development (Extension Pack)
- Vim
- Docker
- GitLens
- Rainbow Brackets
- Python
- Pylance
- Python Docstring Generator
- Python Indents
- Jupyter
To be inside WSL automatically change default terminal from cmd.exe
to bash.exe
https://docs.docker.com/docker-for-windows/wsl/
Install sudo apt install cifs-utils
Create a file in ~/.smbcredentials
that looks like this:
username=<USERNAME>
password=<PASSWORD>
Run sudo chmod 600 ~/.smbcredentials
to lock down file permissions on that file.
Edit /etc/fstab
to include a line with the following:
//<SERVER>/<SHARE> <MOUNTPATH> cifs rw,credentials=~/.smbcredentials,iocharset=utf8,nounix,file_mode=0777,dir_mode=0777 0 0
Note the mountpath will need folders that already exist, e.g. /mnt/hagrid/courses
Run sudo mount -a
to mount the paths.