Preparation
Prior to installing the VM you need to do the following:
On Windows XP
- Install VMPlayer - http://www.vmware.com/products/player/
If you are using your own computer you will also need:
- Install Xming http://sourceforge.net/projects/xming/ (more info on Xming here)
- Installation guide with pictures is here
- Download PuTTY from here
On Windows Vista
- Install VMPlayer - http://www.vmware.com/products/player/
If you are using your own computer you will also need:
- Install Xming http://sourceforge.net/projects/xming/ (more info on Xming here)
- Installation guide with pictures is here
- Download PuTTY from here
Known problems
- 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.
- 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)
- You need VMFusion, speak to Simon to get a free copy
On Linux
- 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/
Installing the VM
- Download the VM image
- Unzip it (more here...)
- 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:
- Ubuntu OS
- Python v2.6
- gcc v4.3.3
- gnuplot
- SVN client and helper scripts
- jEdit - simpler editor
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:
- Log into the VM
- 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
- Type
tar -zxvf scripts.tar.gz
to uncompress the file
- Type
ls
you should see something like:
student@computationalphysics:~$ ls
scripts scripts.tar.gz
- Delete the compressed file by typing
rm scripts.tar.gz
- Log out (press Control + D) and log back in again
This process will become a script for you ~soon...
Connecting to the VM
Loading program windows from your VM (aka using X11)
Mac OSX/Linux
- Start up the Virtual Machine in VMWare
- Run the
myip
program, this will give you the "address" that you can use to connect to your VM
- On your mac open the Terminal application
- Type
ssh -Y student@<VM IP address>
- Check things are working by running
xterm
- a window should pop up - find a demonstrator if it doesn't
Windows
This assumes you have installed the XMing software from http://sourceforge.net/projects/xming/ - if you are using other tools (Exceed, Cygwin) you're on your own!
- Start XMing by double clicking on the Xming Icon on the Desktop, this should make a little X icon appear in your taskbar (bottom right)
- Hovering over the icon should bring up a tooltip with "Xming Server:0.0"
- Start up the Virtual Machine in VMWare
- Run the
myip
program, this will give you the "address" that you can use to connect to your VM
- Open up PuTTY
- put the number (IP address) from
myip
in the "Host Name (or IP address)" box on the first screen (Session)
- double click on SSH in the Category tree (left hand side), select "X11"
- check the "Enable X11 Forwarding" check box
- go back to the Session screen, and save the connection information so you don't have to do this again
- click "Open" to connect up to the VM
- Check things are working by running
xterm
- a window should pop up - find a demonstrator if it doesn't
Useful links
http://www.cs.caltech.edu/courses/cs11/misc/xwindows.html
Putting files onto your VM
From your computer
The easiest way to get files from your Windows PC onto your VM is by using
WinSCP. Connect to your VM in a similar manner to when you use
PuTTY. You can drag files into the right hand side to copy them into the VM and drag them from that pane onto a folder on your computer. Right clicking on a file in
WinSCP will bring up a context menu, if you choose edit a simple editor will be brought up so you can easily modify files.
On a mac you could use a program like
Cyberduck to copy files over, or use the scp command line tool (this is also available on Linux).
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
- 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.