systems-cs-pub-ro / rl-lab-guide

πŸ’‘ Useful tips and tricks for RL Lab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🌐 RL Laboratory Tips and Tricks

This repository contains various useful tips and tricks for the RL Laboratory, but also general useful stuff.

πŸ§ͺ Connecting to OpenStack VMs

πŸ”½ Expand instructions

✨ Creating a new VM

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, select RL 2018
    • On the Flavor page, select m1.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

🚚 Connecting to the machine

To connect to the machine, follow the next steps:

  • πŸ‘¨β€πŸ’» ssh into fep.grid.cs.pub.ro:
ssh cscurs.user@fep.grid.cs.pub.ro
# Enter your cs.curs password
  • πŸ‘¨β€πŸ’» ssh into your VM:
ssh student@YOUR.VM.IP.ADDRESS

✨ Now you're ready to start the laboratory. ✨

πŸ”§ Lab setup script

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:

root@YOUR.VM.IP.ADDRESS:~# wget https://raw.github.com/RL-UPB/rl-lab-prepare/master/rl-lab-X-prepare
root@YOUR.VM.IP.ADDRESS:~# chmod +x rl-lab-X-prepare
root@YOUR.VM.IP.ADDRESS:~# ./rl-lab-X-prepare

⚠ Remember, you have to run the above commands *as root on your VM.

βœ‚ Splitting the screen

For a more efficient workflow, use byobu to split the terminal:

student@YOUR.VM.IP.ADDRESS:~$ sudo su // su as root for easier future commands
root@YOUR.VM.IP.ADDRESS:~# 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
---------------------------------

🐧🐳 WSL Setup for Dockers

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.

🚚 Installing WSL

In order to install WSL, you can follow the steps outlined here. The gist of it is this:

  1. 🌟 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
  2. πŸ“‹ In the PowerShell window, paste the following command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  1. πŸ” Restart your computer. After this, you now have WSL installed, but you also need to install a Linux distribution.
  2. 🐧 Install a Linux distribution from the Microsoft Store. A good starting point is the Ubuntu distribution. Select Get on the page that opens.
  3. πŸš€ 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.

🐳 Installing Docker

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
🐳 Installing the Windows Docker Service

⚠ A note regarding VirtualBox / VMWare ⚠

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.

  1. πŸ“© Download and run the installer from here.

  2. πŸšͺ 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.

  3. πŸ‹ 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:

  1. πŸ“© Download and install Docker Toolbox

  2. πŸšͺ Allow the Docker service to be accessed from localhost

    Open the Docker Quickstart Terminal and run the following command:

    docker-machine ssh
    
  3. βœ… Done. You can now run docker commands here.

🐧 Linux

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

πŸ’‘ WSL and Windows Terminal Tips

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 in byobu. The shortcuts for this are:

    • ↔ Horizontal split - Alt + Shift + +
    • ↕ Vertical split - Alt + Shift + -

About

πŸ’‘ Useful tips and tricks for RL Lab


Languages

Language:Shell 100.0%