# WSL Installfest for PC Windows Developers This is an resource guide for setting a windows PC with **WSL** -- *Windows Subsystem for Linux*. **WSL** is a 'kernel wrapper' that allows you to directly interact with the windows operating system using a linux terminal. This will create a development enviroment that allows windows to use all the powerful linux tools without having to hassel with a virutal machine or dual boot setup. Similar to how you used the Git Bash terminal for your pre-work, **WSL** will give a you bash terminal -- but with the full power of a complete linux distribution for development. Please note -- this setup is essentially equivalent to using a linux computer for the bootcamp, so while many of your terminal commands will be the same as a mac, there will be some that are different. *This will require extra debugging and research on your part as the curriculum is designed for mac computers.* The end result of setting up **WSL** will be a full-fledged bash terminal you can run while still using windows. # Before Class on Monday 5/03 You should have already installed and [WSL with Ubuntu Linux](https://docs.microsoft.com/en-us/learn/modules/get-started-with-windows-subsystem-for-linux/) before class on Monday to use this setup. This process requires restarting your computer at least once and downloading a large linux OS distribution. Complete these steps: * First read the [introduction](https://docs.microsoft.com/en-us/learn/modules/get-started-with-windows-subsystem-for-linux/1-introduction) * [Enable WSL](https://docs.microsoft.com/en-us/learn/modules/get-started-with-windows-subsystem-for-linux/2-enable-and-install) and install a linux distribution (Ubuntu is recommended) * **_IMPORTANT:_** *be sure to remember the user name and password you use when installing linux, you will be using them alot! Choose something easy to type and remember. Its also okay to choose the same username and password as you use to login to windows.* * Do the [Try a few basic Linux commands](https://docs.microsoft.com/en-us/learn/modules/get-started-with-windows-subsystem-for-linux/3-integration-between-linux-and-windows) part of this page to get comfortable with the WSL shell. You might want to pin the WSL icon someplace convenient since it will be your main terminal. * [Here](https://defragged.org/2020/10/29/how-to-copy-paste-in-windows-subsystem-for-linux-wsl/) is a handy guide to enable copy/paste in the WSL terminal. Alternatively, you can right click to paste commands copied from other windows. * If you want to work ahead on installing vscode or looking ahead at the Unit 1 part of this document, feel free. if you have **WSL** Ubuntu installed with a bash terminal on your machine, you are good to go for class on monday 👍 # Unit 1: ## VS Code: Install from the software center program - or install manually from this link: https://code.visualstudio.com/download Follow the steps [here](https://docs.microsoft.com/en-us/learn/modules/get-started-with-windows-subsystem-for-linux/5-vscode-integration) to configure vscode for WSL. ## Zsh: A shell is a text interface into our computer, and we will be using a lot to run commands. By default WSL uses the bash shell, which is a perfectly capable shell, but as a class we are going to be using zshell along with oh-my-zsh theming for our terminals. Guide to in here: https://www.tecmint.com/install-zsh-in-ubuntu/ run the following commands in terminal: `sudo apt-get install zsh` **NOTE:** *you may need to close and reopen the WSL terminal after installing zsh. Select option 2 when you restart your terminal* `chsh -s $(which zsh)` Oh My Zsh: Guide here: https://ohmyz.sh/#install **Adding a Useful Color Theme with oh-my-zsh** Now we will use oh-my-zsh to add a useful color theme to our prompt. Use the command `code ~/.zshrc` to open your zsh config file in vscode. It lives in your root folder `~/` and is hidden, hence the `.` before the file name. Add the following line in the theme section (near the top) to set the oh-my-zsh theme to a handy one called 'af-magic'. af-magic will conveniently display your git information and working directory in your shell which is very helpful. It also display virtualenv information which will be helpful when we get into python in unit 4. ```bash ZSH_THEME="af-magic" ``` You can of course experiment with different themes or even make your own! There are instructions in the .zshrc file to have a different theme shown in your console everytime your start it up to explore the different flavors. ## Configuring Git First off, you will need to add the git-core repository to track the most recent git version, and then you will need to download the updates and upgrade. Run these three commands one by one in your WSL terminal: ```bash # repo with the most recent git sudo add-apt-repository ppa:git-core/ppa # update and upgrade sudo apt-get update sudo apt-get upgrade ``` **Configuring GIT Locally** Before we do this process, please make sure you have signed up for an account on [Github](http://www.github.com) and get ready with your user name and account email. Using your github username and email, run these commands one by one replacing "YOUR-USERNAME" and "YOUR-EMAIL-ADDRESS" with your personal credentials. ```bash git config --global init.defaultBranch main git config --global user.name "YOUR-USERNAME" git config --global user.email "YOUR-EMAIL-ADDRESS" git config --global push.default simple git config --global credential.helper cache ``` **Setting up SSH Key to connect to github** In this next part we will generate a SSH key on our local machine, and then link it to our github account. This is to prevent github from demanding login credentials everytime you want to push to github from your local machine. There are a few steps to the process, and we are going to follow github's guide found here: [Github Generating SSH Keys](https://help.github.com/articles/generating-ssh-keys/) ### Potential bugs with github ssh key: If the command `ssh-add ~/.ssh/id_ed25519` doesn't work use `ssh-add /home/<user name>/.ssh/id_rsa` instead. if you don't have the clip command: ```bash zsh: command not found: clip ``` or you get any other error from running `clip < ~/.ssh/id_ed25519.pub`, use the following command to open the public key up in vscode and manually copy it to github: ``` code /home/<user name>/.ssh/id_rsa.pub ``` # Unit 2: Node: run the following command in terminal: sudo apt-get install nodejs Postgresql: Guide here: https://www.postgresql.org/download/linux/ubuntu/ # Unit 3: MongoDB: Guide here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ # Unit 4: TODO: Figure out python ###### tags: `drafts` `lessons`