Unit-V Notes Updated
Unit-V Notes Updated
x 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.
x The defining component of Linux is the Linux kernel, an operating system kernel first
released on 5 October 1991 by Linus Torvalds.
x 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
x 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.
x Open Source - Linux source code is freely available and it is community based development
project.
x 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.
x Hierarchical File System - Linux provides a standard file structure in which system files/ user
files are arranged.
x Shell - Linux provides a special interpreter program which can be used to execute commands
of the operating system.
x 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
x 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.
x 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.
x System Utility - System Utility programs are responsible to do specialized, individual level
tasks
x 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.
x An init program is the first process launched by the Linux kernel, and is at the root of the
process tree.
x 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.
x 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 harware.
5.4 Architecture
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.
x 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.
x 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.
ƒ
ƒ 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).
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.
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.
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.
x 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.
x The system administrator seeks to ensure that the uptime, performance, resources, and security
of the computers without exceeding the budget.
x To meet these needs, a system administrator may acquire, install, or upgrade computer
components and software, provide routine automation, maintain security policies AND
troubleshoot.
x Introducing and integrating new technologies into existing data center environments and
configuring, adding, and deleting file systems.
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.
x 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.
x A network administrator maintains network infrastructure such as switches and routers, and
diagnoses problems with these or with the behaviour of network-attached computers.
x 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.
x 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.
x 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).
x A postmaster administers a mail server.
x 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.
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,
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.
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.
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
# /etc/init.d/networking restart
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:
# /bin/hostname -F /etc/hostname
x 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.
x 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.
Debian downloads and configures the file as an Internet service and the status
can be
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:
# /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
# 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
/var/lib/named/dev/random
# /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
server is up and running
server1:/home/admin#
x 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.
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.
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.
VMware Workstation
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.
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 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:
x VESA-compliant graphics for the guest machine to access high screen resolutions
x Support for Unity, a feature that allows seamless integration of applications with the host
desktop
########################################### [100%]
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
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:
x The virtual machine name and the location of the virtual machine's files
x Whether to allocate all the space for a virtual disk at the time you create it
If you select Custom, the wizard prompts you to specify or accept defaults for the
following choices:
x 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.
x Use an IDE virtual disk for a guest operating system that would otherwise have a SCSI
virtual disk created by default
x 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
If you selected Custom as your configuration path, you may adjust the memory
settings or accept the defaults, then click Next to continue.
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.
XEN Environment
• Allowing for easy integration with existing networking and storage infrastructures
2. Using XenServer increases flexibility by:
Administering XenServer
x There are two methods by which to administer XenServer: XenCenter and the
XenServer Command-Line Interface (CLI).
x 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.
x The XenCenter on-line Help is a useful resource for getting started with XenCenter and
for context-sensitive assistance.
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
# /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
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:
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
# 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
3. To prove that both servers are running, try these commands:
# xm list
# xentop
4. To start Xen domains automatically, use these commands:
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.