Anda di halaman 1dari 5

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 don’t 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.

2 Virtual Machine Description


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) = 4f42b759ce89a933005eabce30cf9294 .

The ZIP file contains a VMware Virtual Machine with the following configuration:

• 2 processors with 1 core each • 20 GB SCSI HDD
 • 1GB RAM
 • 2 serial ports
(loopback)

• Debian GNU Linux Wheezy 8.7.1 (32bit) • Linux kernel 4.9.2
 • 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 12 (if you are using Linux or Windows), or VMware Fusion 8.

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: It’s 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!
3
https://support.microsoft.com/kb/889768


3 Checking and preparing VMware’s network configu-


ration
After installing VMware, you should check that the network configuration includes
a NAT network (the VM shares your host’s 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 net- work 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.

4 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 oslab.vmx . Once the
VMisaddedtoyourinventory,select”Power on this VM”andtheguestoperating 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 8 oslab tty1

oslab login: _

5 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

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(orVirtual 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>.

6 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.
5
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html 6
https://winscp.net/download/WinSCP-5.9.4-Setup.exe

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 want to use a custom keyboard layout in the VM (e.g., Swiss French), edit
/etc/default/keyboard and change the following (for example, for Swiss French):

XKBLAYOUT="ch"
XKBVARIANT="fr"

7 Creating and reverting to a snapshot of the guest state


Another advantage of using a Virtual Machine is that you can create “snap- shots” 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”.

Anda mungkin juga menyukai