Upload
bernard-dickerson
View
226
Download
0
Embed Size (px)
Citation preview
Guide to Linux Installation and Administration 1
Chapter 4
Running a Linux System
Guide to Linux Installation and Administration 2
Objectives
In this chapter, you will:
• Manage files and directories on a Linux system using basic commands
• Launch programs and manage corresponding software packages
• Add and remove features from the Linux kernel
• Review and change the initialization process that starts a Linux-based computer
• Shut down a Linux system in an orderly way
Guide to Linux Installation and Administration 3
Working with Linux Files and Directories
• Information in Linux is stored in files organized in directories
• Parent directory contains child directories and files
• The parent directory for all directories is the root directory
• All Linux configuration files are located in subdirectories of the root directory
Guide to Linux Installation and Administration 4
Standard Linux Subdirectories of the Root Directory
Guide to Linux Installation and Administration 5
Working at a Command Line
• Logging in to Linux at a text-mode console launches a command-line environment
• Within a graphical environment, you can a command-line window by using the xterm program
• The command-line window is also called a terminal emulator window
Guide to Linux Installation and Administration 6
A Command-Line Window in a Graphical Environment
Guide to Linux Installation and Administration 7
Managing Files with Command-Line Utilities
• The command-line environment is provided by a shell
• Shell: program that accepts and acts on the commands that you enter
• Absolute path: complete description of the directory in absolute terms
• Relative path: partial description of the directory relative to another location
Guide to Linux Installation and Administration 8
Managing Files with Command-Line Utilities
• Linux commands– are case sensitive
– can include options and parameters
• Information about the date and time when an event occurred is stored in the form of a timestamp
Guide to Linux Installation and Administration 9
Commands for Managing Files and Directories
Guide to Linux Installation and Administration 10
Commands for Managing Files and Directories
Guide to Linux Installation and Administration 11
Managing Files with Command-Line Utilities
• Filenames– Are case-sensitive
– Can be up to 256 characters
– Can include file extensions
Guide to Linux Installation and Administration 12
Managing Files with Graphical Utilities
• Linux desktop includes a file manager• File manager: graphical program to display the
contents of a directory and manage files and directories
• The file manager in Red Hat Linux 7.3 is called Nautilus
• To perform basic file management tasks, you can drag and drop file icons
Guide to Linux Installation and Administration 13
The Nautilus File Manager Window
Guide to Linux Installation and Administration 14
File Properties
• Each file in Linux has several basic properties:– Type
– Name
– Size
– Location
– Timestamp
• Each file has the owner of the file, the group assigned to the file, and the permissions granted to access the file
Guide to Linux Installation and Administration 15
The Properties Dialog Box
Guide to Linux Installation and Administration 16
File Permissions
• File permissions define the access that the owner has granted to others on the Linux system
• Types of permissions:– Read permission (r)– Write permission (w)– Execute permission (x)
• Permissions can be assigned in three different ways:– User permission– Group permission– Other permissions
Guide to Linux Installation and Administration 17
File Permissions
• You can alter file ownership and file permissions using the chown and chmod commands
• The chmod command uses letters or numeric codes to define the file permissions assigned to a file or directory
• The umask command determines the file permissions assigned when you create a new file
Guide to Linux Installation and Administration 18
Commonly Used File Permission Settings
Guide to Linux Installation and Administration 19
The Permissions Tab of the Properties Dialog Box
Guide to Linux Installation and Administration 20
Running and Managing Software
• Environment variables: defined by the Linux shell so that all programs can access their values
• Variable: memory location used by a program to store a value
• The PATH environment variable includes a list of all the directories where programs on the system are located
• You can display values of the PATH using the echo command
Guide to Linux Installation and Administration 21
Function Libraries
• A function is a small task that a computer program performs
• A function library is a file that contains commonly used functions
• The ldd command lists the libraries that a program requires
Guide to Linux Installation and Administration 22
Using rpm to Manage Software Packages
• rpm command– Manages all of the rpm software packages– Maintains a database for all the software installed
on the Linux system• You can use the rpm command to query the
software package database or to install or erase software packages from the system
• Hundreds of options are supported by the rpm command
Guide to Linux Installation and Administration 23
Using Graphical Tools to Manage Software Packages
• GNOME and KDE include graphical programs to manage software packages
• The GnoRPM package management utility is included with Gnome
• The KDE Desktop includes a package management tool called kPackage
• Both GmoRPM and kPackage provide menu items
Guide to Linux Installation and Administration 24
The Main Window of the GnoRPM Utility
Guide to Linux Installation and Administration 25
Using kPackage to Display Software Package Information
Guide to Linux Installation and Administration 26
Using tar Archive Files
• A tar archive is a collection of many files stored in a single file
• The tar command is used to create a tar archive, to extract its content, and to create backups of files on the system
• A tar archive has a .tar extension• The resulting file after the tar command with the
compression options is called a gzipped tarball
Guide to Linux Installation and Administration 27
Compression Utilities in Linux
Guide to Linux Installation and Administration 28
The Linux Kernel
• Each Linux kernel has:– Release number
– Timestamp
– Modules
Guide to Linux Installation and Administration 29
Learning about Your Kernel
• The uname command with the –r option displays the version of your Linux kernel followed by the release number
• A release number is assigned by the company that prepared the Linux product
• A timestamp indicates the date and time when the kernel was created
Guide to Linux Installation and Administration 30
Kernel Modules
• Linux kernel modules are files containing computer code that can be loaded into the kernel or removed from the kernel
• Kernel modules can be automatically loaded based on the configuration set during the Linux installation
• The lsmod command lists the modules that are installed in the Linux kernel
Guide to Linux Installation and Administration 31
Adding and Removing Modules
• The modprobe command loads a module with any required supporting modules
• The rmmod command removes a module from the kernel
• Module parameters provide information needed by amodule to locate system resources
Guide to Linux Installation and Administration 32
Locating Modules
• The module files are stored in /lib/modules/version/kernel directory, where version id the version number of the Linux kernel on the system
• This directory contains subdirectories for networking-related modules, device drivers, and other module types
Guide to Linux Installation and Administration 33
The Initialization Process
1. A boot manager loads and starts the Linux kernel
2. The Linux kernel initializes hardware and then launches the init program
3. The init program launches a script based on the run level in which Linux is to operate
4. The script started by init typically runs many other scripts to launch and manage system services
Guide to Linux Installation and Administration 34
Booting the Kernel
• GRUB and LILO are the boot managers• The boot manager displays a prompt listing the
available operating system to launch• Boot parameters instruct the Linux kernel how to
operate or how to access parts of the computer system’s hardware
• You can add boot parameters at the boot manager selection prompt
Guide to Linux Installation and Administration 35
Configuring the Boot Manager
• You can update the configuration of a boot manager after the installation is completed
• The configuration file for the LILO boot manager is /etc/lilo.conf
• The configuration file for GRUB boot manager is /boot/grub/grub.conf
Guide to Linux Installation and Administration 36
Initializing System Services
• The init program is a master control program that starts other programs and scripts that initialize the system services
• A script is a collection of commands that are stored in a text file and executed without user intervention
• The init program is controlled by the /etc/inittab configuration file
Guide to Linux Installation and Administration 37
Reviewing Run Level Services
• A run level is a mode of operation in which a preconfigured set of services is activated
Guide to Linux Installation and Administration 38
The Linux Initialization Process
Guide to Linux Installation and Administration 39
Starting and Stopping System Services
• The chkconfig program allows you to start and stop services when you boot Linux
• RedHat Linux includes a graphical utility to configure system services called serviceconf
• The KDE Desktop includes a similar graphical utility called ksysv
Guide to Linux Installation and Administration 40
The Service Configuration Utility
Guide to Linux Installation and Administration 41
The ksysv Graphical Services Configuration Utility
Guide to Linux Installation and Administration 42
Configuring System Services
• The initialization scripts in /etc/rc.d/init.d are provided when you install Linux
• Configuration details for system services scripts are located in the /etc/sysconfig directory and its subdirectories
Guide to Linux Installation and Administration 43
Shutting Down Linux
• You can shut down Linux by:– The reboot command
– The halt command
– The shutdown command
– Pressing Ctrl+Alt+Del
– The telinit 0 command
Guide to Linux Installation and Administration 44
Summary
• Information in Linux is stored in files organized in a directory structure that begins with the root directory
• There are basic commands to manage files and directories
• Files can be compressed using tar, zip, gzip, and other utilities
• Read, Write, and Execute permissions for a file or directory can be assigned to the owner, to the assigned group, or to all other users on the system
• The rpm command is used to query the software package database or to install or erase software packages from the system
Guide to Linux Installation and Administration 45
Summary
• The Linux kernel supports loadable modules, which are managed using the lsmod, insmod, rmmod, and modprobe commands
• You can provide boot parameters to the Linux kernel at the boot manager selection prompt
• The Linux kernel starts the init program, which in turn runs several scripts based on information stored in the run level directories
• You can set up which services are activated at boot time using the chkconfig command or using various graphical utilities
• To avoid data loss, you must gracefully shut down Linux using a command such as reboot, halt, or shutdown