This repository contains various useful tips and tricks for the RL Laboratory, but also general useful stuff.
π½ Expand instructions
In order to run OpenStack (Fep) based laboratories, you need to create a new Virtual Machine and work on that.
- π Step 1: Log in to the OpenStack Dashboard
- π¦ Step 2: Create a new instance:
- Go to the Instances page
- Click the Launch Instance button
- Fill in the instance name
- On the
Source
page, selectRL 2018
- On the
Flavor
page, selectm1.small
- On the
Key Pair
page, select your assigned key pair - Hit
Launch Instance
- β Step 3: Wait
- Wait until the IP address of the instance appears in the list
To connect to the machine, follow the next steps:
- π¨βπ»
ssh
intofep.grid.cs.pub.ro
:
ssh [email protected]
# Enter your cs.curs password
- π¨βπ»
ssh
into your VM:
β¨ Now you're ready to start the laboratory. β¨
Before every laboratory, you have to run a certain prepare script
. Look into the laboratory description for the exact commands.
It's going to look something like this:
[email protected]:~# wget https://raw.github.com/RL-UPB/rl-lab-prepare/master/rl-lab-X-prepare
[email protected]:~# chmod +x rl-lab-X-prepare
[email protected]:~# ./rl-lab-X-prepare
β Remember, you have to run the above commands *as root on your VM.
For a more efficient workflow, use byobu
to split the terminal:
[email protected]:~$ sudo su // su as root for easier future commands
[email protected]:~# byobu // enter byobu
Now that you're in byobu
, run the following key combinations to split your terminal:
- Ctrl+F2 - Split terminal horizontally β
- Shift+F2 - Split terminal vertically β
- Ctrl+F3 and Ctrl+F4 (or Ctrl + arrow keys) - Switch between terminals
For a quick start, run the following key combinations:
Ctrl+F2
Shift+F2
Shift+F2
Shift+F2
This will split your screen like so:
---------------------------------
|
|
|
|------------------
|
|------------------
|
---------------------------------
Which you can set up to look like this:
---------------------------------
|
| π΄ red
|
π΄ root |------------------
| π’ green
|------------------
| π΅ blue
---------------------------------
If you are using Windows as your primary operating system, you can use the Windows Subsystem for Linux (or WSL) to run Linux applications. In this way, you do not need to dual-boot with Linux anymore.
In order to install WSL, you can follow the steps outlined here. The gist of it is this:
- π Right-click the Start Menu and select Windows PowerShell (Admin)
- If you do not have this option in the start menu, search for PowerShell, right click its icon and select
Run as Administrator
- If you do not have this option in the start menu, search for PowerShell, right click its icon and select
- π In the PowerShell window, paste the following command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- π Restart your computer. After this, you now have WSL installed, but you also need to install a Linux distribution.
- π§ Install a Linux distribution from the Microsoft Store. A good starting point is the Ubuntu distribution. Select Get on the page that opens.
- π Launch the
Ubuntu
shortcut and follow the steps to finish configuring WSL.
π‘ For a better experience you can also install the Windows Terminal Preview from here.
Currently you cannot install Docker directly into WSL, so we need to install it into Windows, and then control it from Ubuntu. The gist of it looks something like this:
βΉ Windows π§ WSL
------------------ -------------------
π³ Docker Service β----βΆ π Docker Client
Docker for Windows depends on a system called HyperV. This is a Virtual Machine system similar to VirtualBox or VMWare. Due to this reason, they cannot be installed and running at the same time.
If you have VirtualBox or VMWare installed, remove them before continuing. You can learn how to migrate VirtualBox VMs to HyperV here.
-
πͺ Allow the Docker service to be accessed from
localhost
Access the Docker for Windows control panel. Open its settings and look for an option called:
Expose daemon on tcp://localhost:2375 without TLS
This will allow our WSL client to connect to the Docker service.
-
π Install the Docker client in WSL
Run the following commands to install the required packages:
wget https://raw.githubusercontent.com/systems-cs-pub-ro/rl-lab-guide/master/scripts/wslDockerInstall.sh chmod +x wslDockerInstall.sh ./wslDockerInstall.sh
π If you are using Windows 10 Home Edition π
Windows 10 Home Edition does not support HyperV. It instead uses a VirtualBox machine to set up the Docker service. Due to this reason, you will not use WSL, but instead run your code directly on the provided VirtualBox VM.
The downside of this is that you are very limited in what you can do with the VM. For example, sharing files between the VM and your machine is very cumbersome.
If you have this version of Windows, you have to run these steps instead:
-
π© Download and install Docker Toolbox
-
πͺ Allow the Docker service to be accessed from
localhost
Open the
Docker Quickstart Terminal
and run the following command:docker-machine ssh
-
β Done. You can now run docker commands here.
If you're running Linux, run the following commands:
wget https://raw.githubusercontent.com/systems-cs-pub-ro/rl-lab-guide/master/scripts/linuxDockerInstall.sh
chmod +x linuxDockerInstall.sh
./linuxDockerInstall.sh
This list is a work in progress collection of various useful tips and tricks that will help you make the most of the Windows Subsystem for Linux and Windows Terminal.
-
π Accessing WSL files from Windows
Usually the files in your WSL instance are completely separated from the ones in your Windows machine. In order to access your files, you can open an
explorer.exe
window from anywhere within WSL:cd ~ explorer.exe .
-
β Splitting the terminal in Windows Terminal
Starting with version
0.7
of the Windows Terminal, you can split the terminal window just like inbyobu
. The shortcuts for this are:- β Horizontal split - Alt + Shift + +
- β Vertical split - Alt + Shift + -