WSL Setup
If you would like to work with a linux/unix style environment in Windows you can install WSL on your computer. While we won’t need it frequently in this class, it is a great tool for development and to build familiarity with Unix based environments.
These instructions will help you to get WSL setup on your computer. There are two methods you can use to install WSL in the instruction. Make sure to try the How to install Windows Subsystem for Linux using Settings method first as it is a bit easier. If the previous method doesn’t work, try the instructions using Powershell.
Once you have WSL installed and have rebooted your PC, you can install your Linux distribution from the Windows App Store. There are many distributions to choose from, but make sure to install Ubuntu 20.04 (18.04 should work fine as well).
Once Ubuntu is installed you can open it from your start menu like any other program. If you do not see it on your start menu, you can always hit the Windows key on your keyboard and start typing Ubuntu
to search for it.
The first time Ubuntu opens it will need to take some time to setup a few additional things. The first thing it will ask you to do is setup your UNIX username and password. The username will need to be lowercase and all one word. Make sure to remember your login information. When Ubuntu is finished setting up your account you will be greeted with a simple command line interface (CLI). This should be a line that starts with your username and ends with a $
and a blinking cursor. From here you can type in commands to your Linux operating system.
When describing commands in the following steps, I will prefix them with a $
character to indicate that this is a command line instruction. You do not need to type in the first $
character.
First, lets tell Ubuntu to go and get the latest list of programs and updates from the internet. You may need to use your password to make the following commands work. Also if at any time these command as you are sure you want to do something, you can type y
and hit the enter
key. Typing n
and hitting enter
will abort the command.
$ sudo apt update
The command sudo
tells ubuntu that you would like to run the following command with administrator privileges (that’s why you need to type your password). You don’t need to use sudo
for all commands, only for important stuff that affects the operating system like installing programs and updates. The apt
program is your package manager that helps you install applications, libraries, and other useful things. The update
option is a part of apt
and tells that program to go out and update its list of packages.
When that finishes we will tell apt
to apply any updates it found.
$ sudo apt upgrade
This could take a while.
Now that we have the latest software for Ubuntu lets install our compiler, make, and git.
$ sudo apt install build-essential git clang
When you use the install
option for apt
you can list the names of programs or packages you want to install. The build-essential
package is a metapackage. That is a fancy way for saying that build-essential
is an alias for all the tools that are essential for building programs and installs all of them with one simple phrase (saves a lot of typing). Notice that we also can install git
at the same time by putting a space between the packages and programs we would like to install.
Now that you have WSL installed for Windows and the Ubuntu operating system there is another command that may be helpful. With the WSL Ubuntu window open, type the following command:
$ explorer.exe .
The explorer.exe
command tells Windows to open a Windows File Explorer Window. The .
refers to the current directory in a UNIX path (if you don’t know the current directory you can use the command pwd
). This way you can see all your files and folders through a graphical interface instead of just using the command line interface.