Sunteți pe pagina 1din 6

Operating Systems 15 - CS 323

Assignment Virtual Machine

February 24, 2015

Why use a Virtual Machine?

Linux is an open-source operating system, meaning that anybody can take


the source code, study it, understand it, modify it and use it. This has lead to the
creation of many distributions of the operating system, each having its own team
of developers working to maintain and improve it. At the core of the operating
system is the Linux kernel, currently maintained by Linux creator Linus Torvalds.
Thousands of developers world-wide contribute to it, making it one of the largest
open source projects in existence. Each team, however, chooses which kernel
version to use for their distribution, and sometimes applies its own custom kernel
patches.
Due to the large variety of distributions, tools and the plethora of possible
hardware and software configurations, we will be providing you a Virtual Machine
to use. It comes preinstalled with a Linux distribution we selected, as well as a
recent version of the Linux kernel source tree. This ensures that everyone has
access to the same tools, and benefits from a common (virtual) hardware platform
to work with. In addition, we will be able to evaluate your solution in the exact
same conditions you work with, hopefully eliminating most discrepancies. What
is more, you will be able to easily revert to a previous sane state in the case you
break something. For example, this way you dont need to reboot your physical
machine to test your new kernel.
You are not required to solve the assignments in the provided VM, but your
solution will be evaluated using this VM. Furthermore, if you use a different work
environment, it will be more difficult for us to help you address the issues you may
encounter, since we will not be familiar with your setup. If you choose to build
your own workspace, you can use the Vmchecker 1 automatic evaluation interface
to check that your submitted solution works as expected.

See the CS323 - Vmchecker.pdf on moodle.

Virtual Machine Description

You can download the virtual machine from this URL2 .


Please verify that the download was successful by checking that the MD5
sum of your archive is the same as the one mentioned below. On Linux or Mac
OS, you can do this using the md5sum or md5 command line tools, respectively.
On Windows, you can use the File Checksum Integrity Verifier, as described here3 .
md5(oslab-vm.zip) = d1b08fe0cf5267dde5dd50f6aab438b9 .
The ZIP file contains a VMware Virtual Machine with the following configuration:
2 processors with 1 core each
20 GB SCSI HDD
512 MB RAM
2 serial ports
Debian GNU Linux Wheezy 7.8.2 (32bit)
Linux kernel 3.18.3
User account: oslab, password: oslab
Root account password: oslab
2 Network Connections: NAT & Host-Only
In order to run this Virtual Machine, we recommend that you use VMware
Workstation 11 (if you are using Linux or Windows), or VMware Fusion 7. EPFL
students are provided with a free license for either of these products, which you
can obtain here4 .
This VM can also be run inside VirtualBox, but we discourage this due to
the way the two platforms implement the virtual hardware. Unfortunately, we
will not be able to offer support if you choose to use a different solution (such as
VirtualBox).
NOTE: Its probably a good idea to not change any configuration options
of the Virtual Machine. If you do need to change something, please make sure
to check the feedback you receive from Vmchecker before submitting your final
version!
2
3
4

https://docs.google.com/uc?id=0B8-168-UhNZCalJIQjdJTmNITzg
https://support.microsoft.com/kb/889768
https://winauth.epfl.ch/vmware-v5/login.aspx

Checking and preparing VMwares network configuration

After installing VMware, you should check that the network configuration
includes a NAT network (the VM shares your hosts IP address when connecting
to the Internet) and a Host-Only network (the VM and your host are connected to
a network without any external access). This will ensure you are able to properly
communicate with the VM, and to the Internet from within the VM. To do this,
follow these steps:
If you are running Linux or Windows
Go to Edit->Virtual Network Editor and check that in the list there is at
least one network of the type host-only and at least one network of the type NAT.
If either of these types are missing, click on Add Network, select the type of network to add (e.g., NAT, Host-Only), and click Save.
If you are running MacOS
Go to VMware Fusion->Preferences->Network. Make sure that you have
both the items Share with my Mac and Private to my Mac in the list. If either of
them are missing, first click on the lock icon to enable changes. Next, click on the
+ symbol, and, to create a Host-Only network (i.e., Private to my Mac), make
sure the checkbox Allow virtual machines on this network to connect to external
networks (using NAT) is deselected. Reciprocally, to create a NAT network (i.e.,
Share with my Mac), make sure that the aforementioned checkbox is selected.

Booting up the VM

After downloading and unpacking oslab-vm.zip in your folder of choice,


go ahead and start up VMware (Workstation or Fusion). Select File->Open and
browse to the location of the oslab-vm folder, and select Debian 7.x.vmx . Once
the VM is added to your inventory, select Power on this VM and the guest operating system will boot up.
When first starting the VM, you may receive a message stating that This
virtual machine might have been moved or copied. In case this happens, you can
select I Moved It.
After it has finished booting up, you will see a prompt that looks like this:
Debian GNU/Linux 7 oslab tty1
oslab login:

Interacting with the OS


1. Directly through the GUI

Simply click inside the VM window and your keyboard and mouse input will
be redirected to the guest operating system. To release control back to your host,
simply press Ctrl+Alt or Ctrl+Cmd.
2. Connect through SSH
Your virtual machine is connected to your network card, meaning you can
access the guest operating system via SSH. You can use this to issue commands
to the guest system, as well as to copy files over. The hostname of your guest
operating system is oslab.local
To use this feature, first enter the VM (in the manner described above), and
run the following command:
$ sudo apt-get install avahi-daemon
If you are running Linux or MacOS
$ ssh oslab@oslab.local
$ scp some_file oslab@oslab.local:/home/oslab/some_file
$ scp oslab@oslab.local:/home/oslab/another_file ./another_file

If you are running Windows


You can use tools such as PuTTY5 to connect to the guest. To transfer files,
you can use a SCP client such as WinSCP6 . Use the hostname oslab.local and
the oslab/oslab username/password combination.
3. Using Shared Folders
VMware provides a simple way to copy files to and from the VM called
Shared Folders.
To activate this feature, open the VMware application and go to
VM->Settings->Options->Shared Folders (or Virtual Machine->Settings->Sharing).
Then select which folder on your host you wish to share with your VM.
When you login to the VM, you can now find the shared folder in
/mnt/hgfs/<your_folder_name>.
5
6

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
http://winscp.net/download/winscp556.zip

Working on the guest OS

We have provided the minimum set of tools and utilities that we feel you will
require to build and test your solutions. You are free to install any other tools you
might need, however, please note that your assignment will be evaluated using
only the tools that come preinstalled with the VM.
Installing a GUI
In order to reduce the size of the VM image and to simplify things, we have
not installed a GUI on the guest OS. If you want to do so, you can by running the
following command:
$ sudo tasksel install desktop
Installing a custom keyboard layout
If you need to install a custom keyboard layout in the VM (e.g., Swiss French),
you can do this by installing the console-common package:
$ sudo apt-get install console-common
Further, to make your changes permanent, edit /etc/default/keyboard and
change the following (for example, for Swiss French):
XKBLAYOUT="ch"
XKBVARIANT="fr"

Creating and reverting to a snapshot of the guest state

Another advantage of using a Virtual Machine is that you can create snapshots of your environment and jump back to them in case something goes wrong
(e.g., your new kernel crashes on boot). These snapshots capture both the state
of the HDD and the state of the RAM, meaning that it will contain all the running
processes at the time it was taken.
Creating a snapshot
You can create a snapshot of your VM by clicking on VM->Snapshot->Take
Snapshot (or Virtual Machine->Shapshots->Take Snapshot). You can choose
a name and a brief description for your snapshot. This helps, for example, if you
want to save the state of your VM at several incremental points.

Restoring a snapshot
WARNING: When you restore a snapshot, all data written to disk from
the time the snapshot was taken is erased! This does not apply for shared
folders, so make sure to backup your files (either by SCP or shared folders).
Go to VM->Snapshot->Snapshot Manager, select the snapshot you wish to
restore,
and click on Go To.
For Mac OS Users,
go to
Virtual Machine->Shapshots->Snapshots. Select the snapshot and click on
Restore.

S-ar putea să vă placă și