setting up your virtual machine for...

14
CS-2011, Machine Organization and Assembly Language, D-term 2013 A Linux Virtual Machine for CS-2011 Projects Hugh C. Lauer Adjunct Professor Worcester Polytechnic Institute As an alternative to working on the CCC Linux systems, a virtual machine is provided for your convenience. It is not necessary to use this, but some students may prefer to use their own laptop or desktop computers for CS-2011 projects. This document describes how to set up a Linux virtual machine on your personal Windows computer using the free VMware Player. 1,2 Virtual Machines A virtual machine is an application program capable of simulating a computer system with enough fidelity and performance to mimic actual computer hardware. The virtual machine concept originated in the 1960s, and it has now matured to the point where virtual machines are routinely used in a wide variety of commercial, academic, and organizational settings. Two important terms in virtual machine technology are host and guest. The host is the hardware and operating system on which the virtual machine application runs — e.g., your own computer, a laboratory computer, or a departmental or corporate server. The host operating system is 1 Students with Linux or Macintosh systems do not need to use this, because the projects can be carried out natively on those platforms. 2 This virtual machine is similar to but smaller than the one used for the operating systems course. 1

Upload: others

Post on 03-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

CS-2011, Machine Organization and Assembly Language, D-term 2013

A Linux Virtual Machine for CS-2011 ProjectsHugh C. LauerAdjunct Professor

Worcester Polytechnic Institute

As an alternative to working on the CCC Linux systems, a virtual ma-chine is provided for your convenience. It is not necessary to use this, but some students may prefer to use their own laptop or desktop com-puters for CS-2011 projects. This document describes how to set up a Linux virtual machine on your personal Windows computer using the free VMware Player.1,2

Virtual MachinesA virtual machine is an application program capable of simulating a computer system with enough fidelity and performance to mimic ac-tual computer hardware. The virtual machine concept originated in the 1960s, and it has now matured to the point where virtual ma-chines are routinely used in a wide variety of commercial, academic, and organizational settings.Two important terms in virtual machine technology are host and guest.

The host is the hardware and operating system on which the vir-tual machine application runs — e.g., your own computer, a lab-oratory computer, or a departmental or corporate server. The host operating system is irrelevant, so long as it supports the virtual machine application. Sometimes the host system has no formal operating system of its own and, instead, runs the virtu-alization application directly on “bare hardware.” In this case, the virtualization application is called a hypervisor.

The guest is the simulated computer, which runs its own operat-ing system and set of applications — e.g., a Linux guest running on top of a Windows or Mac-OS host.

1 Students with Linux or Macintosh systems do not need to use this, because the projects can be carried out natively on those platforms.

2 This virtual machine is similar to but smaller than the one used for the operat-ing systems course.

1

Page 2: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

The virtual machine application uses the host processor(s) to simulate the guest processor(s), and it uses files on the host system to simulate the disks and RAM of the guest system. It also connects some host re-sources directly to the guest system — e.g., the host’s CD or DVD drive or a USB flash drive when it is plugged into the host system.This virtual machine is based on VMware Player, a freeware virtual-ization application. Other virtualization applications are also available and can be used with this virtual machine image, but students who choose to do so are on their own.

Download and install your virtual machineBefore you can use your virtual machine, you need to acquire and in-stall VMware Player.3 You can download and install VMware Player from here:–

https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0

Next, download the zip file containing the virtual machine image from the following URL:–

http://www.cs.wpi.edu/~cs2011/d13/Resources/MiniSUSE-12.1.zip This file is about 2.1 gigabytes. It will download fairly quickly on the WPI campus, but it could take a long time to off-campus locations with slow network service.4 Unzip this file to a folder on your hard drive. Please note that the unzipped files may eventually grow to 8-10 giga-bytes on your host machine. The unzipped folder should look like Fig-ure 1 below:–

3 Also available are VMware Workstation (for Windows or Linux) or VMware Fu-sion for the Macintosh.

4 If download speed is a problem for you, it is suggested that you download the zip file to a flash drive using a public computer on campus and then physically carry it to your computer off campus.

2

Page 3: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

Figure 1

The most important file is the VMware virtual machine configuration file (with the vmx extension, just above the middle of the figure). This is a text file describing all of the attributes of the virtual machine and its component files. You can open it in a text editor such as Notepad and examine its contents, but that is not necessary for this course.For most purposes in this course, you can use the virtual machine “right out of the box.” Double click on the vmx file in Figure 1, or navi-gate to it and open it in VMware Player. If it turns out that you need to make adjustments, see instructions at the end of this document.After VMware Player opens and before it boots the virtual machine, it will present you with dialog box resembling the following:–

Figure 2

3

Page 4: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

Be sure to select “I copied it.” The reason is that VMware generates a network MAC address5 from the path name of the VMware virtual ma-chine configuration file. VMware uses this path name to figure out whether it is dealing with the same virtual machine or a copy. Very, very bad things happen when two or more computers get onto the same network with the same MAC address. When you select “I copied it,” VMware changes the MAC address to something different (and hopefully unique, at least within the scope of your network).After the virtual machine is loaded and started, you will be presented with a boot screen resembling the one in Figure 3 below.If you do nothing, a timer will count down and the default version of the operating system — i.e., Desktop -- openSUSE 12.1— will boot. If you click in the window, you may choose other options before booting, but that should not be necessary in this course.Note: You transfer the input focus of the mouse and keyboard to

the virtual machine by clicking in its window or typing CTRL-G. You can return the input focus to the host desktop by typing CTRL-ALT. If the input focus is in the wrong place, the virtual machine won’t hear you type and won’t notice you moving the mouse.Once the focus is in the virtual machine, you may use the up and down arrows to select the booting option and Enter to invoke that booting option. You can also cancel the boot timer by sim-ply pressing the arrow keys. This will give you time, for exam-ple, to change settings in the VMware Player menu bar.

During booting, the screen may briefly change to a text console, and then it will eventually change to a GUI login interface resembling Fig-ure 5 on Page 6. If you want to watch the Linux boot messages, type ESC when the input focus is in the virtual machine prior to the GUI lo-gin.

5 MAC addresses are the hardware addresses that Ethernet devices use to com-municate with each other. MAC stands for “Media Access Code”.

4

Page 5: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

Figure 3

If any of these screens is too large to fit into the VMware Player win-dow (or if it is too large to fit on your monitor when you are in full screen mode), you will see scrollbars. You may resize the virtual dis-play to fit your own monitor or window later, after you have logged in (see below under Optional Virtual Machine Settings).You can also run your virtual machine in full-screen mode, during which it occupies the entire display. To enter or leave full-screen mode, simply type CTL-ALT-ENTER. In full-screen mode, a retractable a menu bar resembling Figure 4 appears at the top of the screen. This lets you access useful VMware commands at run time. The “thumb tack” at the left of the menu bar locks it in place or allows it to retract upward from view.

Figure 4

In this menu bar, the Virtual Machine pull-down menu contains vari-ous commands that allow you to change the settings of the virtual ma-chines, modify the Shared Folders, connect host devices such as CD-DVD drives and USB devices to the virtual machine, etc. One of the

5

Page 6: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

commands allows you to send CTL-ALT-DEL to the guest Also at the right of the menu bar are buttons to minimize, maximize, and close the guest.

Figure 5

Logging inLog in to the dialog box of Figure 5. Your user ID is student, and your password is CS-2011. After you have logged in, you will be presented with a graphic desktop called KDE, the Linux Desktop Environment, shown in Figure 6 below. Under normal circumstances, it will resize itself to fit the window of your VMware application or the full screen. If it does not resize itself, see the instructions for under Optional Vir-tual Machine Settings below.KDE is the SUSE Linux equivalent of the Windows or Macintosh desk-top, and it is used much the same way. In particular, note the little green “Gecko” icon in the lower left corner. This is functionally equiv-alent to the Start button in Windows. Click it to get a two-dimensional menu of program items and other commands, as shown in Figure 7.

6

Page 7: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

Figure 6

Note: After you have logged in, you will find that the input focus follows the mouse and cursor. That is, you can move the mouse out of the virtual machine and click in a normal desktop window and work there. You can then move the mouse back into the vir-tual machine, click, and work there. Normally, you will also be able to cut, copy, and paste between the virtual (i.e., guest) ma-chine and other applications on the host machine. This is made possible by a software package called open-vm-tools, which is installed in the guest operating system.

Open a Command ShellClick on the Start button (i.e., the “Gecko” button) to bring up the Fig-ure 7 menu. Select the Terminal command to bring up a Linux com-mand shell. Test your shell by typing a shell command. Figure 8 shows a small terminal window in which the commands which and ip ad-dress have been issued.

7

Page 8: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

Figure 7

Figure 8

You are now ready to work. You may invoke Firefox by clicking he Firefox icon next to the Gecko (start) button at the bottom of the desk-top, or you may type the command

firefox &

to a command shell. (The ‘&’ instructs the shell to run the command in the background.)For editing text and C files, use your favorite Linux editor. In this vir-tual machine, kwrite is particularly recommended. It has a natural graphical user interface, and it can be configured to intelligently in-dent C code.

8

Page 9: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

Optional Virtual Machine SettingsChanging the Display SizeIt is a nuisance to try to work with a virtual display of the guest sys-tem that does not fit into a window or on the screen of the host sys-tem. Under normal circumstances, the display “should” automatically resize itself. If not, you may want to change the default display size of the guest by invoking the Configure Desktop command from the Start menu of the guest operating system (Figure 7). This brings up a win-dow resembling Figure 9 below.Scroll down until an icon group named “Hardware” is visible, and then select Display and Monitor to tell KDE the size of the display. Af-ter you have selected and applied the new display size, click the op-tion that says to make it the default. Finally, select Application Appearance in the top section, which opens a window with a lot of options. Select Fonts from the left panel. This lets you set the font sizes for most of the window characteristics. Note especially the Force Fonts DPI pull-down menu near the bottom, which controls the number of pixels per inch. Setting this will help the font sizes to look like those sizes on the virtual display. Feel free to ex-periment with other settings in this tool.

Figure 9

9

Page 10: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

Personalizing your virtual machineTo change your password, click on the “Account Details” icon in the top left corner of Figure 9 above. This will bring up a dialog box allow-ing you to change your password and enter other information about yourself. Alternatively, you can use the passwd shell command.If you want to create another user name for yourself, invoke YaST, the system administration tool, to configure the user and group settings. Click the Start button in the lower left corner, select the third sub-menu, labeled Computer, and select the YaST command, as shown at the top of Figure 10 below.

Figure 10

YaST will first ask you for the root password. This is CS-2011, the same as the password for the user student. It will then bring up the YaST window, shown in Figure 11 below.

10

Page 11: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

Figure 11

Select Security and Users from the left panel and User and Group Management from the right panel. Follow this GUI to create a new identity for yourself and/or to change passwords. We suggest that you use your WPI e-mail identity. Log out, and then log in with this new identity, and finally use YaST again to delete the student identity.6

Other Properties of your Virtual MachineIn normal circumstances, it is not expected that you will need to change the attributes or properties of your virtual machine. However, if you do, these can be accessed from the Virtual machine settings submenu of the Virtual Machines menu of Figure 3 or Figure 4. At-tributes include:–

The number of processors. There is no need for you to run more than one processor in this course. If you are running on a multi-core machine, you should allocate no more than half the number of processors to the guest machine.

The size of (simulated) RAM. By experience, the amount of simu-lated Random Access Memory in the virtual machine should not exceed half of the amount of physical RAM in the host computer. The size of the RAM memory can be changed when the virtual machine is running, but changes do not take effect until it is restarted.

The CD/DVD drive or USB device. These devices in the guest system use the physical devices of the host system. When you

6 So far as we can tell, YaST stands for “Yet Another System Tool.”

11

Page 12: Setting up your Virtual Machine for VMwareweb.cs.wpi.edu/.../d13/Resources/SettingUpYourVirtual… · Web viewThe virtual machine concept originated in the 1960s, and it has now matured

insert a CD or DVD into the physical drive of the host, or when you plug a flash drive into a USB port of the host, you can con-trol the behavior as to whether the device should be used by the host system or the guest system. It cannot be used by both at the same time.

ConclusionThat’s it! Enjoy your virtual machine. You are now ready for your first project. When you are ready to take a break, you may power off your virtual machine by invoking the “leave” tab from the Start menu and selecting the appropriate option. You may also “Suspend” the virtual machine by simply exiting VMware Player. You can then resume it later.

Be sure to back up your work on a regular and frequent basis.

DocumentationDocumentation for VMware Player can be found here:–

http://www.vmware.com/support/pubs/ Documentation about OpenSUSE Linux can also be found on-line at

http://doc.opensuse.org/ This includes a getting started guide, a user’s manual, an administra-tor’s manual, and other information. Do not try to print these. To-gether, they are well over 1000 pages.

12