Prelab 1: Preliminaries for the first lab

In this lab, you're going to set up the environment you will use for the rest of 132. Before you come to lab, it's important you start on a few things:

  1. Download and install Git, along with the SSH tool Git Bash.
  2. Install WSL2

You should have at least 15 GB of available disk space for this lab (to hold the Linux Subsystem.)

Throughout this entire lab (and this course), this web site assumes you are using the RHIT-supplied image of Windows, though it is possible to do most steps on other systems.

Get Git

Git is the most popular version-control software, a "free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency."

You likely already have Git installed. To check, click the windows button and type "git". If you see "Git Bash" show up, you have Git installed, so you can skip to the next step. Otherwise:

  1. Download Git for your computer from the Git SCM website. (You will probably want to click on "Windows" to get the one for your laptop.)
  2. Run the installer and follow the instructions. Choose the default settings.

Test an SSH Client

In this lab you will be connecting to other computers using a protocol called SSH. To do this, you need an SSH client. One such client is OpenSSH which is provided through the Git Bash shell on Windows (also native on Linux and Mac).

Open your SSH client, and connect to the following server with the given username and password.

 server:     bandit.labs.overthewire.org
 port:       2220
 login name: bandit0
 password:   bandit0

This can be done with the following command in Git Bash:

 ssh bandit0@bandit.labs.overthewire.org -p 2220

You should see something like the following.

Enter the password (note: it will not display as you type it). You've connected to the server if you see a prompt like

 bandit0@bandit:~$

You can log out of a server by hitting CTRL-D, or by entering the command logout.

Install Windows Subsystem Linux 2 (WSL2)

Installation

Follow this instruction to finish install WSL2:

WSL2 Office Website Change this: * Check Window version * Powershell in Admin * Run wsl --install -d Ubuntu

You will need to restart your machine during this installation process.

Set up your Linux username and password

Once the process of installing your Linux distribution with WSL is complete, open the distribution (Ubuntu by default) using the Start menu. You will be asked to create a User Nameand Password for your Linux distribution.

Verify your installation

After completing the installation by following the instructions, you should have Ubuntu (Linux distro) installed on WSL2. To verify, you can run the following command in Windows PowerShell:

wsl -l -v

Note that the -l is dash lower-case L, NOT dash one.

The output should be something like

NAME            STATE       VERSION
*Ubuntu    Stopped     2

The STATE may be different. But the NAME and VERSION should match exactly.

Sometimes the Ubuntu is shown as Ubuntu-20.04. They are the same thing.

Set up Windows Terminal

Install Windows Terminal HERE.

After finish installation, bookmark/pin this app on the taskbar (because you will need to use this app a lot).

File storage

To open your folder/files under your Linux OS. Open the Windows File Explorer and use the path below

\\wsl$

From there, you can find Ubuntu. Your home folder will be /home/<user>

You will need to use this path in the future. So it is highly recommended bookmarking this folder.

Verification

If you successfully all steps above, you should be able to 1) open Windows Terminal and 2) launch Linux in WSL2 as shown below.

Launch Windows Termimal and find Linux option

Open your Windows Terminal. Ideally, you want to pin this app to the taskbar as we will frequently use it in this class. For example, my taskbar looks like this

drawing

When open Windows Terminal, by default, it will open the PowerShell, which is not the thing we need. Instead, you want to find the "v" icon (drop down menu) to open Ubuntu in a new tab, as shown below.

drawing

Launch Linux (in WSL2)

Once selecting the "Ubuntu-20.04" (or "Ubuntu"), you can launch the Ubuntu Linux virtual machine and go to the command line environment, i.e., shell. The command line prompt will be like this:

drawing

Your username will be different. And the hostname is the device name generated by WSL2, which can vary based on your machine. The part after the $ sign is the input space where you can type in command lines.

You're Ready

If you are able to successfully launch Linux in WSL2, you are all set for the prelab. When you come to lab, you'll be ready to get to work!