Presentation10

Download Report

Transcript Presentation10

COMP2221
Networks in Organisations
Richard Henson
April 2012
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 Code

“Open source” pre-dates the OSI model
fitted with a scientific model of information
sharing

Software takes time and effort to
develop…
not charging for software developed was
an alien concept for businesses at that
time…
Origins

Richard Stallman
 Graduated from Harvard in
1974 with a BA in physics
 staff hacker at the MIT
Artificial Intelligence Lab,
learning operating system
development by doing it
 Wrote the first extensible
Emacs text editor there in
1975
 free' means 'freedom', not
zero cost
http://stallman.org/
GNU software

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 free
 freely available via the Internet
 not many had access in 1984…

Free so anyone with good programming
experience could further develop the code if
they wished
 submitted to a central committee, for consideration
at the next upgrade
 constantly updated and improved
The final success of GNU

GNU project completed in 1992
 worldwide collaboration of geeks had perfected
Unix
 and finally created… Linux
» Free Unix on the PC!!!
Structure of Unix

Layered from the early days
 enabled hardware (platform) to function
independently of user interface

Most basic implementations, just
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 (and “C”)
 Used for interprocess communication
(IPC)

enabled client-server computing
link standard input and output processes
(stdio in “C” programs)
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

User process
created by the login program (cf Windows
network login)
» user input: username/password
» checks the username and password
» If OK starts a new “shell”
 represents the user’s interface with the UNIX
system kernel
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
“Shell interface (CLI)

Logon generates a command line interpreter
(CLI) process
 sets up the Unix prompt (usually $)
 interprets any commands the user types in
 arranges for them to be carried out via the kernel
Many commands are actually subroutines
built in to the shell program and run within
that process
More about
Command Line Interpreters

Simple loop:
 accepts command
 interprets command
 executes command
» displays output data as appropriate
displays e.g. $ "prompt“
 waits for another command…

Only means of human-computer interaction
before WIMP (i.e. Windows)
Unix Shell commands

If 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
Unix Syntax

Unix is case sensitive !!!

Each command consists of:
a command name <space>
command options (if any) <space>
command arguments (if any)
Shell and Kernel
Intercommunication

E.g. User keys in 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
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!
Unix on a PC

Available long before Linux!!

First achieved in the late 1980s by SCO
(Santa Cruz Operations)
Quite expensive (certainly not following
GNU principles!)
Limited range of applications
Offered good file security and multi-user
functionality (in contrast to DOS!)
Linux

The output from Stallman’s GNU project…
 unlike SCO Unix, software IS freely available via
the Internet

Development started in 1991 to develop a PC
kernel from Tsnenbaum’s open source GNU
software: '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
Downside to “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...
 needs to be compiled
 is really intended for the Unix expert

Stable current version of Linux Kernel is 3.3.2
 available from www.kernel.org

Developments constantly evolving:
 version 3.4 undergoing testing

“Ubuntu” is ready to go: African word,
'Humanity to others‘
 “free” disk or download http://www.ubuntu.com/
Commercial free-ish
Versions of Linux

Redhat… messy legal battles!
Now doing OK, saved Novell
www.redhat.com

SuSE
now 13000 business users www.suse.com

Mandrake http://www.mandriva.com/en/
recommended - see later slides
even Mandrake 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

Novell acquired Unix in 1993 from
USL
marketed it in Novell boxes as
“Unixware”
sold it in 1995 to SCO, but SCO
misused the agreement…
» 1999 Netware failed; merged with Redhat
» 2003-10 court case with SCO over Redhat
» verdict: copyright belonged to Novell!
Cut-down Linux

Trinux!


Linux distribution on 2 Mbytes
Full implementation of 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)
More powerful than X-windows (GUI)...
 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