Preparation

Prior to installing the VM you need to do the following:

On Windows XP

  1. Install VMPlayer - http://www.vmware.com/products/player/
If you are using your own computer you will also need:
  1. Install Xming http://sourceforge.net/projects/xming/ (more info on Xming here)
    • Installation guide with pictures is here
  2. Download PuTTY from here

On Windows Vista

  1. Install VMPlayer - http://www.vmware.com/products/player/
If you are using your own computer you will also need:
  1. Install Xming http://sourceforge.net/projects/xming/ (more info on Xming here)
    • Installation guide with pictures is here
  2. Download PuTTY from here

Known problems

  1. If you have two network adaptors (e.g. ethernet and wireless) you may find that the VM binds to one while Vista is using the other for traffic. This will result in the VM seeing the outside network but the host OS (Vista) not being able to connect e.g. via putty.
  2. The combination of XMing and Vista seems to be problematic. You may find that you cannot send back the xterm or other X11 windows. If this is the case don't use X11 and just copy files to/from your VM using WinSCP or similar. If you do get it to work please let me know how (I don't have a Vista machine available to debug), but don't spend a lot of time on it - it's not essential.

On OSX (Mac)

  1. You need VMFusion, speak to Simon to get a free copy

On Linux

  1. Install VMPlayer - http://www.vmware.com/products/player/

Known problems

The network adaptors can be confused. This results in your VM not being able to access the network. The symptom of this is that the VM's IP address isn't listed when running myip and eth0 network adaptor isn't listed in when running ifconfig.

First of all make sure that the VMWare networking is set to Host-only. Then try to restart the networking:

service networking restart

If that doesn't bring the network back (still nothing from ifconfig for eth0) run ifconfig -a. This may show you a second network interface (eth1). If it's doing that the VM has bound the networking twice - very wrong. You can remedy this by doing:

sudo mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules_bak
sudo reboot

More info: http://muffinresearch.co.uk/archives/2008/07/13/vmware-siocsifaddr-no-such-device-eth0-after-cloning/

CompPhys VM

Installing the VM

  1. Download the VM image
  2. Unzip it (more here...)
  3. Open in VMPlayer/WMFusion
    • When opening the VM in VMPlayer/WMFusion you will be asked if you have "moved" or "copied" the VM - choose "moved"
    • You will probably see a warning about a missing file the first time you start the VM, don't worry about this.

Restarting the VM

If you keep the VM on the network drive (U:) or use it on different machines when you reload the VM it's likely to get confused. You should restart it as follows:

sudo reboot

This will let the VM reconfigure itself for the machine you have moved it to.

Symptoms of this are:

  • 'Read only' file system
  • No network (running ifconfig does nothing)

VM Contents

Your VM should be loaded with:
  1. Ubuntu OS
  2. Python v2.6
    • numpy
    • matplotlib
  3. gcc v4.3.3
  4. gnuplot
  5. SVN client and helper scripts

Getting scripts

We'll be providing a set of scripts (small programs) that should make certain things a bit easier for you. They are currently a work in progress, and available from https://webpp.phy.bris.ac.uk/~phxsm/scripts.tar.gz. If you have an idea for a useful script please let us know and we'll try to add it in. We will announce via blackboard when the scripts change. Here's how you get them:

  1. Log into the VM
  2. In the VM type
    wget --no-check-certificate https://webpp.phy.bris.ac.uk/~phxsm/scripts.tar.gz
    , this will download a compressed file with the scripts in
  3. Type tar -zxvf scripts.tar.gz to uncompress the file
  4. Type ls you should see something like:
    student@computationalphysics:~$ ls
    scripts  scripts.tar.gz
    
  5. Delete the compressed file by typing rm  scripts.tar.gz
  6. Log out (press Control + D) and log back in again

This process will become a script for you ~soon...

Using your own computer

Moving the VM around

If you are moving the VM from home or your laptop onto the lab machines you will need to turn the VM off before moving it between machines. To do this run the following command:

sudo shutdown -h now

This will turn the VM off safely and close the VMWare app.

VMWare tools

If you are using a mac, talk to Simon and ignore the following.

Ideally you should install the same version of VMWare player on your own computer as is available on the lab machines. If that's not possible for some reason you'll need to install the VMWare tools software into the VM (it seems to be very version dependant). This is actually quite straight forward but looks very complicated. Find a demonstrator to help you with it if you are unsure.

Click "Install VMWare tools" in the players menu. This will make the tools available in the VM. Then do the following:

sudo su -
mount /dev/cdrom /mnt/cdrom
ls /mnt/cdrom
This will mount the VMWare tools installer into the VM and show you what it contains. There'll be a file starting with VMWare and ending with .tar.gz that you need to extract (the name will vary depending on the version you are installing, for my version it's VMwareTools-8.4.3-282344.tar.gz). Copy this name into the command below:
tar -zxvf /mnt/cdromVMwareTools-8.4.3-282344.tar.gz -C .
cd vmware-tools-distrib
./vmware-install.pl

You will be asked a lot of questions (this is where it looks really complicated) but the default answers should all be correct, so just press enter a lot.Once this is complete you should be able to mount folders from your laptop into the VM.

If something goes wrong it might be simplest to extract the VM file and start over, so keep the zip file around if possible. If this all sounds a bit much find a demonstrator to help you.

Putting files onto your VM

From your computer

Your U: drive is mounted into the VM. You have access to all your files in U: via /mnt/hgfs/your_shared_area. You should probably make a directory under U: for the course (for example compphys) and then make a link through to the VM's home area using the following commands:

cd   #check you're in the home directory
ln -s /mnt/hgfs/your_shared_area/compphys .

Any files you put into your U: drive will be accessible from the VM, so write your code in Windows (using Notepad), save into U:/compphys and then run/compile in the VM.

From the web

Linux has a tool to fetch URL's from the web called wget, you can use it like so:
wget http://www.google.com

Plotting

We provide a basic plotting script called cp_plot. It generates 2d plots and takes a list of data files as it's input to create the plot. Use it as follows:

cp_plot --title 'my cool plot' datafile.txt

This will make a file called my_cool_plot.png in your working directory.

If you have multiple data series call the script as follows:

cp_plot --title 'my cool plot' datafile1.txt datafile2.txt datafile3.txt

The contents of your data files should look like:

x (t), y (m/s) 
1, 10
2, 15
3, 30
4, 17
5, 12

Note that the first line are the labels for the x and y axes. Each column is separated by a comma.

If you decide you want to create more complicated plots you are on your own. The matplotlib gallery may be useful...

Using it from a script

You can reuse the code directly from a script as follows:

from cp_plot import Plotter

plotter = Plotter()
plotter.plot(x=[1,2,3,4,5], y=[10, 15, 30, 17, 12], x_label='x (t)', y_label='y (m/s)', plot_title='my cool plot')

This will make a file called my_cool_plot.png in your working directory.

Simple Linux commands

Linux commands generally behave as follows; they have a name (for instance wget) followed by options (for instance --no-check-certificate) followed by the thing the command runs on (e.g. the URL above).

Moving around the file system

Some basic commands follow:

ls
list contents of the current directory
cd
change directory to
<dirname>
, if no
<dirname>
it'll take you back to your home directory
mkdir
create the directory
<dirname>
rm thing
delete thing - be careful there's no Recycling Bin, you run rm and the file is gone!

Moving around on the prompt

ctrl + a
go to the beginning of the line
ctrl + e
go to the end of the line
ctrl + w
delete a word

Tab completion

  • type the first letter of the file you want/program to run
  • press tab - this will list all the things that begin with that letter, or add more letters until there's a choice (e.g. c -> ca if there'd car and cat)
  • repeat until the filename you want is there

FAQ

I have no network access, what do I do?
You need to delete the VM and start again from the zip file, make sure you click "move" when asked if you have copied or moved the VM. Make sure you have a copy of your work before deleting the VM. If this doesn't help ask a demonstrator.
Edit | Attach | Watch | Print version | History: r31 < r30 < r29 < r28 < r27 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r29 - 2010-11-25 - SimonMetson
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback