Developer Setup
Windows¶
- Update WSL2 first (by default WLS1 is enabled)
- Install Ubuntu from Microsoft Stores
- Install Visual Studio Code
- Update Linux packages
sudo apt update sudo apt -y upgrade
- To find the home directory in Ubuntu
explorer.exe .
-
Install Windows Terminal for Miscrosoft Store
-
Install Menlo font (from Powerlevel10k site)
-
To test the terminal color output, run this code in the terminal
for code in {30..37}; do \ echo -en "\e[${code}m"'\\e['"$code"'m'"\e[0m"; \ echo -en " \e[$code;1m"'\\e['"$code"';1m'"\e[0m"; \ echo -en " \e[$code;3m"'\\e['"$code"';3m'"\e[0m"; \ echo -en " \e[$code;4m"'\\e['"$code"';4m'"\e[0m"; \ echo -e " \e[$((code+60))m"'\\e['"$((code+60))"'m'"\e[0m"; \ done
- Generate SSH keys
ssh-keygen -t rsa -b 4096 -f ~/.ssh/raddit-user -C raddit-user
-
-C
is the comment, you can also write-C 'keys generated on 20th Oct 2022'
ssh-keygen -t rsa -b 4096 -f ~/.ssh/ansible-user -C ansible-user
-
Using the .ssh config files (~/.ssh/config)
# 1. Generate public & private ssh keys: `ssh-keygen -t rsa` # Type in a name which will be put in `~/.ssh` directory # 2. To bypass password prompt, you should add the `foo.pub` file to the `authorized_keys` file on the # server's `~/.ssh` directory. You can do a pipe via ssh: `cat mykey.pub | ssh myuser@mysite.com -p 123 'cat >> .ssh/authorized_keys' ` # 3. Add the publickey name to the `~/.ssh/config` file like this: Host bitbucket.org IdentityFile ~/.ssh/myprivatekeyfile # the leading spaces are important! Port 123 # 4. Verify and then SSH into the remote server. To check if your config is right type: `ssh -T git@github.com` ssh root@mysite.com or ssh mysite.com # if you setup the User setting in config
- Copy ssh keys to an existing server
ssh-copy-id root@192.168.0.10
- This will copy default public keyid_rsa.pub
to server 192.168.0.10 in.ssh/authorized_key
file under root user.
Ubuntu¶
- Use bootable USB created using ventoy
- Press F12 at startup and select the bootable USB, select Ubuntu is image to begin installation
- Configure linux partitions as encrypted
- Add swap partion instead of efi as we will dual boot into same system. Part 2
- Change root password.
sudo passwd root
- Move Windows above Ubuntu in boot menu. Use Grub Customizer Part 3
-
Backup and restore data using rsync. Install programs using dotfiles.
- SSH Client Config
- Test SSH connections Edit setings on the new terminal to make Ubuntu as the default terminal. Also set the fontFace and https://www.the-digital-life.com/en/awesome-wsl-wsl2-terminal/
- Create Sudo User
- Securing Sudoers
#sudo visudo /etc/sudoers.d/leslie leslie ALL=(ALL:ALL) NOPASSWD: /usr/bin/docker, /usr/sbin/reboot, /usr/sbin/shutdown, /usr/bin/apt-get, /usr/local/bin/docker-compose
Switching remote URLs from HTTPS to SSH¶
List your existing remotes in order to get the name of the remote you want to change.
$ git remote -v
> origin https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin https://github.com/USERNAME/REPOSITORY.git (push)
$ git remote set-url origin git@github.com:USERNAME/REPOSITORY.git
Inspirational dotfile repos¶
https://www.freecodecamp.org/news/how-to-set-up-a-fresh-ubuntu-desktop-using-only-dotfiles-and-bash-scripts/ Dotfiles Intial Automation Tmux and Otherconfig nickjj/dotfiles
https://github.com/jieverson/dotfiles-win/blob/master/install.sh
Bashrc Automation¶
https://victoria.dev/blog/how-to-do-twice-as-much-with-half-the-keystrokes-using-.bashrc/ https://victoria.dev/blog/how-to-write-bash-one-liners-for-cloning-and-managing-github-and-gitlab-repositories/
Vagrant setup¶
https://www.techdrabble.com/ansible/36-install-ansible-molecule-vagrant-on-windows-wsl
Tmux¶
Every Hacker should have a great terminal | TMUX - Medium¶
VSCode¶
Key Shortcuts Mastering Terminal