Presentation10 - University Of Worcester

Download Report

Transcript Presentation10 - University Of Worcester

COMP2122
Network Operating
Systems
Richard Henson
University of Worcester
November 2010
Week 10: More about Unix
(& Linux)

Objectives:
Explain the basic components of any Unix
system
Comprehend the advantages and
disadvantages of using “free” versions of
Unix such as Linux
Explain how to deliver Unix to the PC
desktop via client software and disk
partitioning to allow dual booting
Open Source Unix

Much has already been said in a previous
lecture about the evolution of Unix
 however, the focus tended to be on evolution of
the software, rather than its functionality…
 this lecture (and practical) will address the latter
 However, no study of Unix would be complete
without a closer look at “open source” software
More about Open Source
Unix “X/Open”

This was an early attempt (1984) to
address the early Unix wars
 originally five European Manufacturers
»
»
»
»
»
Bull
Nixdorf
Siemens
Olivetti
ICL
 Grew to 21 members by 1990
 Merged with OSF In 1996
» -> THE “OPEN GROUP”
Open Software Foundation
(OSF) & Unix International


OSF formed in 1988, “Gang of Seven”, led by
DEC
Regarded as divisive e.g; “oppose sun forever”
 rival group: Unix International (AT&T/Sun)

OSF chose Unix as the platform upon which to
base a future “open” operating system
 produced OSF/1 in 1990, also Motif & DCE

By 1993, both groups perceived Microsoft as
the main competition
» buried their differences and worked together on COSE
» finally merged, retaining the OSF name
GNU software

Started with Richard Stallman
 Massachusetts Institute of Technology
 early 1970's

Pioneer in the concept of 'free software’
 'free' means 'freedom', not zero cost
 Set up the Free Software Foundation (FSF)
 produced Unix-like software that was not Unix
(GNU – GNU’s not Unix) and therefore could be
free to use

Left MIT in 1984 and founded GNU*
 goal: to produce software that was free to use, distribute and
modify
GNU principles ->
open source Unix…

Released under 'open source license’
 source code is free
 and freely available via the Internet

Anyone with good programming experience
could further develop the code if they wished
 submitted to a central committee, for consideration
at the next upgrade
 therefore being constantly updated and improved

GNU project completed in 1992, with the
Linux “Unix-like” kernel…
Structure of Unix

Has been layered from the early days
 To enable hardware (platform) to function
independently of user interface

In its most basic implementations, it
just has three parts:
 kernel – interfaces with hardware
 shell – provides command line interface
 Programs/processes – operating system
functions supported from the command
line interface with the aid of “pipes”
Unix “pipes”
ONE of the most significant innovations
in early Unix
 Used for IPCs (remember those?)
linking standard input and output
processes (stdio)

more direct control of “threads”
» pipe creator = pipe server
» application that connects to the pipe = pipe
client
Unix Kernel

Core of the operating system:
 interfaces with hardware
 allocates time and memory to programs
 handles the filestore and communications in
response to system calls
 supports a Unix “shell” process for each
user
 keeps each “shell” running in memory as a
separate process
Unix shell

When a user logs in, the login program:
 checks the username and password
 starts a new “shell”

Perhaps the most important program on
the UNIX system, from the user angle
 represents the user’s interface with the UNIX
system kernel

Command line interpreter (CLI)
 sets up the Unix prompt (usually $)
 interprets the commands the user types in
 arranges for them to be carried out via the kernel
Unix Shell commands

Many are actually subroutines built in to the
shell program and run within that process

When a non built-in shell command is
executed, the shell asks the kernel to create
a new subprocess (a "child" process) to
perform the command:
 each child process exists just long enough to
execute the command
 the shell waits until the child process finishes
before it will accept the next command
More about Command Line
Interpreters

Operate in a simple loop:
accepts a command
interprets the command
executes the command, displaying output
data as appropriate
displays a "prompt" and waits for another
command
Syntax for Unix commands

Unix is case sensitive

Each command consists of:
a command name
followed by command options (if any are
desired)
command arguments (if any are desired)

Command name, options, arguments,
are each separated by a space
Shell and Kernel
Intercommunication

Suppose a user types rm myfile
 overall effect: removes the file myfile

The shell:
 searches the filestore for the file containing the
program rm
 requests the kernel, through system calls, to
execute the program rm on myfile
 returns the UNIX prompt to the user
Unix “Multi-User” Systems

Main Unix system known as a host

Accessible using a dumb terminal:
 usually includes a keyboard, and a video monitor

For each terminal connected to the UNIX
system:
 kernel runs a process called a tty that accepts input
from the terminal, and sends output to the terminal

tty processes are general programs
 must be told the capabilities of the terminal in order
to correctly read from, and write to, the terminal
Unix Client-Server networks

Main Unix system is a server, not a host

X terminals act as clients, interacting
with the UNIX system at a higher level
than the dumb terminal

X terminals have enough on-board
memory and processing power to
support graphical interfaces
interaction includes icons, windows,
menus, and mouse actions
The Unix Redirector: stdio

Every program executed from the shell opens
three files:
 standard input
 standard output
 standard error

The files provide the primary means of
communications between the programs, and
exist for as long as the process runs
stdio process and “C”

“C” was designed around stdio to enable
input and output data to be easily
accommodated through the programming
 The standard input file sends input data to a
process
» by default: read from the terminal keyboard
 The standard output file outputs data
» by default: sent the terminal display screen
 The standard error:
» program reports errors encountered during execution
» by default, goes to the terminal display
C” programs and stdio


Standard syntax of any C program includes
the stdio process
Example: A program that displays “Hello
World” on the screen would be written thus:P
 line 1: #include < stdio.h>
 line 2: void main(){printf("\nHello World\n");}

Without being concerned about the syntax,
stdio.h is basically an “include” library file that
is called by the program to execute the stdio
process
Process Control and
Multitasking

The kernel can keep track of many
processes at once:
each process submitted to the kernel is
given a unique process ID
divides its time between the jobs submitted
to it
achieved through process scheduling
Administering a Unix System Configuring Users

Even if only one person uses the computer,
multiple ids can still be useful:
 can log on as a less-privileged user to prevent
yourself from doing stupid things which will mess up
the system
 can run sensitive software which can be broken into
as a less-privileged user, so if someone will manage
to exploit some hole in this software, they will have
very limited privileges
Root User
On any UNIX-based system the main
user is called 'root’
 The root has unlimited power over the
system and all other users
 The first stage is therefore to create a
password for the root operator

usual password rules apply, but remember
that changes to the configuration cannot be
made is this password is forgotten
The “Humble User”
For the next stage, create an
unprivileged, or ordinary user account
 May seem pointless but this carries a
big advantage

you can’t mess around with the system
security limitations of that user will stop you
doing something you might later regret!
Recent Unix Developments
Unix 95 branded by X/OPEN
 Unix 98 branded by The Open Group
 Now uses a sophisticated Windows-like
environment

most popular known as X-WINDOWS

DON’T
need to work from a Unix prompt
need to remember large numbers of
commands
Unix on a PC

First achieved in the late 1980s by SCO
(Santa Cruz Operations)
Quite a cost outlay (certainly not following
GNU principles!)
Limited range of applications
Offered good file security and multi-user
functionality (in contrast to DOS!)
Linux



Like SCO, PC-based
Unlike SCO Unix, the software IS freely
available via the Internet
Development started in 1991 to develop a PC
kernel from existing open source GNU
software called 'Minix’
 part of Linux name from its creator Linus Torvalds
» student at the University of Helsinki
 enlisted assistance from developers all over the
world via the Internet
 first official version released in 1994
The downside of “free”
software
If a company sells you software, obliged to
offer support
Not so with software in the “public domain”
Nor is public domain software necessarily
easy to use…
For this reason, the three main “vendors” for
Linux (Redhat, Mandrake & SuSe) all sell
Linux with extra software, manuals, and
offer technical support to make it more “user
friendly”
Linux v NT series
More stable
» programs running under Linux almost never
crash
» those that do crash do so because of bad
programming by the author
Secure
» much harder to bring down by a hacker than
Windows NT
» most holes in the TCP/IP stacked have been
plugged
» hackers keep finding new ones on NT series
Free Versions of Linux

The raw source code from the Internet
doesn’t cost anything but...
 needs to be compiled
 really intended for the Unix expert

Stable current version of Linux Kernel is 2.6.9
 available from www.kernel.org

Developments constantly evolving:
 version 2.6.10 currently being tested

One “free” ready-to-run version on disk is
“Ubuntu”
 an African word meaning 'Humanity to others', or 'I
am what I am because of who we all are'
Commercial Versions of Linux
Redhat
 SuSE
 Mandrake

Latter package is particularly
recommended - see later slides
even Mandrake Linux is not for
beginners… You have been warned!
IBM and Linux
IBM continues to produce AIX
 SCO claims IBM taking Linux source
code
 IBM claim the source code is open
source anyway
 Legal battle continues:

http://www.opensource.org/sco-vs-ibm.html
Linux and Novell

Raw code remains “open source”
 downloadable from www.linux.org

Novell acquired Unix in 1993 from USL
 Marketed it in Novell boxes as “Unixware”


Sold it in 1995 to SCO!
In 1999 merged with Redhat
 SuSE linux still independent

In 2003, Novell-Redhat (apparently in debt!)
are trying to buy SuSE linux
 SCO Unix are objecting
 Novell/SCO legal case to follow…

Mandrake still independent
Cut-down Linux


Possible to productively run a Linux
distribution on as little as 2 Mbytes
Full implementation of Trinux contains lots of
software most users won't need
 e.g. web server, Sendmail server, Telnet server,
FTP server etc

BUT you can always install these later…
 Trinux runs from two 1.44MB floppy disks!
(available from www.trinux.org)
 continues to be upgraded – now can involve USB
drives for the utilities!
Installation of Linux

From bootable floppy disk or directly from CD
 on-screen assistance is generally helpful, but
understanding of technical hardware terms (e.g.
SCSI) is assumed. Again - you have been warned!!!

Once installed, an idea to create a “boot disk”
containing the Linux “boot stuff”…
 a program called 'LILO’ - Linux Loader
 installs itself to the boot sector of the storage
medium

If LILO is on the floppy disk not your computer
hard disk it keeps Linux separate from
Windows
 Which also installs stuff to the boot sector…
A Linux Partition

Each operating system really needs its
own partition
quite possible for Linux and Windows (or
NT) to co-exist on the same system
However, when creating a new partition,
it is quite possible for an existing one to
be corrupted or destroyed…
 Linux should therefore be installed on a
Windows machine WITH GREAT
CARE…

Safe Partitioning
A full implementation of Linux needs
about 1.5 Gbytes of hard disk space
 To make a partition for Linux without
killing the Windows files a "non-lethal"
partition program is needed

INCLUDED with Mandrake
NOT with RedHat
Running Linux

System starts up automatically when
computer turned on
can start from floppy or hard disk (previous
slide)
Prompted for a user name/password
 If X-Windows GUI option installed,
username/password screen will look like
Windows, otherwise it will be text-based

 Text-based interface much faster
 Graphics cannot be shown until X-Windows has started
The Linux command prompt
(Console)
Best not to rely on a GUI for everything!
 Console more powerful and can do a lot
of things...
 As with Windows 2000 a command-line
window (Xterm) can be opened within X
 If you're logged in as root, the console
prompt should look like this:

[[email protected]]#
# means root, $ for humble user
Navigating the Unix File
System

Very similar to DOS/Windows
in fact, DOS was copied from XENIX, a
breed of Unix
Uses ‘/’ for root instead of ‘\’
 Some commands are different:

produce a list (of files and sub-folders) by
using 'ls' NOT 'dir’ at the prompt
Navigating the Unix File
System

To make the list more readable, try ls Fla
 -a shows files which start with a period (for
example: .Xclients-default)
 -l displays file permissions and displays everything
in neat columns
 -F adds a / after a directory and a * after an
executable file

Use pwd (print working directory) to find out
which directory is “current”
Other Linux info

General site:
 www.linux.org
 www.ubuntu.com

Commercial versions:
 www.redhat.com
 www.suse.com
 www.mandrakelinux.com


Check out www.linuxlinks.com
If you want more interesting yet simple and
easy-to-understand tutorials
 check out http://blacksun.box.sk.