You are on page 1of 2

Exercises: Introduction to Virtual Machines (Part 1)              A1 

VirtualBox Setup and Creation of simple VM                 

1. Install VirtualBox (in the English Version): https://www.virtualbox.org/wiki/Downloads . 

2. Damn Small Linux (DSL) is an extremely small (53MB) Linux distribution that is great as starter for 
VMs. Download bootable image dsl‐4.4.10.iso. Create ISOs directory in VirtualBox’ VM directory (on 
Windows under C:\Users\{USER}\VirtualBox VMs\ISOs): VMs\ISOs  

 http://distro.ibiblio.org/damnsmall/current/dsl-4.4.10.iso. 
 Result:  C:\Users\{USER}\VirtualBox VMs\ISOs\dsl‐4.4.10.iso. 
 Check the size of the dsl‐4.4.10.iso: 52,328,448 bytes, 53MB. 

3. Create a new VM in VirtualBox with name „DSL_VM“. 
 Use configuration: Linux, 32bit, 512MB RAM, Virtual Disk as filesystem disk (VDI – VirtualBox 
Disk Image), with 4GB capacity and dynamic allocation. 
 Make sure that the virtual disk (VDI) is attached with IDE‐Controller and not with SATA 
Controller. Verify under VM Settings – Storage. 
List created VM files in the host system, in Windows under: C:\Users\{USER}\VirtualBox VMs\DSL_VM 

4. Attach the bootbare DSL .iso image as CD/DVD‐drive to DSL_VM. Select DSL_VM in VirtualBox und 
right‐click: Settings ‐> Storage ‐> click: CD/DVD(Empty) ‐> click CD/DVD Symbol and select: dsl‐4.4.10.iso. 
Result: DSL‐4.4.10.iso appears next to the CD/DVD symbol as attached medium. 

5. Press the Start button of DSL_VM in VirtualBox. 
boot: <Enter>. 
DSL boots as guest‐VM. Login is with user “dsl” with no/empty password. The DSL desktop appears. 
Right‐clicking the desktop opens a popup with entries XShells and XShells/Root Access. Clicking those 
opens terminals running as regular user “dsl” (XShells) in home directory /home/dsl or as super user 
“root” (XShells/Root Access) with red cursor in root’s home directory /root . 
6. Starting a VM “catches” the cursor, which means that the cursor can only be moved within the VM’s 
head window. Pressing the “host key” (the right Ctrl key) releases the cursor back to the host system. 
In case, your system has no right Ctrl key, the host key can be configured in VirtualBox under File ‐> 
Preferences ‐> Input ‐> Virtual Machine ‐> Host Key. 
7. DSL has the US keyboard layout preset (no Umlauts, ‘z‘ and ‘y‘ switched etc.). The loadkeys command 
can be used to switch the keyboard. Run these commands as regular user “dsl” – not in a root shell: 
  sudo loadkeys de     ; switch to the German keyboard layout 
  startx        ; Restart X Window desktop to activate setting 

8. Open two terminals, one with XShells‐ and one with XShells/Root Access. Show the owning user and 
the home directory: 
  whoami      ; user dsl in one and root in the other terminal 
  cd        ; change to home directory 
  pwd        ; print working directory, path to the home directory 
  ls -la      ; list the home directory 
9. Create a new directory java as user “dsl” in its home directory. 
  mkdir java 

10. Create a new file Hello.java in ~/java using an editor (vi or nano) with 
public class Hello {
public static void main( String[] args ) {
System.out.println( "Hello, World." );
}
}
11. Try to compile Hello.java with the Java compiler and execute the class file. 
  javac Hello.java   ; should compile .java  to Hello.class 
  java Hello      ; attempt to run Hello.class with JVM 
  ‐‐> command not found. 
12. Why can Hello.java not be compiled or executed? 

13. Shutting down the system. Like any other computer, the operating system in a VM needs to be shut 
down properly. A VM should not be powered‐off in VirtualBox before the operating system has halted. 
To shut down a Linux/Unix system, a shutdown command needs to be executed under root. There are 
two ways to execute commands with root (super user) rights: 
 Use a root shell such as in a terminal opened with XShells/Root Access. 
 Using a regular user shell, the command sudo will elevate execution privileges to root. Not every 
user has this privilege. A user must be included in the sudoer’s list in /etc/sudoers . 
List the users with sudo’er rights (user “dsl” is included) and shut down DSL. 
sudo cat /etc/sudoers    ; list users with sudo privileges 
sudo shutdown -h now    ; Herunterfahren des DSL Linux Systems 

14. Power off DSL_VM by selecting DSL_VM in VirtualBox: ‐> right click DSL_VM ‐> Power Off. 
15. Restart DSL_VM. 
16. Why doesn’t DSL_VM boot? 
17. Attach dsl‐4.4.10.iso as DVD‐drive to DSL_VM (like in step 4). 
18. Restart DSL_VM (VM will now boot). 

19. Change to ~/java and list Hello.java. 
  cd java
cat Hello.java

20. Why has ~/java disappeared? 
   

You might also like