2–5 Apr 2012
DESY Hamburg
Europe/Berlin timezone

Laptops and Virtual Machines

The final part of the school will be tutorials with computer exercises. Participants are expected to bring their own laptops with an X environment. Please mark during registration if you urgently need a computer provided by DESY instead.

The software needed for the tutorials will be provided in the form of a Virtual Machine. To run a virtual machine you first need a  program capable of doing this for you. For the school we have chosen the program VirtualBox.

It is mandatory to prepare your laptop in advance of the school.

Installing VirtualBox

* VirtualBox is available for various platforms here, including the most commonly used versions of Linux, Mac OS X and Windows. A detailed list of supported host operating systems can be found here.

* Download the appropriate package for your architecture and operating system. If you are running Windows or Mac OS X, install it as any other "point and click" software. Details on the installation for Linux are available here.

* Please install VirtualBox version 4.1.8 or later, or upgrade your existing installation.

Running the virtual machine in VirtualBox 
Once you have the program VirtualBox running you can run the school's virtual machine inside of VirtualBox. To do this, follow the instructions below (name of buttons etc. as for VirtualBox 4.1.8 on ubuntu 11.10 - small differences could arise for other systems/versions):

* Import the school's virtual machine
  - Make sure you have about 3 GB of free disk space
  - Download the StatsSchool2012_v2.ova file from ftp://ftp.desy.de/pub/school/
    (via browser or wget ftp://ftp.desy.de/pub/school/StatsSchool2012_v2.ova etc.)
  - You may verify the file's integrity by comparing its MD5 sum to the one stored in StatsSchool2012_v2.md5 on the same directory .
  - Start VirtualBox.
  - Click on `File', then on `Import Appliance'.
  - Click on the `Choose' button and select the .ova file you just downloaded.
  - Click on `Next'.
  - Activate the 'Reinitialize the MAC address of all network cards' field.
    (Note: If the network connection of the virtual machine does not work, see below for 'Trouble shooting'.)
  - Click on `Import'.
  - Select the (StatsSchool2012_v2) virtual machine from the left panel of VirtualBox's main menu

* Start the school's virtual machine and log in
  - If you get a window with information about capturing of the mouse and the keyboard when starting the virtual machine,
    please read it.
  - Wait for the machine to complete start up
  - At the login manager ("Welcome to school2012"), state 'school' as login.
    (For unknown reasons, on some systems you will have to do that twice.
  - Enter the password "School12".

Access to the host filesystem
It is often very convenient to share disk access between the host (i.e. your laptop) and the guest system (the virtual machine
of the school) to easily exchange files.

* Create a new empty directory on the host, which will be shared with the guest system.
 
* In the menu bar of the VirtualBox window for your VM, select "Shared Folders" under the "Devices" menu
    (to have the Devices menu visible, make sure the virtual machine window in VirtualBox is active).
  - Click the add-button (might appear as small icon of a folder with a green cross).
  - Select the path of the empty directory you have created on the host machine in the "Folder Path".
  - Type "hosthome" in the "Folder Name", do not leave the default!
  - Select "Make Permanent".
  - Click OK.

* In a terminal of the VM window do
  sudo mount -t vboxsf -o uid=1001,gid=1001 hosthome /mnt
  Now you can access your files on your host machine inside the VM under the /mnt directory.
  (Side remark: 1001 is the id of the user 'school'.)
 
* Every time you start the VM again, you need to re-run the above mount command.

* For Mac (as host) users: The mounting might not work, but give 'Protocol Error'. Workaround is to select
  "Auto-mount" in addition to "Make Permanent" - but then you can read/write there only as root user in the VM.

Keyboard Mapping
* Use the command "setxkbmap de" in the VM terminal to change from the standard American keyboard layout
  to a German one if needed (us gives American, es Spanish, pl Polish, se Swedish etc. )

Shutdown
Since we use a very light weight login manager that does not support to shutdown the virtual machine, the safest way to do so is probably to run sudo halt on the command line. Afterwards click on "Close" under the "Machine" menu of the VirtualBox window frame and select "Power off the machine".

Simple Tests and Further Preparations

* ROOT
  - open a terminal and try to start root
  - in case that fails, consider to add
  - check whether you can open a TBrowser (e.g. typing new TBrowser)
  - note that we use ROOT 5.32.02 that comes with new default style settings (compared to 5.28)
  - you might want to create your favourite .rootrc or .rootlogon.C
    (but please note that this might change the result of tutorials...)

* Editing
  - at least emacs, pico, vi and nedit are installed - if your favourite is missing, see below
  - configure your favourite editor such that it behaves similar to what you are used to.

* Browsing
  - firefox is installed - start page is the school's indico page. Add your favourite bookmarks if you like.

* Viewing postscript, pdf etc.
   - at least gv and evince are installed - if your favourite is missing, see below.

* If you miss a useful program you can install it via
  sudo apt-get install <package>
  If you do not know the package of your program, just type the program name and enter on the command line - you
  might get a hint...

Trouble Shooting
* If the network configuration does not work, try
  sudo rm /etc/udev/rules.d/70-persistent-net.rules
  and reboot via
  sudo reboot.
* If the root program does not start, execute
  source $HOME/ROOT_5_32_02/root/bin/thisroot.sh.
  You may consider to add that line to your $HOME/.bashrc file to have root avilable by default.

* Possible improvement of guest system additions (e.g. better copy/paste between guest and host)
  The VM has the guest additions for VirtualBox 4.1.2 installed - but you are running probably VirtualBox 4.1.10, so you should
  install those. You could try this procedure (but make a snapshot of your VM before!):
  - remove the installed guest utils and reboot:
    sudo apt-get remove virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11 virtualbox-ose-guest-utils
    sudo reboot

  - In the menu bar of the VirtualBox window for your VM, select "Install Guest Additions" under the "Devices" menu
    and follow the instruction. If there are complaints about a previously installed version, proceed anyway.
  - Alternatively you can also
    - download the cdrom image for the guest additions (google for VBoxGuestAdditions_4.1.10.iso
     
or what fits to your virtual box),
    - do the above 'sudo apt-get remove',
    - put your guest image into the virtualmachines cdrom drive (via Devices => CD/DVD Devices => IDE Controller (Primary 
      Master) => Choose a virtual CDE/DVD Disk file...),
    - mount it via
      sudo mount /dev/cdrom1 /media/cdrom
    - do
      cd /media/cdrom; sudo sh ./VBoxLinuxAdditions.run
    - If there are complaints about a previously installed version, proceed anyway.