Skip to content

Developer Setup

Windows

  1. Update WSL2 first (by default WLS1 is enabled)
  2. Install Ubuntu from Microsoft Stores
  3. Install Visual Studio Code
  4. Update Linux packages
    sudo apt update
    sudo apt -y upgrade
    
  5. To find the home directory in Ubuntu
    explorer.exe .
    
  6. Install Windows Terminal for Miscrosoft Store

  7. Install Menlo font (from Powerlevel10k site)

  8. 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
    

  9. Generate SSH keys
    ssh-keygen -t rsa  -b 4096 -f ~/.ssh/raddit-user -C raddit-user
    
  10. -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

  11. 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
    

  12. Copy ssh keys to an existing server ssh-copy-id root@192.168.0.10 - This will copy default public key id_rsa.pub to server 192.168.0.10 in .ssh/authorized_key file under root user.

Ubuntu

  1. Use bootable USB created using ventoy
  2. Press F12 at startup and select the bootable USB, select Ubuntu is image to begin installation
  3. Configure linux partitions as encrypted
  4. Add swap partion instead of efi as we will dual boot into same system. Part 2
  5. Change root password. sudo passwd root
  6. Move Windows above Ubuntu in boot menu. Use Grub Customizer Part 3
  7. Backup and restore data using rsync. Install programs using dotfiles.

  8. Adding SSH Keys to servers

  9. SSH Client Config
  10. 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/
  11. Create Sudo User
  12. 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)
Change your remote's URL from HTTPS to SSH with the git remote set-url command.
$ git remote set-url origin git@github.com:USERNAME/REPOSITORY.git
git remote set-url origin git@github.com:leslieclif/notebook.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

Tmux Basics Tmux Config

VSCode

Key Shortcuts Mastering Terminal

Examples

TLS Certificate - Manual

PI