Table of Contents
Windows Subsystem for Linux
These instructions will allow you to set up the Windows Subsystem for Linux, which will allow you to run Linux bash commands on the Windows 10 operating system without the need of a virtual machine. Ubuntu will be used for example purposes.
Note: The Documents folder in Windows is located in “/mnt/c/Users/{Username}/Documents” in the Linux environment.
Setting up the Ubuntu terminal
- In the start menu, type “Powershell”
- Right click, and click Run as Administrator. Click Yes
- Run the following command:
- Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- You will need to restart your computer. Powershell will provide this option. Type y and hit enter to restart.
- Go the Microsoft Store and search “Linux”.
- Click “Get the Apps”
- Install Ubuntu and launch it.
- It will take a few minutes to install.
- Create a username and password.
- Note: you will not be able to see the password characters you type, so type carefully.
- Important: Make sure you remember this password!
- Type: sudo apt-get update
Setting up Graphics Support (X Server)
VcXsrv setup
- Search for “VcXsrv” in your browser or click here.
- Download from Source Forge
- Run the installer.
- Open VcXsrv and select the following settings.
- In Display settings, leave “Multiple Windows” checked. Click Next.
- In Client settings, leave on “Start no client” and click Next.
- In Extra settings, keep “Clipboard” checked, but uncheck the others, including opengl. Click next.
- Save the configuration to somewhere that you can easily find it, like the Desktop.
- Click Finish.
- If it asks you to allow access through the firewall, things should still work if you click “Cancel”.
- Note: If you restart your computer, double-click the config file to run the X server for your terminal.
Ubuntu setup
- In ubuntu, type the following commands:
- sudo apt-get update
- sudo apt-get install xauth xorg x11-apps
- Note: This may take several minutes.
- Add the following to your ~/.bashrc:
- export DISPLAY=localhost:0.0
Installing Other Packages
Software Packages in Ubuntu can be installed with “sudo apt-get install <command>”
Example commands:
- sudo apt-get install python3-numpy
- sudo apt-get install python3-matplotlib
- sudo apt-get install python3-scipy
- sudo apt-get install gedit
Mounting a USB Drive in the Linux Environment
The path to the USB drive is located in “/mnt/{drive_letter}”. In this example, it is assumed that the USB is located in E: in the Windows system. Replace instances of E: or e with your drive letter.
First time setup:
- sudo mkdir /mnt/e
To mount usb drive:
- sudo mount -t drvfs E: /mnt/e
To unmount usb drive:
- Make sure that you are not in the USB drive's directory.
- sudo umount /mnt/e
Suggested alias to add to ~/.bashrc to streamline the mounting and unmounting process.
- alias usb='sudo mount -t drvfs E: /mnt/e; cd /mnt/e'
- alias unusb='cd; sudo umount /mnt/e'