51
Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Embed Size (px)

Citation preview

Page 1: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, Second Edition

Chapter 9System Initialization

and X Windows

Page 2: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 2

Objectives

• Summarize the major steps necessary to boot a Linux system

• Configure the LILO and GRUB boot loaders

• Dual boot Linux with the Windows OS using LILO, GRUB, and NTLOADER

• Understand how the init daemon initializes the system at boot time into different runlevels

Page 3: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 3

Objectives (continued)

• Configure the system to start daemons upon system startup

• Explain the purpose of the major Linux GUI components: X Windows, Window Manager, and desktop environment

• List common Window Managers and desktop environments used in Linux

• Configure X Windows settings using various Linux utilities

Page 4: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 4

The Boot Process

• POST: Series of tests run when computer is turned on – Ensures functionality of hardware

• MBR: Defines partitions and boot loader – Normally located on first HDD sector

• Boot loader: Program used to load an OS• MBR might contain pointer to a partition containing

a boot loader on the first sector• Active partition: Partition pointed to by MBR

– One per HDD

Page 5: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 5

The Boot Process (continued)

• /boot: Directory containing kernel and boot-related files

• Vmlinuz-<kernel version>: Linux kernel file• Daemon: System process that performs useful

tasks– e.g., printing, scheduling, OS maintenance

• Init (initialize) daemon: First process started by Linux kernel– Loads all other daemons– Brings system to usable state

Page 6: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 6

The Boot Process (continued)

Figure 9-1: The boot process

Page 7: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 7

Boot Loaders

• Primary function: Load Linux kernel into memory

• Other functions:– Passing information to kernel– Booting another OS

• Two most common boot loaders:– Linux Loader (LILO)– GRand Unified Boot loader (GRUB)

Page 8: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 8

LILO

• Traditional Linux boot loader

• Typically located on MBR

• Allows choice of OS to load at startup

• To configure, edit /etc/lilo.conf

Page 9: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 9

LILO (continued)

• append= keyword (in /etc/lilo.conf): Useful for manually passing information to Linux kernel– Can pass almost any hardware information

• Format is hardware dependent

• Must reinstall LILO if /etc/lilo.conf file altered

• lilo command: Reinstalls LILO– -u option: Uninstall LILO

Page 10: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 10

GRUB• More recent than the LILO boot loader• Stage 1: First major part of GRUB

– Typically resides on MBR– Points to Stage 1.5

• Stage1.5: Loads filesystem support– Resides in /boot/grub

• Stage2: Performs boot loader functions – Displays graphical boot loader screen

• To configure, edit /boot/grub/grub.conf– Read directly by Stage 2 boot loader– HDDs and partitions identified by numbers

• Format: (hd<drive#>,<partition#>)

Page 11: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 11

GRUB (continued)

Figure 9-3: GRUB boot loader screen

Page 12: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 12

GRUB (continued)

• GRUB root partition: Partition containing Stage 2 boot loader and grub.conf file

• GRUB normally allows manipulation of boot loader– To prevent, enable password protection

• grub-md5-crypt command: Generates encrypted password for use in grub.conf file

• Can switch boot loader from GRUB to LILO at any time

• grub-install command: Installs GRUB boot loader

Page 13: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 13

GRUB (continued)

Figure 9-4: Viewing help at the GRUB boot loader screen prompt

Page 14: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 14

Dual Booting Linux

• Only one OS may be used at a time

• Boot loader may be configured to allow choice of OS at boot time

Page 15: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 15

Using LILO or GRUB to Dual Boot other Operating Systems

• Dual boot: Two or more OSs exist on HDD

• Easiest if Linux installed after another OS– Allows installation program to detect other OS

• Place appropriate entries in boot loader configuration file

• LILO and GRUB cannot load Windows Kernel directly

Page 16: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 16

Using LILO or GRUB to Dual Boot other Operating Systems (continued)

Figure 9-5: Partitioning for a dual boot system

Page 17: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 17

Using LILO or GRUB to Dual Boot other Operating Systems (continued)

Figure 9-6: Configuring GRUB for a dual boot system

Page 18: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 18

Using FIPS

• Windows installers use entire HDD for Windows partitions– Leaves no space for Linux

• First non-destructive Interactive Partition Splitter (FIPS): Resizes Windows partition – Preserves Windows OS on Windows partition – Creates space to install Linux

Page 19: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 19

Using FIPS (continued)

• Guidelines/limitations to using FIPS:– FAT16 and FAT32 filesystems only– Will only work with primary Windows partition – Windows partition split into two primary partitions– Need sufficient free space within existing Windows

partition to allow Linux installation

Page 20: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 20

Using a Windows Boot Loader to Dual Boot Linux

• Specify location of GRUB or LILO in Windows boot loader configuration

• NTLOADER: Boot loader available with Windows NT/2000/XP– At boot time, prompts for OS to boot– Able to load LILO or GRUB

• Windows must be installed on first primary active partition– NTLOADER placed on MBR by default

Page 21: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 21

Using a Windows Boot Loader to Dual Boot Linux (continued)

Figure 9-7: Configuring GRUB to reside on a Linux partition

Page 22: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 22

Using a Windows Boot Loader to Dual Boot Linux (continued)

• When Linux installed, install GRUB on first sector of the partition– Avoids overwriting NTLOADER in MBR

• After Linux installed: – Run Linux rescue utility– Make GRUB bootable image file (linboot.bin)– Reboot into Windows OS– Copy linboot.bin to C:\– Configure NTLOADER configuration file

Page 23: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 23

Using a Windows Boot Loader to Dual Boot Linux (continued)

• Boot.ini: File used to configure NTLOADER

• For NTLOADER to be able to boot Linux, must specify the path to linboot.bin

Page 24: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 24

Using a Windows Boot Loader to Dual Boot Linux (continued)

Figure 9-8: NTLOADER operating system choice screen at boot time

Page 25: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 25

Linux Initialization

• Kernel assumes control after Linux loaded– Executes first daemon process (init daemon)

• /etc/inittab: Configuration file for init daemon

Page 26: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 26

Runlevels

• Runlevel: Defines number and type of daemons loaded into memory and executed– init daemon responsible for changing runlevels

• Often called initstates

• runlevel command: Displays current and most recent runlevel

• init command: Change OS runlevel

• telinit command: Alias to init command

Page 27: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 27

The /etc/inittab File

• Consulted to start or stop daemons

• /etc/rc.d/rc.sysinit: First script executed during system startup– Init hardware, set variables, check filesystems,

perform system tasks for daemon loading

• mingetty program: Displays login prompt on character-based terminals

• /etc/rc.d/rc.local file: Performs post-system-startup tasks

Page 28: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 28

The /etc/inittab File (continued)

• /etc/rc.d/rc command: Executes all files starting with S or K in /etc/rc.d/rc*.d/– Runlevel must be specified

• e.g., /etc/rc.d/rc 5 will execute files in /etc/rc.d/rc5.d/

– Symbolic links to scripts that start daemons– S means “Start,” K means “Kill”

Page 29: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 29

The /etc/inittab File (continued)

Figure 9-9: The Linux initialization process

Page 30: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 30

Configuring Daemon Startup

• Most symbolic links in /etc/rc.d/rc*.d point to daemon executable files in /etc/rc.d/init.d

• Most daemons accept arguments start, stop, restart

• To add daemons to be automatically started:– Add executable to /etc/rc.d/init.d– Create appropriate links to /etc/rc.d/rc*.d

• ntsysv utility: Modifies file entries in /etc/rc.d/rc*.d directories

Page 31: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 31

Configuring Daemon Startup (continued)

Figure 9-10: Results of ntsysv―level 5 command

Page 32: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 32

The X Windows System: Linux GUI Components

Figure 9-11: Components of the Linux GUI

Page 33: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 33

X Windows

• X Windows: Core component of Linux GUI

• X client: Requests graphics from X server and displays them– Does not need to run on same computer as X

Windows

• X server: Draws graphics

• XFree86: OSS version of X Windows– Originally intended for Intelx86 platform

Page 34: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 34

Windows Managers and Desktop Environments

• Window manager: Modifies look and feel of X Windows

• Desktop environment: Works with a window manager to provide standard GUI environment– Uses standard programs and development tools– KDE and GNOME are most common

Page 35: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 35

Windows Managers and Desktop Environments (continued)

• K Windows Manager (kwm): Window manager that works under KDE

• Qt toolkit: Software toolkit used with KDE

• GNOME Desktop Environment: Default desktop environment in Red Hat Linux– Sawfish Window Manager – GTK+ toolkit

• Xfce Desktop Environment: Consumes less hardware resources than KDE or GNOME

Page 36: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 36

Windows Managers and Desktop Environments (continued)

Figure 9-12: The KDE desktop

Page 37: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 37

Windows Managers and Desktop Environments (continued)

Figure 9-13: The GNOME desktop

Page 38: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 38

Windows Managers and Desktop Environments (continued)

Figure 9-14: The Xfce desktop

Page 39: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 39

Windows Managers and Desktop Environments (continued)

Figure 9-15: The Tab Window Manager

Page 40: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 40

Starting and Stopping X Windows

• runlevel 5 starts gdm– Displays graphical login screen– Allows user to choose the desktop environment or

Window Manager

• /etc/X11/gdm/gdm.conf: Contains gdm configuration data

• For runlevel 3:– Start gdm manually– Or, use startx command

Page 41: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 41

Starting and Stopping X Windows (continued)

Figure 9-16: The GNOME Display Manager

Page 42: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 42

Starting and Stopping X Windows (continued)

• startx command: start X Windows and Window Manager or desktop environment specified in .Xclients file in home directory– Usually points to .Xclients-default file

• Edit .Xclients-defaults file to start other desktops or Window Managers on X Windows

• Desktop Switching Tool: Change settings used in the .Xclients-default file from KDE or GNOME

Page 43: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 43

Starting and Stopping X Windows (continued)

Figure 9-17: The Desktop Switching Tool

Page 44: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 44

Configuring X Windows

• X Windows interfaces with video hardware– Requires information regarding keyboard, mouse,

monitor, and video adapter card• Required video adapter card information:

– Model– Amount of RAM– Chipset

• Required monitor information:– Maximum resolution supported– Horizontal sync (hsync) range– Vertical sync (vsync) range

Page 45: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 45

Configuring X Windows (continued)

• Mouse, keyboard, monitor, and video adapter card information stored in a file– /etc/X11/xorg.conf: X.org implementation of X

Windows– /etc/X11/XF86Config: XFree86 implementation of X

Windows

• mouseconfig and system-config-mouse commands: Configure mouse

Page 46: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 46

Configuring X Windows (continued)

Figure 9-18: Mouse configuration using mouseconfig

Page 47: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 47

Configuring X Windows (continued)

• system-config-keyboard command: Configure keyboard

• system-config-display command: Configure video adapter card and monitor

• xvidtune utility: Fine-tune the vsync and hsync of the video card

Page 48: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 48

Configuring X Windows (continued)

Figure 9-19: Keyboard configuration using system-config-keyboard

Page 49: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 49

Configuring X Windows (continued)

Figure 9-20: Configuring resolution and color depth using system-config-display

Page 50: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 50

Configuring X Windows (continued)

Figure 9-21: Configuring video card and monitor hardware using system-config-display

Page 51: Linux+ Guide to Linux Certification, Second Edition Chapter 9 System Initialization and X Windows

Linux+ Guide to Linux Certification, 2e 51

Configuring X Windows (continued)

Figure 9-23: The xvidtune utility