Chapter_L1-Loading_Linux
Download
Report
Transcript Chapter_L1-Loading_Linux
ULSTER COUNTY
COMMUNITY COLLEGE
CIS 116
Linux (Part 1)
Karl Wick
What is LINUX?
LINUX is an operating system.
LINUX is a dialect of the UNIX system, which
has been popular on main frame computers for
decades.
Every file in LINUX is considered a text file
unless otherwise specified.
UNIX is case sensitive.
Filenames up to 256 characters.
LINUX now has a GUI available
The Shell Prompt vs GUI
It is worthwhile to learn how to work from a shell
prompt, because using commands via the shell
prompt can be quite fast.
In the time it might take you to open the file
manager in a GUI, locate a directory, and then
create, delete, or modify files, you could have
finished your work with several commands from
a shell prompt.
Some tasks simply cannot be performed in a GUI.
On Average, a GUI also uses over ¾ of your
system resources.
Advantages and disadvantages
of LINUX
Advantages of Linux
The most popular FREE Operating System
Multi-user and Multi-tasking OS
Open Source Flexibility
Wide, informal community of support
Can read and write to MSDOS file system
Stability Crashes are isolated
Security
Efficient use of Hardware
Multiboot and OS Emulation
Disadvantages
Lack of formal Technical Support
Some hardware incompatibilities
Less software availability
Lack of user familiarity
bash (Bourne again shell)
The default for Red Hat Linux.
There are many command interpreters
for Linux.
One early shell was called Bourne
bash is a newer version of Borne and is
the default shell for many distributions
of Linux, including Red Hat.
Loading LINUX
Note: You will need about 2GB of free
space on your hard drive to load Linux
7.1 (They say 1.2 GB - marginal)
Making a boot loader floppy
You will need a special floppy disk to begin
loading the Linux OS onto your hard drive.
A bootloader disk is created by transferring an
“image” file onto the floppy.
You need a blank formatted floppy and an MSDOS prompt OR the dd utility on a Unix system.
A boot loader from MS-DOS
Open an MS-DOS window
Insert floppy into A: and CD#1 into D:
Type …
C:> d:
D:> \dosutils
D:\dosutils> rawrite *
Enter Disk image … ..\images\boot.img *
Enter Target diskette drive: a:
Press <enter> and wait.
* try rawrite –f ..\images\boot.img –d a
A boot loader from Unix
Insert the floppy but do NOT mount
Insert and mount the CD ROM #1
change to directory containing the image
cd /dosutils
copy the image to the floppy disk
dd if=boot.img of=/dev/fd0 bs=1440k
It is possible to boot directly
from the CDROM on some
newer machines
Booting with the CD from pure
DOS x86 based machines
NOTE: Windows CANNOT be running!
NOTE: We assume that CDROM is D:
Type the following commands …
C:> d:
D:> cd \dosutils
D:\dosutils> autoboot.bat
Installing Linux
Insert the boot loader floppy or CDROM
and reboot the computer.
The computer should read the floppy and
may prompt you for input.
Often the default choice is the best, but
NOT ALWAYS!
Insert the Redhat installation CD when
asked and read the screens carefully.
Installing Linux
In the classroom you should not have to
partition the hard disk before installation.
At home you may have to run FDISK
before installing version 6.0
When installing or upgrading to version
7.1, Disk Druid may run automatically to
partition the hard drive.
(Disk Druid is built into version 7.1)
Best Partitioning
/boot 16 megabytes
/swap from same as RAM size up to
127megabytes (more is unused)
/ (root) taking up the remainder of the disk.
For a server class install you may want to add
/usr
512+ megabytes
/home 512+ megabytes
/var
256+ megabytes
IMPORTANT NOTE
If installing as a dual boot with windows
NT, you must refer to the document at
http://www.linuxdoc.org/HOWTO/mini/Li
nux+NT-Loader.html for instructions.
You cannot install Linux on the MBR or
NT will be lost.
Making the right decisions
Follow the handout for installing Red Hat
Loading Linux.doc
You should
perform a workstation class installation.
Password password (lower case!)
Make boot disk if you have a blank floppy
available
PCI probe OK
Do NOT auto start X
Display, etc.
Dell super VGA (plain version) Monitor
32 bits per pixel, 1024 x 768 resolution (use the
default settings which should be these)
generic video card with proper RAM (watch
boot screen),
Mouse and keyboard. We can change these later
on.
Make a root and a student
account
For regular use you should be logged on as a
normal user. A good account name is ‘student’.
We can all remember it.
For system configuration and maintenance we
also need a root account.
While a root account is required by Linux, it is
too dangerous to use it routinely. (Too much
chance to mess up the system).
Network settings
It is best to use the settings listed for your
workstation.
BOOT into TEXT mode
Do NOT auto start X
Do NOT auto start X
Do NOT auto start X
Recovering from not paying attention to this
advice; (Click Here) (Or wait 9 slides …)
Where have we been?
The installer will save installation
information in a file called
/tmp/install.log
Using Linux
Note: We will be working with the
standard text interface
The login screen and the login
process
After a proper installation, the computer
will reboot and bring you to a login
screen.
For now login as root and provide your
password (‘password’).
If you are successful you will see a
prompt similar to [root@localhost /]#
Shutting down
Just like for Windows, an orderly
shutdown is important for Linux.
There are cache files to clear (data to
write back to disk too) and processes that
should be ended in a particular order.
Let us look at several ways of properly
shutting down.
Shutting Down
reboot Linux will shut down all services
and reboot the computer now.
halt
Linux will shut down all services
and stop the computer now.
shutdown [-t sec] [-arkncfF] time [msg]
<ctrl-alt-del>
The shutdown Command
shutdown [-t sec] [-arkhcfF] time [msg]
Will display a message and then shutdown after time
minutes go by.
-t = wait after killing processes before reboot
-h = halt
-r = reboot
-c = cancel shutdown now
time = hh:mm (absolute), +m (minutes from now)
shutdown –r now
Shutdown with <ctrl-alt-del>
The <ctrl-alt-del> key combination is
usually “trapped” and an action taken in
the file /etc/inittab is executed.
Here is a typical entry in the file:
#Trap CTRL-ALT-DELETE (a comment)
ca::ctrlaltdel:/sbin/shutdown –t3 –r now
Root can change this entry.
Some basics
Linux is CASE SENSITIVE!
The Linux text interface is not very
intuitive.
All you will see is a prompt showing your
computer name and a path.
A # prompt means that you are root.
A $ prompt means that you are a regular
user.
Changing from GUI boot to
Text boot and back
For those who didn’t follow directions.
You must edit the /etc/inittab file
View the file with more /etc/inittab
On the first page you will see some comments
(begin with #) and then
id:5:initdefault
(level 5 is the GUI)
change it to id:3:initdefault using a text editing
program. (level 3 is the text interface)
Caution!!! Use values of 1,2,3,5 ONLY !!!
Where is the floppy?
It is hiding or asleep
Where is the CD ROM?
It is also hiding or asleep
By The Way
The disk, not the drive is the device!
Each device needs to be mounted before
being accessible to the system.
Mount is a built in function
mount
All files accessible in Unix are arranged
in a single large tree structure rooted at /
mount will attach the file system on a
device to this tree.
umount will detach it again
mount –t type device dir is the generic
form of the command
Mounting devices
Using mount for the CD
Some device labels are defined at bootup.
type more /etc/fstab for labels defined at
bootup)
(RH6.0) mount -t is09660 -r /dev/cdrom
/mnt/cdrom
(RH 7.1) mount /dev/cdrom (to
/mnt/cdrom is assumed
Mounting a Floppy Disk
(RH 6.0) mount /dev/fd0 /mnt/floppy
(RH 7.1) mount /dev/fd0
( to /mnt/floppy is assumed)
Using mount alone
The mount command with no parameters
shows all mounted devices
/dev/hda6 on / type ext 2 (rw)
/dev/hda1 on /boot type ext2 (rw)
/dev/hdb5 on /tmp type ext2 (rw)
/dev/hdc on /mnt/cdrom type iso9660 (…)
etc
umount
umount /mnt/floppy dismounts the floppy disk
umount /mnt/cdrom dismounts the CD
Note: When removable media such as a CD is
mounted, the eject function of the drive is
disabled until the device is un-mounted.
This is NOT true for floppy disks and ejecting
them without invoking umount can cause
logical problems! The system thinks that the
disk is still available. Data may be lost.
Creating a boot floppy
Note: This is not a boot loader. It is a
boot floppy for an already installed
system. This is useful if the MBR of the
hard drive becomes corrupted or you
choose not to install LILO on your hard
disk. It is also useful if you are testing a
new kernel
RH7.1 Creating a Boot Floppy
Log in to the shell as root.
If your prompt is $ then you are not root
Type uname –r - This will display the
kernel version. (ex: 2.4.x-yy) Note it.
Type mkbootdisk –device
/dev/fd0 2.4.x-yy (your kernel)
and <enter>
Note: Two dashes before device
RH6.0 Creating a Boot Floppy
Find vmlinuz (the kernel file) (should be on /boot)
Type find / -name vmlinuz* <enter> Write it down
Create file system on floppy
Type mkfs –t ext2 /dev/fd0 1440 <enter>
Low level format the floppy
Type fdformat /dev/fd0 <enter>
Make it bootable
dd if=/boot/vmlinuz-2.2.5-15
of=/dev/fd0 <enter>
use the kernel name found in step one
(Also see text pg 285)
Copying a floppy disk
The dd command can copy an entire disk to an
identical disk. The destination disk must be
formatted first.
Copy the contents of the floppy to a file
dd if=/dev/fd0 > floppy.copy
(or of= floppy.copy)
Swap disks and copy the file to the new disk
dd if=./floppy.copy of=/dev/fd0
(see text pg 287)
Conclusion
This Chapter Got Us Started by Loading
the System and Giving Us a Quick
Overview of the Seemingly Complex
Nature of Linux.
In the Next Chapter We Will Start to
Learn Some of the Secret Incantations
That Make the OS Do Our Bidding.