Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Unit 5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

Sri vidya College of Engineering & Technology, Virudhunagar Course material

UNIX V CASE STUDIES

5.1 The Linux System


 An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs. The Linux open source operating system,
or Linux OS, is a freely distributable, cross-platform operating system based on UNIX.
 The Linux consist of a kernel and some system programs. There are also some application programs for
doing work. The kernel is the heart of the operating system which provides a set of tools that are used
by system calls.
 The defining component of Linux is the Linux kernel, an operating system kernel first released on 5
October 1991 by Linus Torvalds.

 A Linux-based system is a modular Unix-like operating system. It derives much of its basic design from
principles established in UNIX. Such a system uses a monolithic kernel which handles process control,
networking, and peripheral and file system access.

5.2 Important features of Linux Operating System


 Portable - Portability means software can work on different types of hardware in same way. Linux
kernel and application programs supports their installation on any kind of hardware platform.
 Open Source - Linux source code is freely available and it is community based development project.
 Multi-User & Multiprogramming - Linux is a multiuser system where multiple users can access system
resources like memory/ ram/ application programs at same time. Linux is a multiprogramming system
means multiple applications can run at same time.
 Hierarchical File System - Linux provides a standard file structure in which system files/ user files are
arranged. STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

 Shell - Linux provides a special interpreter program which can be used to execute commands of the
operating system.
 Security - Linux provides user security using authentication features like password protection/
controlled access to specific files/ encryption of data.

5.3 Components of Linux System


Linux Operating System has primarily three components
 Kernel - Kernel is the core part of Linux. It is responsible for all major activities of this operating system.
It is consists of various modules and it interacts directly with the underlying hardware. Kernel provides
the required abstraction to hide low level hardware details to system or application programs.
 System Library - System libraries are special functions or programs using which application programs
or system utilities accesses Kernel's features. These libraries implements most of the functionalities of
the operating system and do not requires kernel module's code access rights.
 System Utility - System Utility programs are responsible to do specialized, individual level tasks

Installed components of a Linux system include the following:


 A bootloader is a program that loads the Linux kernel into the computer's main memory, by being
executed by the computer when it is turned on and after the firmware initialization is performed.
 An init program is the first process launched by the Linux kernel, and is at the root of the process tree.
 Software libraries, which contain code that can be used by running processes. The most commonly
used software library on Linux systems, the GNU C Library (glibc), C standard library and Widget toolkits.
 User interface programs such as command shells or windowing environments. The user interface, also
known as the shell, is either a command-line interface (CLI), a graphical user interface (GUI), or through
controls attached to the associated hardware. STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

5.4 Architecture

Linux System Architecture is consists of following layers


1. Hardware layer - Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc).
2. Kernel - Core component of Operating System, interacts directly with hardware, provides low level

services to upper layer components.


3. Shell - An interface to kernel, hiding complexity of kernel's functions from users. Takes commands

from user and executes kernel's functions.


4. Utilities - Utility programs giving user most of the functionalities of an operating systems.

5.5 Modes of operation


 Kernel Mode:
 Kernel component code executes in a special privileged mode called kernel mode with full
access to all resources of the computer.
 This code represents a single process, executes in single address space and do not require any
context switch and hence is very efficient and fast.
 Kernel runs each processes and provides system services to processes, provides protected
access to hardware to processes.
 User Mode:
 The system programs use the tools provided by the kernel to implement the various services
required from an operating system. System programs, and all other programs, run `on top of
the kernel', in what is called the user mode.
 Support code which is not required to run in kernel mode is in System Library.
STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

 User programs and other system programs work in User Mode which has no access to system
hardware and kernel code.
 User programs/ utilities use System libraries to access Kernel functions to get system's low level
tasks.

5.6 Major Services provided by LINUX System


1. Initialization (init)
The single most important service in a LINUX system is provided by init program. The
init is started as the first process of every LINUX system, as the last thing the kernel does when
it boots. When init starts, it continues the boot process by doing various startup chores
(checking and mounting file systems, starting daemons, etc).
2. Logins from terminals (getty)
Logins from terminals (via serial lines) and the console are provided by the getty
program. init starts a separate instance of getty for each terminal upon which logins are to be
allowed. Getty reads the username and runs the login program, which reads the password. If
the username and password are correct, login runs the shell.
3. Logging and Auditing (syslog)
The kernel and many system programs produce error, warning, and other messages. It
is often important that these messages can be viewed later, so they should be written to a file.
The program doing this logging operation is known as syslog.
4. Periodic command execution (cron & at)
Both users and system administrators often need to run commands periodically. For
example, the system administrator might want to run a command to clean the directories with
temporary files from old files, to keep the disks from filling up, since not all programs clean up
after themselves correctly.
o The cron service is set up to do this. Each user can have a crontab file, where the lists
the commands wish to execute and the times they should be executed.
o The at service is similar to cron, but it is once only: the command is executed at the
given time, but it is not repeated.

5. Graphical user interface


o UNIX and Linux don't incorporate the user interface into the kernel; instead, they let it
be implemented by user level programs. This applies for both text mode and graphical
environments. This arrangement makes the system more flexible.
STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

o The graphical environment primarily used with Linux is called the X Window System (X
for short) that provides tools with which a GUI can be implemented. Some popular
window managers are blackbox and windowmaker. There are also two popular desktop
managers, KDE and Gnome.
6. Network logins (telnet, rlogin & ssh)
Network logins work a little differently than normal logins. For each person logging in via the
network there is a separate virtual network connection. It is therefore not possible to run a separate
getty for each virtual connection. There are several different ways to log in via a network, telnet and
ssh being the major ones in TCP/IP networks.
Most of Linux system administrators consider telnet and rlogin to be insecure and prefer ssh,
the ``secure shell'', which encrypts traffic going over the network, thereby making it far less likely that
the malicious can ``sniff'' the connection and gain sensitive data like usernames and passwords.
7. Network File System (NFS & CIFS)
One of the more useful things that can be done with networking services is sharing files via a
network file system. Depending on your network this could be done over the Network File System (NFS),
or over the Common Internet File System (CIFS).
NFS is typically a 'UNIX' based service. In Linux, NFS is supported by the kernel. CIFS however is
not. In Linux, CIFS is supported by Samba. With a network file system any file operations done by a
program on one machine are sent over the network to another computer.

STUDENTSFOCUS.COM
UNIX Timeline - Simplified history of Unix-like operating systems
Sri vidya College of Engineering & Technology, Virudhunagar Course material

5.7 SYSTEM ADMINISTRATOR


 A system administrator is a person who is responsible for the configuration and reliable
operation of computer systems, especially multi-user computers, such as servers.
 The system administrator seeks to ensure that the uptime, performance, resources, and
security of the computers without exceeding the budget.
 To meet these needs, a system administrator may acquire, install, or upgrade computer
components and software, provide routine automation, maintain security policies AND
troubleshoot.
5.7.1 Responsibilities of a System Administrator
A system administrator's responsibilities might include:
 Installing and configuring new hardware and software.
 Applying operating system updates, patches, and configuration changes.
 Analyzing system logs and identifying potential issues with computer systems.
 Introducing and integrating new technologies into existing data center environments and
configuring, adding, and deleting file systems.
 Performing routine audit of systems and software.
 Adding, removing, or updating user account information, resetting passwords, etc.
 Responsibility for security and documenting the configuration of the system.
 Troubleshooting any reported problems.
 System performance tuning.

5.7.2 Various System Administrator Roles


In a larger company, these may all be separate positions within a computer support or Information
Services (IS) department. In a smaller group they may be shared by a few sysadmins, or even a single
person.
 A database administrator (DBA) maintains a database system, and is responsible for the
integrity of the data and the efficiency and performance of the system.
 A network administrator maintains network infrastructure such as switches and routers, and
diagnoses problems with these or with the behaviour of network-attached computers.
 A security administrator is a specialist in computer and network security, including the
administration of security devices such as firewalls, as well as consulting on general security
measures.

STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

 A web administrator maintains web server services (such as Apache or IIS) that allow for
internal or external access to web sites. Tasks include managing multiple sites, administering
security, and configuring necessary components and software.
 A computer operator performs routine maintenance and upkeep, such as changing backup
tapes or replacing failed drives in a redundant array of independent disks (RAID).
 A postmaster administers a mail server.
 A Storage Administrator (SAN) can create, provision, add or remove Storage to/from
Computer systems. Storage can be attached locally to the system or from a storage area
network (SAN) or network-attached storage (NAS).

5.7.3 Requirements for LINUX system administrator


1. While specific knowledge is a boon, system administrator should possess basic knowledge about all
aspects of Linux. For example, a little knowledge about Solaris, BSD, nginx or various flavors of
Linux.
2. Knowledge in at least one of the upper tier scripting language such as Python, Perl, Ruby or more.
3. To be a system administrator, he/she at least needs to have some hands-on experience of system
management, system setup and managing Linux or Solaris based servers as well as configuring
them.
4. Knowledge in shell programming such as Buorne or Korn and architecture.
5. Knowledge about storage technologies like FC, NFS or iSCSI is great, while knowledge regarding
backup technologies is a must for a system administrator.
6. Knowledge in testing methodologies like Subversion or Git is great, while knowledge of version
control is also an advantage.
7. Knowledge about basics of configuration management tools like Puppet and Chef.
8. Skills with system and application monitoring tools like SNMP or Nagios are also important, as they
show your ability as an administrator in a team setting.
9. Knowledge about how to operate virtualized VMWare or Xen Server, Multifunction Server and
Samba
10. An ITIL Foundation certification for Linux system administrator.

STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

5.8 SETTING UP A LINUX MULTIFUNCTION SERVER

A Linux machine can be configured as a server either by compiling several well-defined scripts

and off-line downloaded packages or through on-line installation method. Setting up a

multifunction server, the system administrator should have knowledge about a series of shell

commands. A Linux machine can be configured as any of following application servers such as,

• A Web Server (Apache 2.0.x)

• A Mail Server (Postfix)

• A DNS Server (BIND 9)

• An FTP Server (ProFTPD)

• Mail Delivery Agents (POP3/POP3s/IMAP/IMAPs)

• Webalizer for web site statistics

Files and directories shared by Linux system, as viewed from a Windows PC


STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

5.8.1 Server Requirements


To set up a Linux Internet server, we will need a connection to the Internet and a static IP
address. The system can also be setup with the address leased by ISP and configure it statically.
Computer with at least a Pentium III CPU, a minimum of 256 MB of RAM, and a 10 GB hard
drive is preferred. Obviously, a newer CPU and additional memory will provide better performance.
This chapter is based on Debian’s stable version. We strongly suggest using a CD with the Netinstall
kernel. The Debian web site provides downloadable CD images.

5.8.2 Installing & Configuring Network Services


Administrator should log into the server from a remote console on desktop. It is recommended
to do further administration from another system (even a laptop), because a secure server normally
runs in what is called headless mode—that is, it has no monitor or keyboard.
Get used to administering the server like this. A SSH client on the remote machine is needed
which virtually all Linux distributions have and which can be downloaded for other operating
systems as well.
Configuring the Network
If DHCP is used during the Debian installation, Server with a static IP address should be
configured as follows,
1. To change the settings to use a static IP address, you’ll need to become root and
edit the file /etc/network/interfaces to suit your needs. As an example, we’ll use
the IP address 70.153.258.42.
2. To add the IP address 70.153.258.42 to the interface eth0, we must change the file
to look like this (you’ll have to obtain some of the information from your ISP):
auto eth0
iface eth0 inet static
address 70.153.258.42
netmask 255.255.255.248
network 70.153.258.0
broadcast 70.153.258.47
gateway 70.153.258.46
3. After editing the /etc/network/interfaces file, restart the network by entering:
# /etc/init.d/networking restart
4. To edit /etc/resolv.conf and add nameservers to resolve Internet hostnames to
their corresponding IP addresses. At this point, we will simply set up a minimal DNS
server. Our resolv.conf looks as follows: STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

search server
nameserver 70.153.258.42
nameserver 70.253.158.45
nameserver 151.164.1.8
5. Now edit /etc/hosts and add your IP addresses:
127.0.0.1 localhost.localdomain localhost server1
70.153.258.42 server1.centralsoft.org server1
6. Now, to set the hostname, enter these commands:
# echo server1.centralsoft.org > /etc/hostname
# /bin/hostname -F /etc/hostname
7. verify that you configured your hostname correctly by running the hostname
command:
~$ hostname -f
server1.centralsoft.org
5.9 Providing Domain Name Services (BIND - the ubiquitous DNS server)
 Debian provides a stable version of BIND in its repositories. BIND can be installed, setup
and secure it in a chroot environment, meaning it won’t be able to see or access files
outside its own directory tree. This is an important security technique.
 The term chroot refers to the trick of changing the root filesystem (the /directory) that a
process sees, so that most of the system is effectively inaccessible to it.
 The BIND server also can be configured to run as a non-root user. That way, if someone
gains access to BIND, he/she won’t gain root privileges or be able to control other
processes.
1. To install BIND on your Debian server, run this command:
# apt-get install bind9
Debian downloads and configures the file as an Internet service and the status can be
seen on the console:
Setting up bind9 (9.2.4-1)
Adding group `bind' (104) - Done.
Adding system user `bind'
Adding new user `bind' (104) with group `bind'.
Not creating home directory.
Starting domain name service: named.
2. To put BIND in a secured environment, create a directory where the service can run
unexposed to other processes. First stop the service by running the following command:
STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

# /etc/init.d/bind9 stop
3. Edit the file /etc/default/bind9 so that the daemon will run as the unprivileged user bind,
chrooted to /var/lib/named. Change the line:
OPTS="-u bind"
So that it reads:
OPTIONS="-u bind -t /var/lib/named"
4. To provide a complete environment for running BIND, create the necessary directories
under /var/lib:
# mkdir -p /var/lib/named/etc
# mkdir /var/lib/named/dev
# mkdir -p /var/lib/named/var/cache/bind
# mkdir -p /var/lib/named/var/run/bind/run
Then move the config directory from /etc to /var/lib/named/etc:
# mv /etc/bind /var/lib/named/etc
Next, create a symbolic link to the new config directory from the old location, to avoid
problems when BIND is upgraded in the future:
# ln -s /var/lib/named/etc/bind /etc/bind
Make null and random devices for use by BIND, and fix the permissions of the directories:
# mknod /var/lib/named/dev/null c 1 3
# mknod /var/lib/named/dev/random c 1 8
Then change permissions and ownership on the files:
# chmod 666 /var/lib/named/dev/null
/var/lib/named/dev/random
# chown -R bind:bind /var/lib/named/var/*
# chown -R bind:bind /var/lib/named/etc/bind
5. Finally, start BIND:
# /etc/init.d/bind9 start
6. To check whether named is functioning without any trouble.
Execute this command:
server1:/home/admin# rndc status
number of zones: 6
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

server is up and running


server1:/home/admin#

Setting up Ubuntu shares in a Windows environment

Ubuntu’s setup screen for file-sharing services

STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

5.10 Virtualization
 Virtualization refers to the act of creating a virtual (rather than actual) version of
something, including a virtual computer hardware platform, operating system (OS),
storage device, or computer network resources.

Traditional Architecture vs. Virtual Architecture

Virtual Machine Server – A Layered Approach

 Hardware virtualization or platform virtualization refers to the creation of a virtual


machine that acts like a real computer with an operating system. Software executed on
these virtual machines is separated from the underlying hardware resources.
 Hardware virtualization hides the physical characteristics of a computing platform from
STUDENTSFOCUS.COM
users, instead showing another abstract computing platform.
Sri vidya College of Engineering & Technology, Virudhunagar Course material

 For example, a computer that is running Microsoft Windows may host a virtual machine
that looks like a computer with the Ubuntu Linux operating system; Ubuntu-based
software can be run on the virtual machine.

Hardware Virtualization
Benefits of Virtualization
1. Instead of deploying several physical servers for each service, only one server can
be used. Virtualization let multiple OSs and applications to run on a server at a time.
Consolidate hardware to get vastly higher productivity from fewer servers.
2. If the preferred operating system is deployed as an image, so we needed to go
through the installation process only once for the entire infrastructure.
3. Improve business continuity: Virtual operating system images allow us for instant
recovery in case of a system failure. The crashed system can be restored back by
coping the virtual image.
4. Increased uptime: Most server virtualization platforms offer a number of advanced
features that just aren't found on physical servers which increases servers’ uptime.
Some of features are live migration, storage migration, fault tolerance, high
availability, and distributed resource scheduling.
5. Reduce capital and operating costs: Server consolidation can be done by running
multiple virtual machines (VM) on a single physical server. Fewer servers means
lower capital and operating costs.

STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

Architecture - Virtualization
The heart of virtualization is the “virtual machine” (VM), a tightly isolated software
container with an operating system and application inside. Because each virtual machine is
completely separate and independent, many of them can run simultaneously on a single
computer. A thin layer of software called a hypervisor decouples the virtual machines from the
host and dynamically allocates computing resources to each virtual machine as needed.
This architecture redefines your computing equation and delivers:
 Many applications on each server: As each virtual machine encapsulates an entire
machine, many applications and operating systems can run on a single host at the same
time.
 Maximum server utilization, minimum server count: Every physical machine is used to
its full capacity, allowing you to significantly reduce costs by deploying fewer servers
overall.
 Faster, easier application and resource provisioning: As self-contained software files,
virtual machines can be manipulated with copy-and-paste ease. Virtual machines can
even be transferred from one physical server to another while running, via a process
known as live migration.

5.10.1 Setting up a VMware Workstation

VMware Workstation
VMware Workstation is developed and sold by VMware, Inc., a division of EMC
Corporation. VMware Workstation is a hypervisor that runs on x86 or x86-64 computers; it
enables users to set up one or more virtual machines (VMs) on a single physical machine, and
use them simultaneously along with the actual machine.
Each virtual machine can execute its own operating system, including versions of
Microsoft Windows, Linux, BSD, and MS-DOS. VMware Workstation supports bridging existing
host network adapters and share physical disk drives and USB devices with a virtual machine.
In addition, it can simulate disk drives. It can mount an existing ISO image file into a virtual
optical disc drive so that the virtual machine sees it as a real one. Likewise, virtual hard disk
drives are made via .vmdk files.
VMware Workstation can save the state of a virtual machine (a "snapshot") at any
instant. These snapshots can later be restored, effectively returning the virtual machine to the
saved state.
STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

VMware Workstation
VMware Workstation includes the ability to designate multiple virtual machines as a
team which can then be powered on, powered off, suspended or resumed as a single object,
making it particularly useful for testing client-server environments.

VMWare Player
The VMware Player, a virtualization package of basically similar, but reduced,
functionality, is also available, and is free of charge for non-commercial use, or for distribution
or other use by written agreement.
VMware Player is a virtualization software package supplied free of charge by VMware,
Inc. VMware Player can run existing virtual appliances and create its own virtual machines. It
uses the same virtualization core as VMware Workstation, a similar program with more
features, but not free of charge. VMware Player is available for personal non-commercial use,
or for distribution or other use by written agreement.
VMware claims the Player offers better graphics, faster performance, and tighter
integration for running Windows XP under Windows Vista or Windows 7 than Microsoft's
Windows XP Mode running on Windows Virtual PC, which is free of charge for all purposes.

VMware Tools
VMware Tools is a package with drivers and other software that can be installed in guest
operating systems to increase their performance. It has several components, including the
following drivers for the emulated hardware:
 VESA-compliant graphics for the guest machine to access high screen resolutions
STUDENTSFOCUS.COM
 Network drivers for the vmxnet2 and vmxnet3 NIC
Sri vidya College of Engineering & Technology, Virudhunagar Course material

 Mouse integration, Drag-and-drop file support


 Clipboard sharing between host and guest
 Time synchronization capabilities (guest syncs with host machine's clock)
 Support for Unity, a feature that allows seamless integration of applications with the
host desktop

Installing and Configuring VMWare


1. Download VMware Server 2. VMware management console on a remote Ubuntu
desktop behind a firewall at a remote location. Run the following command:
$gksu vmware-server-console
2. Install the VMware Server 2.0.2 rpm as shown below.
# rpm -ivh VMware-server-2.0.2-203138.i386.rpm
Preparing...
1:VMware-server
########################################### [100%]
The installation of VMware Server 2.0.2 for Linux completed successfully.
You can decide to remove this software from your system at any time by invoking the
following command:
rpm -e VMware-server
Before running VMware Server for the first time, you need to configure it for your
running kernel by invoking the following command:
/usr/bin/vmware-config.pl
3. Configure VMware Server 2 using vmware-config.pl. Execute the vmware-config.pl as
shown below. Accept default values for everything. Partial output of the vmware-
config.pl is shown below.
# /usr/bin/vmware-config.pl
4. Go to VMware Infrastructure Webaccess. Go to https://{host-os-ip}:8333/ui to access
the VMware Infrastructure web access console.

VMware Web Access Login STUDENTSFOCUS.COM


Sri vidya College of Engineering & Technology, Virudhunagar Course material

Installing a VMware Guest OS


1. Start VMware Workstation
Windows host: Double-click the VMware Workstation icon on your desktop or use the
Start menu (Start > Programs > VMware > VMware Workstation).
Linux host: In a terminal window, enter the command
vmware &
2. Start the New Virtual Machine Wizard
When you start VMware Workstation, you can open an existing virtual machine or
create a new one. Choose File > New > Virtual Machine to begin creating your virtual
machine.
3. Select the method you want to use for configuring your virtual machine.

If you select Typical, the wizard prompts you to specify or accept defaults for the
following choices:
 The guest operating system
 The virtual machine name and the location of the virtual machine's files
 The network connection type
 Whether to allocate all the space for a virtual disk at the time you create it
 Whether to split a virtual disk into 2GB files

STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

If you select Custom, the wizard prompts you to specify or accept defaults for the
following choices:
 Make a legacy virtual machine that is compatible with Workstation 4.x, GSX
Server 3.x, ESX Server 2.x and VMware ACE 1.x.
 Use an IDE virtual disk for a guest operating system that would otherwise have
a SCSI virtual disk created by default
 Use a physical disk rather than a virtual disk and Set memory options that are
different from the defaults
4. Select a guest operating system and type a name and folder for the virtual machine.
Linux hosts: The default location for this Windows XP Professional virtual machine is
<homedir>/vmware/winXPPro, where <homedir> is the home directory of the user who is

currently logged on.

5. Specify the number of processors for the virtual machine. The setting Two is supported
only for host machines with at least two logical processors.

STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

If you selected Custom as your configuration path, you may adjust the memory settings
or accept the defaults, then click Next to continue.
6. Configure the networking capabilities of the virtual machine.
If you selected Typical as your configuration path, click Finish and the wizard
sets up the files needed for your virtual machine.
If you selected Custom as your configuration path, continue with the steps
below to configure a disk for your virtual machine.
7. Select whether to create an IDE or SCSI disk and specify the capacity of the virtual disk.

8. Click Finish. The wizard sets up the files needed for your virtual machine.

5.10.2 Setting up a XEN Workstation


XEN Workstation
Xen is a hypervisor using a microkernel design, providing services that allow multiple
computer operating systems to execute on the same computer hardware concurrently.
The University of Cambridge Computer Laboratory developed the first versions of Xen.
The Xen community develops and maintains Xen as free and open-source software, subject to
the requirements of the GNU General Public License (GPL), version 2. Xen is currently available
for the IA-32, x86-64 and ARM instruction sets.
XenServer runs directly on server hardware without requiring an underlying operating
system, which results in an efficient and scalable system. XenServer works by abstracting
elements from the physical machine (such as hard drives, resources and ports) and allocating
them to the virtual machines running on it.
STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

XEN Environment
Responsibilities of the hypervisor include memory management and CPU scheduling of
all virtual machines, and for launching the most privileged domain - the only virtual machine
which by default has direct access to hardware. From the dom0 the hypervisor can be managed
and unprivileged domains can be launched.

Benefits of Using XenServer


1. Using XenServer reduces costs by:
• Consolidating multiple VMs onto physical servers
• Reducing the number of separate disk images that need to be managed
• Allowing for easy integration with existing networking and storage infrastructures
2. Using XenServer increases flexibility by:
• Allowing you to schedule zero downtime maintenance by using XenMotion to live
migrate VMs between XenServer hosts
• Increasing availability of VMs by using High Availability to configure policies that
restart VMs on another XenServer host if one fails
• Increasing portability of VM images, as one VM image will work on a range of
deployment infrastructures

STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

Administering XenServer
 There are two methods by which to administer XenServer: XenCenter and the XenServer
Command-Line Interface (CLI).
 XenCenter is a graphical, Windows-based user interface. XenCenter allows you to manage
XenServer hosts, pools and shared storage, and to deploy, manage and monitor VMs from
your Windows desktop machine.
 The XenCenter on-line Help is a useful resource for getting started with XenCenter and for
context-sensitive assistance.

Installing and Configuring XenServer


1. Type the following command to get information about xen server package
# yum info xen
2. Run the system-config-securitylevel program or edit /etc/selinux/config to looks as follows:
SELINUX=Disabled
SELINUXTYPE=targeted
If you changed the SELINUX value from enforcing, you’ll need to reboot Fedora before proceeding.
3. This command will install the Xen hypervisor, a Xen-modified Fedora kernel called domain 0, and
various utilities:
# yum install kernel-xen0
4. To make the Xen kernel the default, change this line:
default=1
to
default=0
5. Now you can reboot. Xen should start automatically, but let’s check:
# /usr/sbin/xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 880 1 r----- 20.5

The output should show that Domain-0 is running. Domain 0 controls


all the guest operating systems that run on the processor,
similarly to how the kernel controls processes in an operating
system.

Installing a Xen Guest OS from the Command-line


1. Preparing the System for virt-install
Fedora Linux does not install VNC by default. To verify whether VNC is installed, run the
following command from a Terminal Window:
rpm -q vnc STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

If rpm reports that VNC is not installed, it may be installed from root as follows:
yum install vnc
2. Running virt-install to Build the Xen Guest System
virt-install must be run as root and, once invoked, will ask a number of questions before
creating the guest system. The question are as follows:
i. What is the name of your virtual machine and install location?
ii. How much RAM should be allocated (in megabytes)?
iii. What would you like to use as the disk (path)?
iv. Would you like to enable graphics support? (yes or no)
The following transcript shows a typical virt-install session:
# virt-install
3. Once the guest system has been created, the vncviewer screen will appear containing the operating
system installer:

Installing a Xen Guest OS (Fedora Core 5)


1. Fedora Core 5 has a Xen guest installation script that simplifies the process, although it
installs only FC5 guests. The script expects to access the FC5 install tree via FTP, the Web,
or NFS; for some reason, you can’t specify a directory or file.
# mkdir /var/www/html/dvd
# mount -t iso9660 /dev/dvd /var/www/html/dvd
# apachectl start
Now we’ll run the installation script and answer its questions:
# xenguest-install.py
2. Xen does not start the guest operating system automatically. You need to type this command on
the host:
# xm create guest1 STUDENTSFOCUS.COM
Sri vidya College of Engineering & Technology, Virudhunagar Course material

3. To prove that both servers are running, try these commands:


# xm list
# xentop
4. To start Xen domains automatically, use these commands:
# /sbin/chkconfig --level 345 xendomains on
# /sbin/service xendomains start
5. To Edit A Xen Guest Configuration File, Which Is A Text File (Actually, A Python Script) In The
/Etc/Xen Directory.
# man xmdomain.cfg
And edit as follows,
# Automatically generated Xen config file
name = "guest1"
memory = "256"
disk = [ 'file:/xenguest,xvda,w' ]
vif = [ 'mac=00:16:3e:63:c7:76' ]
uuid = "bc2c1684-c057-99ea-962b-de44a038bbda"
bootloader="/usr/bin/pygrub"
on_reboot = 'restart'
on_crash = 'restart'
6. Once you have a guest configuration file, create the Xen guest with
this command:
# xm create -c guest_name
where
guest_name can be a full pathname or a relative filename (in which case Xen places
it in /etc/xen/guest_name).
Xen will create the guest domain and try to boot it from the given file or device.
The -c option attaches a console to the domain when it starts, so you can answer the
installation questions that appear.

STUDENTSFOCUS.COM
UNIT V CASE STUDY 9

Linux System - Design Principles, Kernel Modules, Process Management, Scheduling, Memory

Management, Input-Output Management, File System, Inter-process Communication; Mobile

OS - iOS and Android - Architecture and SDK Framework, Media Layer, Services Layer, Core

OS Layer, File System.

iPhone OS becomes iOS


Prior to the release of the iPad in 2010, the operating system running on the iPhone was
generally referred to as iPhone OS. Given that the operating system used for the iPad is
essentially the same as that on the iPhone it didn‟t make much sense to name it iPad OS. Instead,
Apple decided to adopt a more generic and non-device specific name for the operating system.
Given Apple‟s predilection for names prefixed with the letter „i‟ (iTunes, iBookstore, iMac etc)
the logical choice was, of course, iOS. Unfortunately, iOS is also the name used by Cisco for the
operating system on its routers (Apple, it seems, also has a predilection for ignoring trademarks).
When performing an internet search for iOS, therefore, be prepared to see large numbers of
results for Cisco‟s iOS which have absolutely nothing to do with Apple‟s iOS.

An Overview of the iOS 6 Architecture


iOS consists of a number of different software layers, each of which provides programming
frameworks for the development of applications that run on top of the underlying hardware.

These operating system layers can be presented diagrammatically as illustrated in Figure

Figure: iOS 6 Architecture

STUDENTSFOCUS.COM
Some diagrams designed to graphically depict the iOS software stack show an additional box
positioned above the Cocoa Touch layer to indicate the applications running on the device. In the
above diagram we have not done so since this would suggest that the only interface available to
the app is Cocoa Touch. In practice, an app can directly call down any of the layers of the stack
to perform tasks on the physical device.
That said, however, each operating system layer provides an increasing level of abstraction away
from the complexity of working with the hardware. As an iOS developer you should, therefore,
always look for solutions to your programming goals in the frameworks located in the higher
level iOS layers before resorting to writing code that reaches down to the lower level layers. In
general, the higher level of layer you program to, the less effort and fewer lines of code you will
have to write to achieve your objective. And as any veteran programmer will tell you, the less
code you have to write the less opportunity you have to introduce bugs.
The Cocoa Touch Layer
The Cocoa Touch layer sits at the top of the iOS stack and contains the frameworks that are most
commonly used by iPhone application developers. Cocoa Touch is primarily written in
Objective-C, is based on the standard Mac OS X Cocoa API (as found on Apple desktop and
laptop computers) and has been extended and modified to meet the needs of the iPhone
hardware.
The Cocoa Touch layer provides the following frameworks for iPhone app development:
UIKit Framework (UIKit.framework)
The UIKit framework is a vast and feature rich Objective-C based programming interface. It is,
without question, the framework with which you will spend most of your time working. Entire
books could, and probably will, be written about the UIKit framework alone. Some of the key
features of UIKit are as follows:
 User interface creation and management (text fields, buttons, labels, colors, fonts etc)
 Application lifecycle management
 Application event handling (e.g. touch screen user interaction)
 Multitasking
 Wireless Printing
 Data protection via encryption
 Cut, copy, and paste functionality

STUDENTSFOCUS.COM
 Web and text content presentation and management
 Data handling
 Inter-application integration
 Push notification in conjunction with Push Notification Service
 Local notifications (a mechanism whereby an application running in the background can
gain the user‟s attention)
 Accessibility
 Accelerometer, battery, proximity sensor, camera and photo library interaction
 Touch screen gesture recognition
 File sharing (the ability to make application files stored on the device available via
iTunes)
 Blue tooth based peer to peer connectivity between devices
 Connection to external displays

Map Kit Framework (MapKit.framework)


If you have spent any appreciable time with an iPhone then the chances are you have needed to
use the Maps application more than once, either to get a map of a specific area or to generate
driving directions to get you to your intended destination. The Map Kit framework provides a
programming interface which enables you to build map based capabilities into your own
applications. This allows you to, amongst other things, display scrollable maps for any location,
display the map corresponding to the current geographical location of the device and annotate the
map in a variety of ways.
Push Notification Service
The Push Notification Service allows applications to notify users of an event even when the
application is not currently running on the device. Since the introduction of this service it has
most commonly been used by news based applications. Typically when there is breaking news
the service will generate a message on the device with the news headline and provide the user the
option to load the corresponding news app to read more details. This alert is typically
accompanied by an audio alert and vibration of the device. This feature should be used sparingly
to avoid annoying the user with frequent interruptions.

STUDENTSFOCUS.COM
Message UI Framework (MessageUI.framework)
The Message UI framework provides everything you need to allow users to compose and send
email messages from within your application. In fact, the framework even provides the user
interface elements through which the user enters the email addressing information and message
content. Alternatively, this information may be pre-defined within your application and then
displayed for the user to edit and approve prior to sending.
Address Book UI Framework (AddressUI.framework)
Given that a key function of the iPhone is as a communications device and digital assistant it
should not come as too much of a surprise that an entire framework is dedicated to the
integration of the address book data into your own applications. The primary purpose of the
framework is to enable you to access, display, edit and enter contact information from the iPhone
address book from within your own application.
Game Kit Framework (GameKit.framework)
The Game Kit framework provides peer-to-peer connectivity and voice communication between
multiple devices and users allowing those running the same app to interact. When this feature
was first introduced it was anticipated by Apple that it would primarily be used in multi-player
games (hence the choice of name) but the possible applications for this feature clearly extend far
beyond games development.
iAd Framework (iAd.framework)
The purpose of the iAd Framework is to allow developers to include banner advertising within
their applications. All advertisements are served by Apple‟s own ad service.
Event Kit UI Framework (EventKit.framework)
The Event Kit UI framework was introduced in iOS 4 and is provided to allow the calendar and
reminder events to be accessed and edited from within an application.
Accounts Framework (Accounts.framework)
iOS 5 introduced the concept of system accounts. These essentially allow the account
information for other services to be stored on the iOS device and accessed from within
application code. Currently system accounts are limited to Twitter accounts, though other
services such as Facebook will likely appear in future iOS releases. The purpose of the Accounts
Framework is to provide an API allowing applications to access and manage these system
accounts.

STUDENTSFOCUS.COM
Social Framework (Social.framework)
The Social Framework allows Twitter, Facebook and Sina Weibo integration to be added to
applications. The framework operates in conjunction the Accounts Framework to gain access to
the user‟s social network account information.

The iOS Media Layer

The role of the Media layer is to provide iOS with audio, video, animation and graphics
capabilities. As with the other layers comprising the iOS stack, the Media layer comprises a
number of frameworks which may be utilized when developing iPhone apps. In this section we
will look at each one in turn.

Core Video Framework (CoreVideo.framework)

The Core Video Framework provides buffering support for the Core Media framework. Whilst
this may be utilized by application developers it is typically not necessary to use this framework.

Core Text Framework (CoreText.framework)

The iOS Core Text framework is a C-based API designed to ease the handling of advanced text
layout and font rendering requirements.

Image I/O Framework (ImageIO.framework)

The Image I/O framework, the purpose of which is to facilitate the importing and exporting of
image data and image metadata, was introduced in iOS 4. The framework supports a wide range
of image formats including PNG, JPEG, TIFF and GIF.

Assets Library Framework (AssetsLibrary.framework)

The Assets Library provides a mechanism for locating and retrieving video and photo files
located on the iPhone device. In addition to accessing existing images and videos, this
framework also allows new photos and videos to be saved to the standard device photo album.

STUDENTSFOCUS.COM
Core Graphics Framework (CoreGraphics.framework)

The iOS Core Graphics Framework (otherwise known as the Quartz 2D API) provides a
lightweight two dimensional rendering engine. Features of this framework include PDF
document creation and presentation, vector based drawing, transparent layers, path based
drawing, anti-aliased rendering, color manipulation and management, image rendering and
gradients. Those familiar with the Quartz 2D API running on MacOS X will be pleased to learn
that the implementation of this API is the same on iOS.

Core Image Framework (CoreImage.framework)

A new framework introduced with iOS 5 providing a set of video and image filtering and
manipulation capabilities for application developers.

Quartz Core Framework (QuartzCore.framework)

The purpose of the Quartz Core framework is to provide animation capabilities on the iPhone. It
provides the foundation for the majority of the visual effects and animation used by the UIKit
framework and provides an Objective-C based programming interface for creation of specialized
animation within iPhone apps.

OpenGL ES framework (OpenGLES.framework)

For many years the industry standard for high performance 2D and 3D graphics drawing has
been OpenGL. Originally developed by the now defunct Silicon Graphics, Inc (SGI) during the
1990s in the form of GL, the open version of this technology (OpenGL) is now under the care of
a non-profit consortium comprising a number of major companies including Apple, Inc., Intel,
Motorola and ARM Holdings.

OpenGL for Embedded Systems (ES) is a lightweight version of the full OpenGL specification
designed specifically for smaller devices such as the iPhone. iOS 3 or later supports both
OpenGL ES 1.1 and 2.0 on certain iPhone models (such as the iPhone 3GS and iPhone 4).
Earlier versions of iOS and older device models support only OpenGL ES version 1.1.

STUDENTSFOCUS.COM
GLKit Framework (GLKit.framework)

The GLKit framework is an Objective-C based API designed to ease the task of creating
OpenGL ES based applications.

NewsstandKit Framework (NewsstandKit.framework)

The Newsstand application is a new feature of iOS 5 and is intended as a central location for
users to gain access to newspapers and magazines. The NewsstandKit framework allows for the
development of applications that utilize this new service.

iOS Audio Support

iOS is capable of supporting audio in AAC, Apple Lossless (ALAC), A-law, IMA/ADPCM,
Linear PCM, µ-law, DVI/Intel IMA ADPCM, Microsoft GSM 6.10 and AES3-2003 formats
through the support provided by the following frameworks.

AV Foundation framework (AVFoundation.framework)

An Objective-C based framework designed to allow the playback, recording and management of
audio content.

Core Audio Frameworks (CoreAudio.framework, AudioToolbox.framework and


AudioUnit.framework)

The frameworks that comprise Core Audio for iOS define supported audio types, playback and
recording of audio files and streams and also provide access to the device‟s built-in audio
processing units.

Open Audio Library (OpenAL)

OpenAL is a cross platform technology used to provide high-quality, 3D audio effects (also
referred to as positional audio). Positional audio may be used in a variety of applications though
is typically used to provide sound effects in games.

STUDENTSFOCUS.COM
Media Player Framework (MediaPlayer.framework)

The iOS Media Player framework is able to play video in .mov, .mp4, .m4v, and .3gp formats at
a variety of compression standards, resolutions and frame rates.

Core Midi Framework (CoreMIDI.framework)

Introduced in iOS 4, the Core MIDI framework provides an API for applications to interact with
MIDI compliant devices such as synthesizers and keyboards via the iPhone‟s dock connector.

The iOS Core Services Layer

The iOS Core Services layer provides much of the foundation on which the previously
referenced layers are built and consists of the following frameworks.

Address Book Framework (AddressBook.framework)

The Address Book framework provides programmatic access to the iPhone Address Book
contact database allowing applications to retrieve and modify contact entries.

CFNetwork Framework (CFNetwork.framework)

The CFNetwork framework provides a C-based interface to the TCP/IP networking protocol
stack and low level access to BSD sockets. This enables application code to be written that
works with HTTP, FTP and Domain Name servers and to establish secure and encrypted
connections using Secure Sockets Layer (SSL) or Transport Layer Security (TLS).

Core Data Framework (CoreData.framework)

This framework is provided to ease the creation of data modeling and storage in Model-View-
Controller (MVC) based applications. Use of the Core Data framework significantly reduces the
amount of code that needs to be written to perform common tasks when working with structured
data within an application.

Core Foundation Framework (CoreFoundation.framework)

STUDENTSFOCUS.COM
The Core Foundation framework is a C-based Framework which provides basic functionality
such as data types, string manipulation, raw block data management, URL manipulation, threads
and run loops, date and times, basic XML manipulation and port and socket communication.
Additional XML capabilities beyond those included with this framework are provided via the
libXML2 library. Though this is a C-based interface, most of the capabilities of the Core
Foundation framework are also available with Objective-C wrappers via the Foundation
Framework.

Core Media Framework (CoreMedia.framework)

The Core Media framework is the lower level foundation upon which the AV Foundation layer is
built. Whilst most audio and video tasks can, and indeed should, be performed using the higher
level AV Foundation framework, access is also provided for situations where lower level control
is required by the iOS application developer.

Core Telephony Framework (CoreTelephony.framework)

The iOS Core Telephony framework is provided to allow applications to interrogate the device
for information about the current cell phone service provider and to receive notification of
telephony related events.

EventKit Framework (EventKit.framework)

An API designed to provide applications with access to the calendar, reminders and alarms on
the device.

Foundation Framework (Foundation.framework)

The Foundation framework is the standard Objective-C framework that will be familiar to those
who have programmed in Objective-C on other platforms (most likely Mac OS X). Essentially,
this consists of Objective-C wrappers around much of the C-based Core Foundation Framework.

Core Location Framework (CoreLocation.framework)

STUDENTSFOCUS.COM
The Core Location framework allows you to obtain the current geographical location of the
device (latitude, longitude and altitude) and compass readings from with your own applications.
The method used by the device to provide coordinates will depend on the data available at the
time the information is requested and the hardware support provided by the particular iPhone
model on which the app is running (GPS and compass are only featured on recent models). This
will either be based on GPS readings, Wi-Fi network data or cell tower triangulation (or some
combination of the three).

Mobile Core Services Framework (MobileCoreServices.framework)

The iOS Mobile Core Services framework provides the foundation for Apple‟s Uniform Type
Identifiers (UTI) mechanism, a system for specifying and identifying data types. A vast range of
predefined identifiers have been defined by Apple including such diverse data types as text, RTF,
HTML, JavaScript, PowerPoint .ppt files, PhotoShop images and MP3 files.

Store Kit Framework (StoreKit.framework)

The purpose of the Store Kit framework is to facilitate commerce transactions between your
application and the Apple App Store. Prior to version 3.0 of iOS, it was only possible to charge a
customer for an app at the point that they purchased it from the App Store. iOS 3.0 introduced
the concept of the “in app purchase” whereby the user can be given the option to make additional
payments from within the application. This might, for example, involve implementing a
subscription model for an application, purchasing additional functionality or even buying a faster
car for you to drive in a racing game. With the introduction of iOS 6, content associated with an
in-app purchase can now be hosted on, and downloaded from, Apple‟s servers.

SQLite library

Allows for a lightweight, SQL based database to be created and manipulated from within your
iPhone application.

System Configuration Framework (SystemConfiguration.framework)

STUDENTSFOCUS.COM
The System Configuration framework allows applications to access the network configuration
settings of the device to establish information about the “reachability” of the device (for example
whether Wi-Fi or cell connectivity is active and whether and how traffic can be routed to a
server).

Quick Look Framework (QuickLook.framework)

The Quick Look framework provides a useful mechanism for displaying previews of the contents
of file types loaded onto the device (typically via an internet or network connection) for which
the application does not already provide support. File format types supported by this framework
include iWork, Microsoft Office document, Rich Text Format, Adobe PDF, Image files,
public.text files and comma separated (CSV).

The iOS Core OS Layer

The Core OS Layer occupies the bottom position of the iOS stack and, as such, sits directly on
top of the device hardware. The layer provides a variety of services including low level
networking, access to external accessories and the usual fundamental operating system services
such as memory management, file system handling and threads.

Accelerate Framework (Accelerate.framework)

The Accelerate Framework provides a hardware optimized C-based API for performing complex
and large number math, vector, digital signal processing (DSP) and image processing tasks and
calculations.

External Accessory Framework (ExternalAccessory.framework)

Provides the ability to interrogate and communicate with external accessories connected
physically to the iPhone via the 30-pin dock connector or wirelessly via Bluetooth.

STUDENTSFOCUS.COM
Security Framework (Security.framework)

The iOS Security framework provides all the security interfaces you would expect to find on a
device that can connect to external networks including certificates, public and private keys, trust
policies, keychains, encryption, digests and Hash-based Message Authentication Code (HMAC).

System (LibSystem)

As we have previously mentioned, iOS is built upon a UNIX-like foundation. The System
component of the Core OS Layer provides much the same functionality as any other UNIX like
operating system. This layer includes the operating system kernel (based on the Mach kernel
developed by Carnegie Mellon University) and device drivers. The kernel is the foundation on
which the entire iOS platform is built and provides the low level interface to the underlying
hardware. Amongst other things, the kernel is responsible for memory allocation, process
lifecycle management, input/output, inter-process communication, thread management, low level
networking, file system access and thread management.

As an app developer your access to the System interfaces is restricted for security and stability
reasons. Those interfaces that are available to you are contained in a C-based library called
LibSystem. As with all other layers of the iOS stack, these interfaces should be used only when
you are absolutely certain there is no way to achieve the same objective using a framework
located in a higher iOS layer.

STUDENTSFOCUS.COM

You might also like