44
ULSTER COUNTY COMMUNITY COLLEGE CIS 116 Linux (Part 1) Karl Wick

ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Embed Size (px)

Citation preview

Page 1: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

ULSTER COUNTY COMMUNITY COLLEGE

CIS 116 Linux (Part 1)

Karl Wick

Page 2: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (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

Page 3: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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.

Page 4: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Advantages and disadvantages of LINUX

Page 5: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Advantages of LinuxThe most popular FREE Operating SystemMulti-user and Multi-tasking OSOpen Source FlexibilityWide, informal community of supportCan read and write to MSDOS file systemStability Crashes are isolatedSecurityEfficient use of HardwareMultiboot and OS Emulation

Page 6: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Disadvantages

Lack of formal Technical SupportSome hardware incompatibilities Less software availabilityLack of user familiarity

Page 7: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

bash (Bourne again shell)

The default for Red Hat Linux.There are many command interpreters

for Linux. One early shell was called Bournebash is a newer version of Borne and is

the default shell for many distributions of Linux, including Red Hat.

Page 8: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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)

Page 9: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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 MS-DOS prompt OR the dd utility on a Unix system.

Page 10: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

A boot loader from MS-DOS

Open an MS-DOS windowInsert floppy into A: and CD#1 into D:Type …

C:> d:D:> \dosutilsD:\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

Page 11: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

A boot loader from Unix

Insert the floppy but do NOT mountInsert and mount the CD ROM #1change to directory containing the imagecd /dosutilscopy the image to the floppy diskdd if=boot.img of=/dev/fd0 bs=1440k

Page 12: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

It is possible to boot directly from the CDROM on some

newer machines

Page 13: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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

Page 14: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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.

Page 15: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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)

Page 16: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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

Page 17: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

IMPORTANT NOTE

If installing as a dual boot with windows NT, you must refer to the document at

http://www.linuxdoc.org/HOWTO/mini/Linux+NT-Loader.html for instructions.

You cannot install Linux on the MBR or NT will be lost.

Page 18: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Making the right decisions

Follow the handout for installing Red Hat

Loading Linux.docYou should

perform a workstation class installation.Password password (lower case!)Make boot disk if you have a blank floppy

availablePCI probe OKDo NOT auto start X

Page 19: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Display, etc.

Dell super VGA (plain version) Monitor32 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.

Page 20: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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).

Page 21: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Network settings

It is best to use the settings listed for your workstation.

Page 22: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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 …)

Page 23: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Where have we been?

The installer will save installation information in a file called /tmp/install.log

Page 24: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Using Linux

Note: We will be working with the standard text interface

Page 25: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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 /]#

Page 26: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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.

Page 27: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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>

Page 28: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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

Page 29: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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.

Page 30: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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.

Page 31: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Changing from GUI boot to Text boot and back

For those who didn’t follow directions.You must edit the /etc/inittab fileView the file with more /etc/inittabOn the first page you will see some comments

(begin with #) and thenid: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 !!!

Page 32: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Where is the floppy?

It is hiding or asleep

Where is the CD ROM?

It is also hiding or asleep

Page 33: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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

Page 34: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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 againmount –t type device dir is the generic

form of the command

Page 35: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Mounting devices

Page 36: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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

Page 37: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

Mounting a Floppy Disk

(RH 6.0) mount /dev/fd0 /mnt/floppy

(RH 7.1) mount /dev/fd0( to /mnt/floppy is assumed)

Page 38: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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

Page 39: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

umount

umount /mnt/floppy dismounts the floppy disk umount /mnt/cdrom dismounts the CDNote: 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.

Page 40: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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

Page 41: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

RH7.1 Creating a Boot Floppy

Log in to the shell as root.If your prompt is $ then you are not rootType 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

Page 42: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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 floppyType mkfs –t ext2 /dev/fd0 1440 <enter>

Low level format the floppyType fdformat /dev/fd0 <enter>

Make it bootabledd if=/boot/vmlinuz-2.2.5-15 of=/dev/fd0 <enter>

use the kernel name found in step one(Also see text pg 285)

Page 43: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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 filedd 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)

Page 44: ULSTER COUNTY COMMUNITY COLLEGE CIS 116Linux (Part 1) Karl Wick

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.