from 26 July 2010 to 5 August 2010 (Europe/London)
Europe/London timezone
A virtual machine is a simulated computer with a chosen operating system. For the practical sessions we will provide a virtual machine with the needed software pre-installed. To run a virtual machine you first need a program capable of doing this for you. For the CTEQ/MCnet school we have chosen the program VirtualBox.

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 3.2.0 or later (preferably 3.2.6), or upgrade your existing installation.

If you need to remove an old virtual machine

- Delete the virtual machine:
  In VirtualBox, right click on the machine to remove, then "Delete"
- In VirtualBox, Under "File" -> "Virtual Media Manager":
  Delete also the hard drive belonging to the file, BUT choose to KEEP the file

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:

* Import the school's virtual machine
  - Make sure you have 3.5 GB of free disk space
  - Make sure the disk image of the virtual machine has been copied to your hard drive,
    apart from being distributed at the dvds it is now also available here within the school network
  - (If you want, you can check the md5sum against e0ec1c384f4d174f78ef6ae1a18bb760)
  - OS X and Linux: run the following command in a Terminal, from the directory of the MCnet.vmdk file:
  VBoxManage openmedium disk MCnet.vmdk -type immutable

  - Windows:  open the cmd shell, cd to C:\Program Files\Oracle\VirtualBox, then run:
    VBoxManage.exe openmedium disk C:\(your download location)\MCnet.vmdk -type immutable
  - Start the VirtualBox, and click on the "New" symbol
  - Select a name, for example MCnet
  - Choose the operating system Linux, Ubuntu (do not choose Ubuntu 64)
  - Proceed according to the instructions, keep the standard memory setting
  - Choose "Use existing hard drive", it should already show the "immutable" file you have registered earlier.
  - Click on "Continue" and "Done" (alternatively called "Next" and "Finish")
  - When finished, the school's virtual machine  should appear in the left panel of VirtualBox's main window

* Start the school's virtual machine and log in
  - Select the (MCnet) virtual machine from the left panel of VirtualBox's main menu
  - Click the start button (green arrow)
  - Wait for the machine to complete start up
  - At the login manager ("Welcome to itpmcnet"), first enter "mcnet" as user name, then enter the password "mcnet267"
  - When the virtual machine is starting, read the information about capturing of the mouse and the keyboard

* Check that you are able to save changes
  - Inside the virtual machine, create a dummy file or a dummy directory, for example:
    $ mkdir testdir
  - Shut the virtual machine down, do NOT just save state
  - Restart the virtual machine and check that it kept your changes, for example:
    $ ls

At this point your machine is ready for the tutorials. You can improve the integration of guest and host system by following the steps below, but this is not required.

Keyboard Mapping

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

Machine improvements: fullscreen, copy-paste, mouse integration

* Start the new virtual machine (VM) and log in

* Open a terminal window in the VM (eg. right-click on the background ->
  Applications -> Shells -> Bash)
  $ sudo apt-get update
  (here you have to reenter the password)
  $ sudo apt-get install linux-headers-2.6.28-19-generic build-essential
  (answer Y if asked to continue)

* In the VirtualBox window frame for your VM, select "Install Guest Additions" under the
  "Devices" menu. This will attach an image to the virtual CD-Rom drive.
  (To have the "Devices" menu visible, make sure the virtual machine window in VirtualBox is active.)

* In the VM's terminal window do
  $ mount /media/cdrom
  (Here you will have a warning message about read only, that's OK)
  $ sudo /media/cdrom/

* restart the guest machine now

* Some people seem to still have problems with screen sizes after the guest additions.
   You can start emacs with a fixed size using
   $ emacs -geometry 80x24

Access to the host filesystem

* create a new empty directory on the host, which will be shared with the guest system

* In the VirtualBox window frame 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
  - enter 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" and
  - click OK.

* In the VM's terminal window do
  $ sudo mount -t vboxsf -o uid=1004,gid=1004 hosthome /mnt
  Now you can access your files on your host machine inside the VM under
  the /mnt directory

* Every time you start the VM again, you need to re-run
  $ sudo mount -t vboxsf -o uid=1004,gid=1004 hosthome /mnt

Network bridging

To be able to ssh into your virtual machine,  you need to set up network bridging:
  - shut down the VM
  - in VirtualBox, select the VM image and click on the word "Network" in the status window on the right.
  - Click on the drop-down menu for "Attached to", and select "Bridged Adapter"
  - Under "Name", the currently connected network adapter should already be preselected.
  - click OK, then restart the VM
  - You should now have a routed IP address from our DHCP server. Check with
    ifconfig | grep 'inet addr'
  It should start with 172.16.