Linux OS and Virtual Machine (VM) Intro

Required Reading

Prolog & Chapter 1 of Getting Started with Ubuntu Linux 12.04 (see syllabus in CISS 100 Home for download) 

Please read the textbook’s Prolog & Chapter 1 Installation – note please do not install with the Textbook’s instructions as we will install into the open source VirtualBox Virtual Machine (VM) in the next lab (i.e. submenu).

Chapter 1 GNU/Linux Basic Operating System (see syllabus in CISS 100 Home for download)   

Please read this textbook’s Chapter 1

Optional reading:

The VirtualBox manual has an excellent introduction to virtualization and virtual machines and has very good installation instructions http://dlc.sun.com.edgesuite.net/virtualbox/4.2.6/UserManual.pdf

If possible, please read the Wikipedia Linux entry for Linux’s history and also the following for Linux’s relevance today:  http://www.eweek.com/c/a/Linux-and-Open-Source/Linux-Turns-20-Open-Source-OS-Changes-Course-of-IT-History-386476/?kc=EWKNLEDP09062011A.

Lastly, there is a nice list of Linux terms here and you may wish to bookmark it for future reference: http://www.linux-tutorial.info/modules.php?name=MContent&obj=glossary

Preparation

Please read, reread and understand this content as I cannot stress this preparation enough as students often plunge in (Prof Hurd calls it combat programming) without a proper understanding and students invaribly end up getting into trouble.   Let me ask you this, would you just open your car’s hood and start to fix things without getting the manuals and reading the manuals first?  For some reason this is what people do with computing as they just jump in and ask questions later when proper Information Systems Analysis an Design requires we research first.  What makes this even worse is that without the preparatory research people can’t even formulate proper questions because they lack the necessary foundational understanding and terminology.

OS Introduction

Now my main points (and again, I apologize in advance for my anthropomorhic writing style and I never would have apologized for this but they pick on people for this in The Big Bang Theory).

The Operating System (OS) is the low-level or intermediary software (e.g. group of programs) that facilitates use of the computer’s hardware.  In this sense, the OS is the computer’s resource manager and performs “protected” tasks for users and the application processes.

Why protected?  Imagine if your word processor decided to write files over your MP3 collection… this would be bad.   What if your print jobs were interleaved with other user’s print jobs rather than in their entirety (e.g. print one page for you, print one page for them, print one page for you….).  These examples would not be good so the OS acts as the system’s policeman and protects and manages system resources.

Put another way, every process must “ask” the OS to access restricted/protected resources for them so it is the OS that actually accesses and manages the resources (I apologize for my anthropomorphic writing stile but the OS’s functionality is based on human based policies and it gets the point across).  To illustrate this, a word processor does not open, write to, print or save a file.  The word processor “asks” the OS to open a file, get keyboard strokes from the keyboard, display the file on the screen, print the file and save the file to disk.  So what are a computer’s resources?  Well first, resources can be categorized as logical or virtual resources or alternatively as physical resources.  Logical resources include files (the actual digital information not the physical space the file takes up in storage) and logical Internet connections.  Physical resources include the CPU (CPU processing cycles are allocated in time slices by the OS Scheduler), memory, storage, physical network connections (Wifi, Bluetooth, Ethernet network interface cards or nics ) and peripherals (e.g. I/O devices that include printers, keyboards, cameras, touch screens, etc.).  Note this distinction can often be thought of in terms of logical software and physical hardware.

Now recall I stated at the course outset that Computing texts are often misread by the average person since every word looks familiar (i.e. you have seen every word on this page before).  Note that I used the word “process” above rather than “program”.  A process is an active or dynamic entity (active program) as it has been allocated logical and physical resources by the OS whereas a program is a static entity sitting somewhere on storage (and this could be somewhere on a network).  Now having said this, please reread the above 2 paragraphs.  Do you understand everything?  If your answer was yes, what is the difference between storage and memory?  If you do not know the difference then I have hopefully opened your eyes to the level of detail that you need to apply when studying Computing and Information Science.

Linux OS Elements 

Ok, continuing on with OS basics, there are 2 main parts of an OS, the kernel and the system programs.

The Kernel

The Kernel allocates resources as introduced above and systems programs and applications interact with the Kernel through system calls.  The system programs include device drivers, libraries, utility programs, shells (command interpreters) and various other application programs that perform system housekeeping (e.g. client/server relationships).  Now, I recommend you read what Wikipedia has to say on Operating System Kernel (or OS Kernel) as it is spot on: http://en.wikipedia.org/wiki/Kernel_(computing)

The Shell or Terminal Command Line Interface (CLI)

Some authors state the CLI or Shell or Terminal is a 3rd part of the OS and to this extent I include/reproduce Prof Stonebank’s presentation on the topic with permission under the Open Commons License (http://www.ee.surrey.ac.uk/Teaching/Unix/).

“The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The commands are themselves programs: when they terminate, the shell gives the user another prompt ($ for our Ubuntu Linux OS however note that our prompt will have additional information before the $ set by the .profile or .login or another startup file).

The adept user can customise his/her own shell, and users can use different shells on the same machine. The default Ubuntu Shell is bash.

The  shell has certain features to help the user inputting commands.

Filename Completion – By typing part of the name of a command, filename or directory and pressing the [Tab] key, the shell will complete the rest of the name automatically. If the shell finds more than one name beginning with those letters you have typed, it will beep, prompting you to type a few more letters before pressing the tab key again.

History – The shell keeps a list of the commands you have typed in. If you need to repeat a command, use the cursor keys to scroll up and down the list or type history for a list of previous commands.

To illustrate the way that these components work together in a Linux CLI perspective or use case,  suppose a user types:

 

rm myfile   

 

This has the effect of removing the file myfile using the rm system program.  The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process 

rm myfil 

 

has finished running, the shell then returns the Linux prompt $ to the user, indicating that it is waiting for further commands.  Note something similar happens in a graphical user OS interface however few people are actually aware of what is happening under the hood.

Linux OS History and Perspective

Continuing on with our introduction, there is a wealth of information on the Web (again Wikipedia is correct) so I won’t repeat that information here. Please do not feel overwhelmed by all this new information – simply read it and try to understand noting a full understanding comes with time and you are going where few of your friends have dared to go.

Minimally you should know that the Linux kernel was developed by Linus Torvalds and he made the source code available to the world resulting in a free operating system. Linux is now distributed under  the GNU General Public License (GPL).  This GPL means that when you redistribute the Linux source code, you must also distribute the same license providing the same democratic freedom to subsequent users and developers.  As a result, the Linux source code and its GPL are inseparable.

In contrast to MS Windows and Mac OSX, Linux was designed to be a portable operating system and interface (IEEE POSIX compliant interface) at the outset.  When an OS or application is portable it can be run on many different platforms (e.g. computers, refrigerators, cars, mobile devices).  Linux is mainly written in C programming language (portable machine independent language) and it is this basis that allows it to be adapted on many different architectures saying a plethora of applications and network attached storage cell phones android OS.  To illustrate Linux’s present status consider that the Android OS uses a Linux Kernel.

So what are some of Linux’s attractive attributes?

Multiuser OS

Multitasking OS

Network OS

Secure hierarchical file system based on directories

Allows links to file or directory permitting 2 or more names similar to Windows shortcuts

Shell is command interpreter as well as facilitating a programming language (Shell scripts are collection of shell commands in a file for subsequent execution, Windows called these batch files

Shell facilitates file name generation and wildcards where the asterisk (*) can replace several letters and the question mark (?) can replace a single letter

Device independent input and output were devices appear as files and supports redirection

Priority-based job control

Inter-process communication (IPC) pipes and filters

Now while we focus on Ubuntu, there are many other distributions and it is important as IT professionals to recognize them:

http://www.eweek.com/c/a/Linux-and-Open-Source/10-Linux-Distros-Every-IT-Manager-Should-Know-574208/?kc=EWKNLEDP11082011A

A complete listing of all the Linux distributions can be found at www.distrowatch.com.

We will be using the Ubuntu “distro” that runs the GNOME desktop manager (i.e. User Interface or UI) in a Virtual Machine (VM) environment.

Virtual Machines (VM) and Virtualization

Now moving on to VMs.  A VM appears to the end-user to be complete physical machine. What this means is a VM abstracts the hardware components up a level as it is itself a process running on a machine and provides this hardware abstraction to guest operating systems.  Ok, let’s see if I can distill this further.  A VM is a process running on a system (i.e. it is an application being run by an OS on a computer).  We will call the actual physical computer the “Host” computer and the VM will be called the “Guest”.  The host has an architecture (e.g. Intel) and the host OS (e.g. Windows, Mac or Linux) abstracts the details of the host architecture to provide a consistent platform for its applications.  You know this as you can install and update applications on your computer and then later add a new printer or some other device.  Hopefully when you add this device everything still works and as an example, you did not have to update your word processor to work with the new printer.  The host OS handled this interface.

Ok, so now we install a VM and this VM provides an exact architectural replica so that we can install a guest OS in the VM.  Note we can install different OSs in the  host machine since you can buy a PC and install either Windows or Linux or purchase a Mac and through Boot Camp install and boot into either Windows or Mac.   Now once we install a VM on a host OS, and install a guest OS in the VM, we can install applications in the guest OS.  In the guest instance, neither the OS nor the applications realize they are in a VM as they simply see the normal interface (i.e. the OS sees the architecture and the applications see the OS).  Now if the word processor installed in the guest OS wants to print a file, it asks the guest OS to print the file exactly as presented above.  The guest OS uses the interface as presented by the VM to print the file.  The guest OS is unaware the VM is actually an application running on the host OS so the VM asks the host OS to print the file using the same system call that a word processor running on the host would use.

So why do we do use VMs?  They offer many advantages that include:

Isolation – if a VM or a program in a VM crashes, it does not compromise other processes running on the host OS.  To provide an example you are familiar with, if you are running a system with no VMs and your MS Word crashes, your Chrome Browser should not crash.  A VM is simply another application on the host OS so if the guest VM, its guest OS or one of its programs crashes, your system should remain intact.  Microsoft Windows was probably not a good example – 🙂

Security – see isolation description above but consider if your guest VM/OS/Browser were to get a virus.  The VM/OS is simply an application (i.e. just another file) with no access to your host system so the threat is sand-boxed.

Greener or less power consumption – our computers are powerful and can multi-task so we can use computing resources more effectively.

Software development – see isolation above.

and my favorite, uniform desktop support as every client is running the same architecture.  Honestly, this is the only way I can teach the this CISS 100 Ubuntu component but there are still slight variations.

For further reading on VMs please see: http://en.wikipedia.org/wiki/Virtual_machine

Available Desktop Virtual Machines

Ok, so there are 3 main desktop VMs out there and listed below.  In the past we have used the open source VirtualBox but we are nearing completion of an academic alliance agreement with VMWare that will allow all HVCC CIS students and faculty to obtain the more robust (and of course expensive) VMWare Fusion and Workstation.  If you are not a HVCC CIS student you are free to use this site’s resources and you should perform you VM installation using VirtualBox.

VirtualBox for both Mac OSX and Windows.  This is an Open Source solution freely available.

Virtual Box Manual located here: http://www.virtualbox.org/manual/UserManual.html

or download the pdf manual here: http://download.virtualbox.org/virtualbox/UserManual.pdf

VMWare for Mac OSX (i.e. Fusion) and Windows (i.e. VMWare Workstation).

Parallels for Mac OSX.  You are free to purchase this on your own but it will not be supported in this course.

Microsoft Virtual PC – This too works well and has solved some student’s problems where they could not install VB.  Note it is not supported in this course (i.e. you will be on your own configuring Microsoft Virtual PC) but it appears to be a rock solid solution.

To begin our preparation, very good instructions on downloading and installing Ubuntu can be found here and while they are applicable for our present Ubuntu 12.04 LTS I recommend and even insist that you follow my directions in the next lab component. http://www.hanselman.com/blog/InstallingUbuntu104LTSOnWindowsVirtualPCOnWindows7.aspx

Virtualization Resources

[listyofiles folder=”wp-content/uploads/virtualization” options=”table,filesize,icon”]

One Response to Linux OS and Virtual Machine (VM) Intro

  1. Pingback: jfd98ayhcim

Leave a Reply