0% found this document useful (0 votes)
10 views

COMP 201 OpenSource L2 SampleInstallation1

Uploaded by

michellesparks
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

COMP 201 OpenSource L2 SampleInstallation1

Uploaded by

michellesparks
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 59

COMP 201 OPEN SOURCE &

SYSTEM ADMINISTRATION
DANIEL OBUOBI
SAMPLE INSTALLATION DEMO
Linux Distributions,
Installation, Partitioning

September 2008

2
What constitutes “Linux”?
• “Linux” is a “Kernel”.
– Core of an operating system, a kernel manages the
machine’s hardware resources (including the processor
and the memory), and provides and controls the way any
other software component can access these resources.
The kernel runs with a higher privilege than other
programs (so-called user-mode programs). The power and
robustness of an OS's kernel play a major role in shaping
overall system design and reliability.
www.symbian.com/technology/glossary.html

3
What constitutes a “Distribution”?
• Kernel is not enough, need programs to use it.
• Distribution is a collection of everything
needed to run a Linux Kernel and do useful
things with it:
– Installation and Configuration Utilities
– Software Packages
– Linux Kernel

4
What Distributions are there?
• Large number (linux.org lists more than 100 English-
based distributions)
• Some common ones:
– Fedora Core
– RedHat Enterprise
– SuSE Linux
– Mandrake
– Debian
– Slackware

5
Availability of Distributions
• Purchasing CD/DVDROM’s
– Most (if not all) distributions will offer a purchasable
CDROM/DVDROM set.
– Most expensive way of purchasing a Linux OS
– Often includes a level of support or access to support
• Downloading off Internet
– GPL requires that source code be available
– Can take a while to download (some distro’s have 5-6 CD images or a
DVD image to download)
• Third Party CD’s
– Due to licensing via GPL, third parties can also sell cheap versions of
the CD’s.

6
General steps in installations
• Boot off Install CD
• Partition and format Hard Disks
• Select packages to install
• Networking Configuration
• Time zones, Basic User configuration
• Peripheral setup (if any)
• LILO and booting options
• Boot the newly installed host and configure
applications

7
Hardware Required
• Linux has fairly modest installation requirements
– Can be installed on any Intel Pentium based system, but
may not work overly fast
• Most current distributions require a couple of GB for
the system installation (can be trimmed down if
necessary by not installing unnecessary packages)
– Eg. RedHat recommends 2GB or more but will install into
400Mb.
• Most requirements centre around what you will use
the installation for.

8
Booting the Linux Kernel
• Mostly, booting a Linux install involves booting
a CD. Most modern PC’s can handle this so
long as they have a CD/DVDROM drive
installed.
• Other methods:
– Booting off a network (requires support from
network interface – most will do this)
– Booting off floppy disks (required when CD boot
doesn’t work or is unavailable)

9
Partitioning the Hard Disk
• Partitions:
– / (The “Root” filesystem)
• (Can also create /boot as an optional addition)
• Houses kernel, boot scripts, system configuration, etc.
• Often about 1-200 meg in size
– /usr
• Houses User utilities
• Often 2-3 GB required.
– /var
• Houses temporary (“Variable”) files, logs, runtime stuff.
• Allocate 1-2GB (more if can be spared)

10
Partitioning the Hard Disk (2)
– /opt
• Houses optional packages
• Some Linux installations don’t make use of it at all.
• Slackware and SuSE use it for Gnome and KDE packages
• 1-2 gig min, if the Distribution requires it.
– /home
• Houses user data
• Size should be dependant on storage needs of users and how many users
on the system.
• Other Filesystems
– /tmp – Stores temporary data
– /proc – Created by the system, interface to memory and kernel.

11
Filesystem Choice
• Linux supports a lot of different filesystems:
– “Normal” filesystems
• Write data directly to disk and handle allocation
• Often require lengthy repair processes in the event of a system
crash.
• Primary example: ext and ext2
– Logging filesystems
• Borrows from database technology, Providing a “journal” of most
recent data written to the filesystem.
• Journal is used to speed up recovery when filesystem is corrupted.
• Has more work to do compared to non-journalled filesystems.
• Examples: Ext3, ReiserFS, XFS, JFS.

12
Ext2/3
• One of the original Linux Filesystem formats.
• Ext2 has been the default filesystem on most
Linux installations
• Ext3 adds journaling support to the Ext2
filesystem.
• Considered a low-performance filesystem by
comparison to others

13
ReiserFS
• One of the first journaling filesystems to appear on
Linux
• Journals meta-data (inodes)
– Patches exist to do full journaling, but is considered
unstable.
• Version 4 of the filesystem is soon to be released –
will support theoretical max. up to 17Tb files on IA32
systems, near 260 for 64 bit systems (~1 exabyte).
• See http://www.namesys.com/ for more info.

14
XFS and JFS
• XFS (http://oss.sgi.com/projects/xfs)
– XFS is developed by SGI and is ported to Linux from IRIX.
– Extremely fast filesystem using journaling and BTrees to
handle large scale filesystems (theoretical max. of 263 bytes
file size ~8 exabytes)
• JFS (http://oss.software.ibm.com/jfs)
– Developed by IBM
– Extent-based filesystem with theoretical max. filesystem
size of 4 petabytes (~250 bytes) when using a 4Kb Block size
for the filesystem.

15
LVM
• Subsystem within Linux to provide greater flexibility with
filesystems.
• Partitions on disks are fixed in size, this allows partitions to
grow and (where the filesystem allows it) shrink as needed.
– ReiserFS and Ext2/3 support filesystem shrinking.
– All common Unix filesystems can grow.
• LVM’s can span multiple disks as a disk concatenation.
• Some Linux installations (SuSE, RedHat, etc.) can use LVM’s for
system partitions at the time of install

16
RAID
• Redundant Array of Independent Disks
• A means of using multiple disks to improve performance and stability.
• Works on the underlying idea that individual disks are likely to break down
• 8 levels of RAID: (Only 4 are commonly used)
– Non-redundant Striping (RAID 0) (Least expensive–not really RAID)
– Mirroring of data (RAID 1)
– Hamming Code ECC (RAID 2) (not commercially viable)
– Parallel transfer with parity (RAID 3) (very resource intensive)
– Independent Data disks with shared Parity disk (RAID 4) (poor write performance)
– Independent Data disks with distributed parity (RAID 5)
– Independent Data disks with dual distributed parity (RAID 6) (poor performance
compared to RAID 5)
– Optimized Asynchrony (RAID 7) (proprietary system – Requires UPS)
• For more details, read http://www.acnc.com/04_00.html

17
Non-Redundant Striping
(RAID 0)
• RAID 0 simply places splits the data across
multiple disks
• By itself it provides no redundancy. Requires
backups to recover from a failure.
• All “stripes” must be of equal size.
• Can provide an improvement in read and write
performance

18
Mirroring (RAID 1)
• Put simply, this method of RAID makes a
mirrored copy of the data
• Provides a full copy, so fully redundant across
disks.
• Reading is faster, as there are multiple copies
of the data
• Writing is slower, as there are multiple copies
that need to be written.

19
Combining RAID 0 and 1 for
full redundancy
• RAID 1 provides full redundancy, but combining it
with striping speeds the process up.
• Requires twice the number of disks as striping (min. 4
disks)
• Gives full redundancy (So long as one copy of data is
unaffected, data is OK.)
• Why not mirror then stripe?
– Can only afford a single drive failure
– Has same overhead as mirroring
– As good as RAID 5 but with nearly twice the disks.

20
Parity (RAID 5)
• Uses an XOR parity check to allow reconstruction of
data.
• Parity is split across all disks so that any disk can fail
and the data on it can be reconstructed.
• Provides good throughput with a single disk
redundancy.
• RAID 6 varient uses 2 separate parity checks.

21
Introduction to Packages
• What is a package?
– A package is a single application put into a neat group that
can be installed and uninstalled by a package manager.
• Why is this good?
– Easier to get software you need installed
• Why is this bad?
– You have no control over compile-time options, only
runtime. (Most distributions try to make the compile time
options as flexible as possible, but this can have an effect
on performance)

22
Package Selection
• Depends on what the host will be doing
– Mail servers?
– Web Servers?
– X Windows? KDE? Gnome?
• Make sure you have allocated enough space in /usr
(and possibly /opt) to handle whatever packages you
are going to install with some overhead (Ideally disk
space usage should be no more than say 60% on any
partitions after install, depending on how much
space you allocated)

23
The Intel Arch. Boot process
• Machine switched on, load BIOS
• Depending on BIOS configuration, attempt to locate
boot record (aka. Master Boot Record) from Floppy
disk, CDROM or hard disk.
• MBR has bootstrapping code to load Operating
System (in this case – a Linux Kernel)
• Linux boot process takes over from this point.

24
Places to load Linux from
(i386)
• Master Boot Record – located on primary master disk
– Custom boot process (Eg. LILO or GRUB) installed on MBR
• Boot floppy or CDROM
– Often slower to load
• Floppy with boot sector only, linking to kernel on
other media.
– Handy to have as a recovery disk.

25
LILO, GRUB, etc.
• After installing packages, you will need to make the
system bootable.
• Linux provides two boot managers for this purpose:
– LILO (Linux Loader)
– GRUB (Grand Unified Bootloader)
• Both are capable of booting Linux.
• Grub is possibly more useful if booting other
operating systems (dual boot systems)

26
Basic Network Config
• Generally, networking configuration is
optional at time of install, unless you are
doing a remote installation.
• Often installers will allow you to either specify
an IP address for each interface, or read IP
address information off DHCP
• DHCP, IP addresses, etc. will be covered later
(networking sections of the course)

27
Timezones, UTC, etc.
• You will need to set a timezone for your host.
– Be as descriptive and accurate about the location as possible.
– Eg. Setting to Australia/Melbourne instead of Australia/Victoria, as
there may be small differences you may not know about.
• Setting clock to UTC or local time?
– UTC time will allow multiple timezones to be easily handled within the
Linux OS.
– Users can see the time for their specific timezone
• Considerations for using UTC or local time
– Is the host dual boot? (Running Linux and what else?)
– Can all hosts handle the CMOS clock at UTC? If so, do that.

28
First topics:
• Unix birds-eye overview
• Partitioning
• Linux installation
Kernel
 The "core" of the operating system
 Device drivers
 communicate with your hardware
 block devices, character devices, network devices,
pseudo devices
 Filesystems
 organise block devices into files and directories
 data structure that allows data on a disk to be
organised and accessed by the user
 Memory management
 Timeslicing (multiprocessing)
 Networking stacks - esp. TCP/IP
 Enforces security model
Shell
• Command line interface for executing programs
– DOS/Windows equivalent: command.com or
command.exe
• Choice of similar but slightly different shells
– sh: the "Bourne Shell". Standardised in POSIX ($ prompt)
– csh: the "C Shell". Not standard but includes command
history (% prompt )
– bash: the "Bourne-Again Shell". Combines POSIX
standard with command history. But distributed under
GPL (more restrictive than BSD licence)
Shell
– tcsh: "Tea Sea Shell", often used in the Linux
environment and contains useful attributes such
as 'up-arrow' and 'down-arrow' recall of previous
command entries, and the use of the TAB key to
complete commands

– Check your shell : # echo $SHELL


– Change your shell: # chsh /bin/bash
– The shell interprets commands with the
operating system kernel.
User processes
• The programs that you choose to run
• Frequently-used programs tend to have short cryptic
names
– "ls" = list files
– "cp" = copy file
– "rm" = remove (delete) file
• Lots of stuff included in the base system
– editors, compilers, system admin tools
• Lots more stuff available to install too
– packages / ports
System processes
• Programs that run in the background; also
known as "daemons"
• Examples:
– cron: executes programs at certain times of day
– syslogd: takes log messages and writes them to files
– inetd: accepts incoming TCP/IP connections and
starts programs for each one
– sshd: accepts incoming logins
– sendmail (other MTA daemon like Exim): accepts
incoming mail
Security model
• Numeric IDs
– user id (uid 0 = "root", the superuser)
– group id
– supplementary groups
• Mapped to names
– /etc/passwd, /etc/group (plain text files)
– /etc/shadow (encrypted password file)
• Suitable security rules enforced
– e.g. you cannot kill a process running as a different
user, unless you are "root"
Filesystem security
• Each file and directory has three sets of
permissions
– For the file's uid (user)
– For the file's gid (group)
– For everyone else (other)
• Each set of permissions has three bits: rwx
– File: r=read, w=write, x=execute
– Directory: r=list directory contents, w=create/delete
files within this directory, x=enter directory
• Example: brian wheel rwxr-x---
Filesystem security
• The permission flags are read as follows (left to right)
• -rw-r--r-- for regular files,
• drwxr-xr-x for directories

2,3,4 read, write, execute permission for User (Owner) of file

5,6,7 read, write, execute permission for Group

8,9,10 read, write, execute permission for Other

Value Meaning

- in any position means that flag is not set

r file is readable by owner, group or other

file is writeable. On a directory, write access means you can add or


w
delete files

file is executable (only for programs and shell scripts - not useful for
x data files). Execute permission on a directory means you can list the
files in that directory
in the place where 'x' would normally go is called the set-UID or set-groupID
s
flag.
Key differences to Windows
• Unix commands and filenames are CASE-SENSITIVE
• Path separator: / for Unix, \ for Windows
• Windows exposes a separate filesystem tree for each
device
– A:\foo.txt, C:\bar.txt, E:\baz.txt
– device letters may change, and limited to 26
• Unix has a single 'virtual filesystem' tree (tree
structure with a top directory called the root and
noted " / ")
– /bar.txt, /mnt/floppy/foo.txt, /cdrom/baz.txt
– administrator choses where each FS is attached
– Don't need to know disk layout/ partitioning scheme e.g. C:\, D:\
Standard filesystem layout
/bin essential binaries
/boot kernel and modules
/dev device access nodes
/etc configuration data
/etc/defaults configuration defaults
/etc/rc.d startup scripts
/home/username user's data storage
/lib essential libraries
/sbin essential sysadmin tools
/stand recovery tools
/tmp temporary files
/usr progs/applications
/var data files (logs, E-mail
messages, status files)
Standard filesystem layout (cont)
/usr
/usr/bin binaries
/usr/lib libraries
/usr/libexec daemons
/usr/sbin sysadmin binaries
/usr/share documents
/usr/src source code
/usr/local/... 3rd party applications
/usr/X11R6/... graphical applications
/var
/var/log log files
/var/mail mailboxes
/var/run process status
/var/spool queue data files
/var/tmp temporary files
Standard filesystem layout (cont)

Src:
ei.cs.vt.edu

Directories (branches) contains either files or subdirectories (branches of branches).


Directories are analogous to DOS subdirectories.
File system is normally viewed as inverted (upside down) tree.
* highest level directory = root '/'
* user's current dir is the "working directory" by default => /usr/home/username
Why like this?
• It's good practice to keep /usr and /var in separate
filesystems in separate partitions
– So if /var fills up, the rest of the system is unaffected
– So if /usr or /var is corrupted, you can still boot up the
system and repair it
• That's why we have a small number of essential
tools in /bin, /sbin; the rest go in
/usr/bin and /usr/sbin
• Third-party packages are separate again
– /usr/local/bin, /usr/local/sbin, /usr/local/etc ...
A note about devices
• e.g. /dev/hda = the first ad (ATAPI/IDE disk)
• In LINUX, entries for each device under /dev
are created dynamically
– e.g. when you plug in a new USB device
• Some "devices" don't correspond to any
hardware (pseudo-devices)
– e.g. /dev/null is the "bit bucket"; send your data
here for it to be thrown away
Some reminders about PC architecture

• When your computer turns on, it starts a


bootup sequence in the BIOS
• The BIOS locates a suitable boot source
(e.g. floppy, harddrive, CD-ROM, network)
• The very first block is the MBR (Master Boot
Record)
• The BIOS loads and runs the code in the
MBR, which continues the bootup sequence
Partitioning
• The MBR contains a table allowing the disk to
be divided into (up to) four partitions
• Beyond that, you can nominate one partition as
an "extended partition" and then further
subdivide it into "logical partitions"
• LINUX has its own partitioning system, because
Unix predates the PC
• LINUX recognises MBR partitions, but calls them
"slices" to avoid ambiguity
LINUX partitions
• Partitions (usually) sit within a slice
• Partitions called 1,2,3,4
• CANNOT use 'c'
– for historical reasons, partition 'c' refers to the
entire slice
• By convention, 'a' is root partition and 'b' is
swap partition
• 'swap' is optional, but used to extend capacity
of your system RAM
MBR
Simple Single
partitioning:
slice /dev/hda
/dev/hda

hda1 hda2 hda3 hda4 hda5

/ swap /var /tmp /usr

/ (root partition) hda1 256MB


swap partition hda2 ~ 2 x RAM
/var hda3 256MB (+)
/tmp hda4 256MB
/usr hda5 rest of disk
'Auto' partition does this:
• Small root partition
– this will contain everything not in another partition
– /boot for kernel, /bin, /sbin etc.
– Home directories are /home/<username>
• A swap partition for virtual memory
• Small /tmp partition
– so users creating temporary files can't fill up your root
partition
• Small /var partition
• Rest of disk is /usr
Issues
• /var may not be big enough
• /usr contains the OS, 3rd party software,
and your own important data
– If you reinstall from scratch and erase /usr, you
will lose your own data
• So you might want to split into /usr and /u
– Suggest 4-6GB for /usr, remainder for /u
Core directory refresher
• / (/boot, /bin, /sbin, /etc, maybe /tmp)

• /var (Log files, spool, maybe user mail)


• /usr (Installed software and home dirs)
• Swap (Virtual memory)
• /tmp (May reside under “/”)
d

Don't confuse the the “root account” (/root)


with the “root” partition.
Note...
• Slicing/partition is just a logical division
• If your hard drive dies, most likely everything
will be lost
• If you want data security, then you need to
set up mirroring with a separate drive
– Another reason to keep your data on a separate
partition, e.g. /u
– Remember, “rm -rf” on a mirror works very
well.
Summary: block devices
• IDE (ATAPI) disk drives
– /dev/hda
– /dev/hdb ...etc
• SCSI or SCSI-like disks (e.g. USB flash, SATA)
– /dev/da0
– /dev/da1 ...etc
• IDE (ATAPI) CD-ROM
– /dev/cdrom0 ...etc
• Traditional floppy drive
– /dev/fd0
• etc.
Summary
• Slices • BSD Partitions
– /dev/ad0s1 – /dev/ad0s1a
– /dev/ad0s2 – /dev/ad0s1b
– /dev/ad0s3 – /dev/ad0s1d ...etc
– /dev/ad0s4 – /dev/ad0s2a
• Defined in MBR – /dev/ad0s2b
• What PC heads call "partitions" – /dev/ad0s2d ...etc
• Conventions:
– 'a' is /
– 'b' is swap
– 'c' cannot be used
Installing LINUX
• Surprisingly straightforward
• Boot from CD or floppies
• Partition your disk
– Can delete existing partitions(s)
– Create a LINUX partition
• Partition
• Choose which parts of LINUX distribution you want,
or "all"
• Install from choice of media
– CD-ROM, FTP, even a huge pile of floppies!
Installing Software in Linux
• Several different methods
– packages
– source
– binary
• We will go in to detail on these methods
later.
How Does LINUX Start?
• The BIOS loads and runs the MBR
– The MBR is not part of LINUX

• A series of "bootstrap" programs are loaded


– see “man boot”
Exercise find the bootstrap steps of
booting up Linux

• Kernel is loaded, and perhaps some modules


– controlled by /boot/grub/grub.conf
How Does LINUX Start?
• The root filesystem is mounted
– “root” = “/” or something like “hda1”

• /sbin/init is run and executes the main


startup script /etc/init.d

• This in turn runs other scripts


/etc/rc(X).d/*
Finding more information
• Our reference handout
– a roadmap!
• man pages
– esp. when you know the name of the command
• www.redhat.org
– handbook, searchable website / mail archives
• comp.unix.shell FAQ
– http://www.faqs.org/faqs/
by-newsgroup/comp/comp.unix.shell.html
• STFW (Search The Friendly Web) - Google..

You might also like