1. Trang chủ
  2. » Công Nghệ Thông Tin

Red Hat Linux Networking , System Administration (P6) ppt

30 338 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 30
Dung lượng 0,91 MB

Nội dung

114 Chapter Figure 5-9 The Edit Bookmarks dialog box Select the bookmark from the list on the left side of the dialog box Change the name and location as desired If you enter a different location, you can click Jump to to immediately go to that location Click Close to finish editing the bookmark Deleting Bookmarks To delete a bookmark: Choose Bookmarks ➪ Edit Bookmarks from the menu bar The Edit Bookmarks dialog box opens Select the bookmark that you want to remove Click the Remove button Click the Close button to close the dialog box Managing Your Files and Folders You can take many actions when managing your file system with Nautilus Table 5-1 briefly explains the action that you want to perform and how you should it Table 5-1 Performing Tasks Using Nautilus ACTION METHOD Move an item Click item and drag it to desired location Copy an item Click item and hold Ctrl while dragging item Link to an item Click item and press Ctrl+Shift while dragging Exploring the Desktops ACTION METHOD Select single item Click item Select contiguous items In icon view, click and drag box around items In list view, press Shift; click the first item, and then click the last Select multiple items Press Ctrl; click desired items Select all items Choose Edit ➪ Select All Files from menu bar Create folder Right-click and choose Create Folder from contextual menu Rename item Right-click and choose Rename from the contextual menu Move to trash Right-click and choose Move to Trash from the contextual menu Delete item Right-click and choose Move to Trash Change permissions Right-click, choose Properties, and click the Permissions tab Display trash Right-click the Trash icon and choose Open from the contextual menu Restore trashed item Open Trash folder and drag item to desired location Empty trash Right-click the Trash icon and choose Empty Trash Add emblem Right-click, choose Properties, click the Emblems tab, and choose desired emblem Change single icon Right-click, choose Properties, click Select Custom Icon, and choose desired icon Change item size Choose Zoom In or Zoom Out from toolbar Customizing the Nautilus File Manager A very nice feature of Nautilus is that you can configure it to make it work the way you want it to You can change many preferences; in this section, I tell you about them and how to change them Editing File Manager Preferences To open the Nautilus File Management Preferences dialog box, choose Edit ➪ Preferences from the menu bar in a Nautilus window The dialog box shown in Figure 5-10 appears 115 116 Chapter Figure 5-10 The Nautilus Preferences dialog box On this dialog box are five tabbed pages: ■■ Views — Preferences on this tab give you options for setting the default view parameters for Nautilus, such as icon view, sort order, and showing hidden files ■■ Behavior — Preferences on this tab are concerned with the way Nautilus handles executable files and trash You can also choose between single- and double-clicking here ■■ Display — This tab lets you decide what information you want displayed with your icons, such as size, date created, date modified, and date format ■■ List Columns — The settings on this tab let you choose what information is displayed as well as its order, when you choose list view ■■ Preview — The settings on this tab determine how your files are displayed in their folders For example, you can decide here whether you want thumbnail views of graphic files T I P You can change many preferences to alter the appearance and performance of Nautilus You have seen only a few of them, so experiment with them to see for yourself what they Exploring the Desktops Changing the File Manager Background and Icon Emblems Another nice feature of Nautilus is the ability to display colors and patterns in the File Manager window For example, I like to change the background color for my home directory to light blue That way, I can tell immediately when I’m in my home directory when I see the blue background You can also assign emblems to icons Emblems are small graphics that are used to make your icons more meaningful You can easily change the colors and patterns or add emblems by doing the following: Choose Edit ➪ Backgrounds and Emblems from the Nautilus menu bar to open the Backgrounds and Emblems dialog box, as shown in Figure 5-11 Click the Patterns, the Colors, or the Emblems button on the left side of the dialog box Click and drag the pattern, color, or emblem from the right side of the dialog box to where you want to place it You can drag a color or pattern to the large, right pane of the File Manager window to change the color or pattern You can drag an emblem to an icon to attach it to the icon Click close when you are finished T I P You can also drag the patterns or colors directly to the desktop and drop them there Your desktop will change to reflect your new color or pattern Figure 5-11 The Background and Emblems dialog box 117 118 Chapter Showing and Hiding Views You can decide what you want to view and what you don’t in your File Manager You can view or hide the side pane, the status bar, the toolbar, and the location bar by clicking the appropriate item from the View menu on the menu bar These items are toggled items If the item is checked, it is available for viewing; if not checked, it is not available Clicking the item toggles it on or off Configuring GNOME You can also customize your entire desktop as easily as you configure your Nautilus File Manager Quite a few preferences can be modified in GNOME We can’t possibly explain all of them here in this chapter, but we can show you how to change one of them You can play around with the rest and make changes as you desire Take a look at setting up a screensaver To set the preferences for the screensaver, the following: Choose Applications ➪ Preferences ➪ Screensaver in Enterprise Linux or Desktop ➪ Preferences ➪ Screensaver in Fedora Core The Screensaver Preferences dialog box, as shown in Figure 5-12, opens Choose the mode for the screensaver by making your choice from the drop-down list Select the image or images that you want for your screensaver by selecting the check box in front of your choice Pick the times that you want to use Figure 5-12 Configure the screensaver here Exploring the Desktops T I P Also be sure to look at the Advanced tab to see whether you want to change any items there Items on the Advanced tab include image manipulation, display power managements, color map, and diagnostic settings When you finish making choices, test your screensaver by clicking the Preview button T I P Don’t forget to have a look at the settings for the screensavers that you chose (Click the Settings button to see them.) In many cases, you can create some interesting effects by changing the settings For example, you can change the speed of the screensaver or the number of colors displayed Click the Close button when you’re finished Your new screensaver is enabled Logging Out After you finish working in GNOME, you should log out before leaving the PC Logging out is always a good idea to prevent anyone from using your system You can log out of GNOME as follows: Choose Actions ➪ Log Out in Enterprise Linux or Desktop ➪ Log Out in Fedora Core From the Log Out dialog box, you can choose to log out, restart the system, or shut down the system by selecting the radio button in front of your choice After making your choice, click OK to execute it Taking a Look at KDE The default desktop in Fedora Core and Enterprise Linux is GNOME, but another desktop — KDE — is available if you want to give it a try If you want to use it, you’ll have to make sure that it is installed on your system because the default installation of Fedora Core and Enterprise Linux does not install KDE In this section, we give you a brief overview of KDE just to make you aware of it and perhaps tempt you to try it We will briefly explain the KDE desktop, show you the Applications menu where you can find some applications to try, and tell you about the Konqueror File Manager After that, you are on your own to explore if you like 119 120 Chapter You can check whether KDE is installed from the graphical login screen Click Session (refer to Figure 5-1) and select KDE from the choices If KDE is not a choice, it isn’t installed — but you can easily install it by using the Package Management tool After selecting KDE for your session, enter your username and password to login You will see the KDE desktop, as shown in Figure 5-13 The KDE desktop has an appearance similar to other well-known desktop environments such as GNOME or MS Windows or Mac OS X If you can use these desktops, you will easily master KDE in a short time Notice that the KDE desktop has a rather clean appearance with little desktop clutter — just one icon at the top and a panel at the bottom A description of the KDE desktop is in order here At the bottom of the desktop is a gray, horizontal bar This area of the desktop is the panel and is similar to the taskbar in Windows On the far left of the panel is the Applications icon, indicated by the Red Hat icon To the right of Applications are icons representing programs that were installed during the system installation You can start any of these programs by clicking them from the panel Just move your mouse over any icon, and a contextual menu appears with a description of the program represented by the icon Figure 5-13 The KDE desktop after logging in Exploring the Desktops To the right of the program icons on the panel is a square gray area — the Workspace Switcher — that is divided into four sections When you first log in to KDE, the leftmost section of Workspace Switcher should be white, indicating that you are in workspace one You can switch between four workspaces in KDE, so you actually get four distinct desktops that you can use You can open different programs on the different desktops and switch between them by clicking the Workspace Switcher for the desktop that you want to see Open some programs on the various desktops and then try clicking each of the four squares to see the effect of changing to a different workspace On the far right of the panel is a display of the current date and time The open area on the panel between the Workspace Switcher and the date and time display is used to show any programs that you’re running on your desktop You can switch between programs running on a single desktop by clicking the program name from the bottom panel Also shown in this area are icons that you can add to the panel as well as applets Applets are applications that provide some type of useful information or entertainment Managing Applets The icons on the bottom panel are small programs called applets that have a variety of uses For example, there is a weather applet that you can place on the panel to give you weather forecasts for any area you desire In addition to the applets that are already on the panel, you can add your own You also can move applets that are already there or delete them to make more room To add applets to the panel, the following: Right-click an empty area of the panel Choose Add to Panel from the contextual menu Choose the application that you want to add Click Add to add it to the panel To move applets to another location on the panel: Right-click the applet that you want to move Click Move from the contextual menu Drag the applet to the desired location Click to release the applet to its new location To remove an applet from the panel: Right-click the applet that you want to remove Choose Remove from Panel from the contextual menu 121 122 Chapter To modify the properties of an applet (or the panel): Right-click the applet (or an empty area of the panel) Choose Properties from the contextual menu Change the parameters in the Properties dialog box T I P Right-clicking the panel or any applets on it presents a contextual menu, which gives you access to Help and some useful utilities for panel configuration Contextual menus are different depending on the type of applet that you’re selecting Choosing Applications from the Applications Menu The Applications menu, represented by the Red Hat icon, is on the far-left corner of the bottom panel The Applications button gives you access to a large number of applications Click the Red Hat icon to open the Applications menu, and you see a menu, as shown in Figure 5-14, listing the many categories of applications from which you can choose Figure 5-14 The Applications menu on the KDE desktop Exploring the Desktops Notice that many of the categories contain a right-pointing arrow Moving your cursor over categories with a right-pointing arrow opens additional menus from which you can choose even more applications in that category There are probably more than 100 applications from which you can choose, many more than I can describe in this book However, I provide a brief description of the main category of applications here so you can have some idea what they Begin by starting at the bottom of the menu and work your way toward the top T I P Your Applications menu might not be exactly as described in this section, depending on the type of Fedora Core installation or version of Enterprise Linux you have installed ■ ■ Logout — This menu item gives you a quick way to get to your desktop It is really useful when you have several windows open and want to go to the desktop without having to close the open windows Choosing Logout opens a dialog box giving you the option to log out or cancel Select the radio button of your choice and then click OK ■ ■ Lock Session — This menu option starts your system screensaver and locks your desktop Move your mouse or press a key to open a dialog box that lets you enter your password to unlock the desktop ■ ■ Run Command — This menu item opens a dialog box where you can enter the name of a program that you want to run ■ ■ Home — This menu item is a link to the user’s home directory ■ ■ Help — This menu item opens the Help browser You can get help on using KDE by choosing this item ■ ■ Control Center — The Control Center is used for making configuration changes to the KDE desktop ■ ■ System Tools — This menu choice gives you access to many Enterprise Linux system administration utilities Tools for configuring your network and printers are located here ■ ■ System Settings — This menu item contains Enterprise Linux system administration utilities and some KDE configuration utilities as well Some of the tools here can be used to configure your Web server as well as other servers ■ ■ Sound & Video — Choosing this item gives you access to programs and utilities related to system sound and video For example, if you want to adjust the system volume, use the utility here 123 System Startup and Shutdown called /boot/grub/grub.conf to provide information to the second-stage loader Later in this chapter you learn how to make changes to the /boot/ grub/grub.conf configuration file The first thing the second stage loader does is present you with a nice graphical menu screen, as shown in Figure 6-1 As you can see from Figure 6-1, there are two versions of the kernel listed with one highlighted This is the kernel that will be loaded by default But you can use the GRUB menu to select different Linux kernels, or even different operating systems, to load In many cases, when someone decides to try Linux for the first time, he or she is already running MS Windows and is planning to set up the system to a dual boot So, when the GRUB menu appears there is an additional choice for the other operating system Most of the time Windows is already installed and Linux is installed later In this case, the Linux installation would take care of making the changes to the /etc/boot/grub.conf file to present the other operating system as a choice on the GRUB menu N OT E If you have more than one processor in your system, or you have a Pentium processor with hyper-threading, you will see two kernels listed even on a freshly installed system The second kernel will end with the letters smp, which means symmetrical multiprocessor In this case, you should choose to boot the SMP kernel Figure 6-1 The GRUB graphical menu screen shows the kernel(s) available to boot 129 130 Chapter If you don’t choose a kernel to load, GRUB will load whichever kernel is specified in the configuration file as the default kernel If you want to select the kernel to load, you can use your cursor keys to highlight the kernel you want loaded Regardless of whether you choose the kernel or let GRUB it for you, the next step in the boot process is the actual loading of the kernel The kernel is always located in the /boot directory and will have a name similar to vmlinuz-2.6.10-1.737_FC3 Your kernel version number will most likely be different from the version shown here GRUB has one more task to and that is to load a ramdisk image, called initrd that has the same version number as the kernel you are going to load into system memory initrd loads any special drivers that might be needed by the kernel to load the OS And that is it for GRUB; its work is done and the kernel is now responsible for continuing the boot process But before you say good-bye to GRUB, take a look at some of the things you can with GRUB while the system is booting Using GRUB during Boot In addition to loading a default kernel or operating system when GRUB takes over from the BIOS, GRUB lets you make changes to the parameters it passes to the kernel You’ll notice that Figure 6-1 shows some instructions for selecting the OS as well as which keys to press to edit the parameters that will be passed by GRUB to the kernel To edit the boot parameters, highlight the kernel you want to edit and press the e key A new screen opens, as shown in Figure 6-2 Figure 6-2 Selecting a kernel to edit boot parameters System Startup and Shutdown Figure 6-2 displays the locations of the kernel and initrd files that will be used to begin booting the OS To edit any of the information displayed here, highlight your choice and again press the e key For example, if you want to edit kernel parameters, highlight the line beginning with kernel and press e A new screen appears, as shown in Figure 6-3 To enter any parameters you want to pass to the kernel, type them in at the end of the line Be sure to separate them by spaces For example, to tell the kernel not to use ACPI enter the command acpi=off Now when the kernel boots it will disable ACPI After you have finished entering the parameters you desire press Enter to accept your changes and return to the previous screen Press the letter b and the kernel will boot and begin the process of loading the operating system N OT E Using this method to pass parameters to the kernel is only applied to this instance When the system is rebooted, the parameters will not be passed again If you want the parameters passed at every boot, you need to put them into the /boot/grub/grub.conf file You learn how to modify this file later in the chapter It is also possible to open a command line from GRUB that is similar to a Bash shell except the commands entered are specific to GRUB To enter the GRUB command line interface, press the letter c from the GRUB menu You can then press to get a listing of the commands you can use Figure 6-4 shows the GRUB command-line interface listing the possible commands Figure 6-3 Editing the kernel boot parameters 131 132 Chapter Figure 6-4 The GRUB command-line interface showing possible commands T I P You can use the info pages that are already installed on your system to get a complete explanation of all the GRUB commands Just type info grub at a command prompt The next section explains the steps taken by the kernel The Kernel The first thing the kernel does after taking over from GRUB is to prepare the system memory for use Next all system hardware is probed and configured if possible The kernel will uncompresses the initrd in RAM, mount it as a ramdisk, and then runs linuxrc in the ramdisk This can be a command file like a regular rc file or a symlink to init on the initrd If the former, it runs the commands in there, sets the real root device at the end, and then returns so that init starts If the latter, it runs the commands in /etc/inittab on the ramdisk like any other Linux boot process This can end with a pivotroot or chroot to the real root device Fedora’s initrd files use /Linux as a command script; the initrd and its linuxrc script are very important nowadays because that’s what mounts /proc, /sys, and /dev/shm, starts udev and hotplug, and insmods special drivers such as SCSI drivers Most of the time the kernel is able to autodetect and configure hardware devices, but sometimes, especially with new devices, the kernel cannot properly configure them Usually, this means that your device won’t function correctly, or at all, but the System Startup and Shutdown system will still function If you have set up RAID or Logical Volume Management (LVM) on your system, the kernel will also configure these devices After the kernel has configured all the system devices and mounted the system drives, it runs the /sbin/init command The /sbin/init Program The /sbin/init program is the first system process that runs after the kernel has configured the system devices and mounted the system drives The /init program is like the project manager of the system because it manages the remaining steps of booting the system and is the parent or grandparent of all the rest of the automatically started system boot processes Basically, the init program coordinates the order of the many scripts it will run to complete system setup The first script /init runs is the /etc/rc.d/rc.sysinit script This script starts system swap, checks the file systems, and performs other system initialization Then the init command refers to the /etc/inittab script to get information about how to start the system, which system initialization script to run and bring the system to the runlevel indicated in the inittab script After a typical system installation, the default runlevel is set to runlevel The rest of this section describes the steps the system takes to boot to runlevel After reading the /etc/inittab script, init turns over control to the rc.sysinit program which reads the /etc/rc.d/init.d/functions file to determine the procedure to use to set the default system path, start and stop programs, find the process ID (PID) of a running process and how to log the success or failure of starting a program The next script to run is /etc/rc.d/rc, which is responsible for starting and stopping services when the runlevel changes and determining the new runlevel In the /etc/rc.d directory are additional directories rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, and rc6.d The number in the directory name corresponds to the runlevel Each of these directories contains scripts that are used to stop and start services for the runlevel In this example, the system is booting to runlevel 5, so the init program looks in the /etc/rc.d/rc5.d/ directory for the processes to start and stop Listing 6-1 shows the contents of the rc5.d directory for a newly installed Fedora Core system K01yum -> /init.d/yum K02NetworkManager -> /init.d/NetworkManager K05saslauthd -> /init.d/saslauthd K10psacct -> /init.d/psacct K20nfs -> /init.d/nfs K24irda -> /init.d/irda Listing 6-1 The scripts used to stop and start services in runlevel (continued) 133 134 Chapter K30spamassassin -> /init.d/spamassassin K35vncserver -> /init.d/vncserver K35winbind -> /init.d/winbind K36lisa -> /init.d/lisa K50netdump -> /init.d/netdump K73ypbind -> /init.d/ypbind K74nscd -> /init.d/nscd K74ntpd -> /init.d/ntpd K85mdmpd -> /init.d/mdmpd K89netplugd -> /init.d/netplugd K90bluetooth -> /init.d/bluetooth K94diskdump -> /init.d/diskdump K99microcode_ctl -> /init.d/microcode_ctl S04readahead_early -> /init.d/readahead_early S05kudzu -> /init.d/kudzu S06cpuspeed -> /init.d/cpuspeed S08iptables -> /init.d/iptables S09isdn -> /init.d/isdn S09pcmcia -> /init.d/pcmcia S10network -> /init.d/network S12syslog -> /init.d/syslog S13irqbalance -> /init.d/irqbalance S13portmap -> /init.d/portmap S14nfslock -> /init.d/nfslock S15mdmonitor -> /init.d/mdmonitor S18rpcgssd -> /init.d/rpcgssd S19rpcidmapd -> /init.d/rpcidmapd S19rpcsvcgssd -> /init.d/rpcsvcgssd S25netfs -> /init.d/netfs S26apmd -> /init.d/apmd S26lm_sensors -> /init.d/lm_sensors S28autofs -> /init.d/autofs S33nifd -> /init.d/nifd S34mDNSResponder -> /init.d/mDNSResponder S40smartd -> /init.d/smartd S44acpid -> /init.d/acpid S55cups -> /init.d/cups S55sshd -> /init.d/sshd S56xinetd -> /init.d/xinetd S80sendmail -> /init.d/sendmail S85gpm -> /init.d/gpm S90crond -> /init.d/crond S90xfs -> /init.d/xfs S95anacron -> /init.d/anacron S95atd -> /init.d/atd S96readahead -> /init.d/readahead S97messagebus -> /init.d/messagebus Listing 6-1 (continued) System Startup and Shutdown S97rhnsd -> /init.d/rhnsd S98cups-config-daemon -> /init.d/cups-config-daemon S98haldaemon -> /init.d/haldaemon S99local -> /rc.local Listing 6-1 (continued) All of the scripts in the rc5.d directory are symbolic links to the actual scripts that are located in the /etc/rc.d/init.d/ directory The use of symbolic links means that the runlevels can be modified by adding or removing symlinks or changing the order the scripts run in the rc0.d through rc6.d directories without affecting the scripts to which they are linked T I P A symbolic link is a type of file that points to another file in the file system As you can see, each symbolic link begins with a K and a number or an S and a number The K links are processes that are killed on that runlevel, and those beginning with an S are started All of the processes beginning with K are stopped first and then all the processes beginning with S are started The processes are stopped or started in numerical order, beginning with the lowest number and continuing in increasing order Processes are stopped by the /etc/rc.d/init.d/ process stop command, and started by /etc/rc.d/init.d/ process start If you desire, you can change the stop and start order by changing the numbers in the symbolic links T I P You can stop, start, or restart processes on your system by running the command for the process and then typing stop, start, or restart after the command For example, the command /etc/rc.d/init.d/vstpd stop stops the vsftp server The init program has a few more tasks it needs to before it is finished One of these tasks is running the gettys specified in the /etc/inittab file This provides the six terminals you can use to login to your server These terminals are in addition to the standard login screen that is provided by the runlevel login scripts The last thing the init program does is run the /etc/rc.d/rc.local script If you want to run any of your own scripts, you can put the calls to them in this file See the section titled “Starting Programs at System Boot” later in this chapter for more information Since the system is starting in runlevel 5, you will see a graphical login prompt 135 136 Chapter Exploring Runlevels The term runlevel has been used a few times so far in this chapter and now is a good time to learn more about runlevels and why they are used There are typically eight runlevels on Linux systems, but we are only interested in the seven used on Fedora Core or Enterprise Linux systems Each of the runlevels has a set of processes associated with that runlevel that will be started by entering that runlevel The runlevels on a Fedora Core or Enterprise Linux system and their purpose are: ■■ — Halt ■■ — Single-user mode ■■ — Not used (user-definable) ■■ — Full multiuser mode (without a graphical user interface, GUI) ■■ — Not used (user-definable) ■■ — Full multiuser mode (with a GUI) ■■ — Reboot The /etc/inittab file controls the default runlevel for the system to use when it boots You can easily change the runlevel for your system by making the following change Changing the System Runlevel Look for the following line in the /etc/inittab file It will be just below the listing of available runlevels id:5:initdefault: The number in the line means the system will boot into runlevel If you want to boot into runlevel 3, just change the number to a number 3, so the line now looks like this id:3:initdefault: The default runlevel on Fedora Core and Enterprise Linux systems is runlevel 5, which provides a full multiuser environment and starts the X Window system to give the users a graphical environment Runlevel provides a full multiuser system exactly the same as runlevel 5, with the exception of not providing graphical environment for the users Runlevel is typically used for server systems that don’t require a GUI, because running a GUI uses a lot of system resources unnecessarily System Startup and Shutdown Runlevels and are not used in Fedora Core or Enterprise Linux systems These runlevels are there so that the user can use them to configure them as they desire By doing this, you can make your own custom runlevels for testing or whatever suits your purposes Runlevel lets you enter single-user mode This runlevel is useful for troubleshooting or running diagnostics on your system, but it isn’t usually set as a default runlevel in the /etc/inittab file If you are having problems with your system, you would usually enter runlevel by entering the command during system boot, as shown here: When the boot screen appears, highlight the kernel you want to change by using the down-arrow key Press the letter e Scroll to the second line and press e again At the end of the line type init and press Enter Press the letter b to boot the system into single-user mode Starting Programs at System Boot The file /etc/rc.d/rc.local script is the last file run by the init command when the system boots If you want to run additional scripts to configure other devices, you can place the commands for the script into this file Listing 6-2 shows a typical /etc/rc.d/rc.local file with a call to another script called /usr/bin/novellconfig The novellconfig script is used to load the modules and configure IPX on the server You can also pass options to your scripts by entering them after the call to the script N OT E The script novellconfig is just used as an example and does not actually exist on a default installation You can create your own scripts and call them whatever you want #!/bin/sh # # This script will be executed *after* all the other init scripts # You can put your own initialization stuff in here if you don’t # want to the full Sys V style init stuff touch /var/lock/subsys/local /usr/bin/novellconfig Listing 6-2 An /etc/rc.d/rc.local file calling another program 137 138 Chapter Shutting Down the System If you are running a GUI on your system, shutting down your system is as easy as a few mouse clicks The shutdown procedure for the GNOME desktop is as follows: Choose Actions ➪ Logout from the top panel menu A screen appears asking if you want to logout, restart or shutdown Click the shutdown radio button Click OK, and your system begins to shut down If you are not running a GUI on your system, the command to shut down is shutdown and uses the following syntax: /sbin/shutdown [-t sec.] [-arkhncfF] time [warning message] You can refer to the man page for shutdown to get all the details for the shutdown command To access the man page for shutdown, type the following command: man shutdown Regardless of the method used to start the shutdown command, the process that follows is the same Any users who are logged in to the system will receive a notice that the system is going down and anyone trying to log in after the shutdown command has been given will not be allowed to so Running processes on the system are sent the SIGTERM signal, which will attempt to cleanly stop the running processes The shutdown program signals the init program to change to a different runlevel depending on the shutdown command Runlevel is used to shut down the system, whereas runlevel is used reboot the system Some examples of commonly used shutdown commands with explanations of their meanings are: N OT E In most cases, only the root user can use shutdown to shut down the system The /sbin/shutdown -h now command immediately begins the shutdown process and halts the system The /sbin/shutdown -r now command immediately begins the shutdown process and reboots the system System Startup and Shutdown GRUB Configuration File When the system boots, GRUB presents a graphical screen showing the operating systems that you can boot The /boot/grub/grub.conf file controls what information is displayed on the graphical screen This file even controls whether you see the graphical screen at all Listing 6-3 shows a typical GRUB configuration file An explanation of the items in the file follows the listing # grub.conf generated by anaconda # # Note that you not have to rerun grub after making changes to this file # NOTICE:You have a /boot partition This means that # all kernel and initrd paths are relative to /boot/, eg # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/hda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Fedora Core (2.6.9-1.667) root (hd0,0) kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 rhgb quiet initrd /initrd-2.6.9-1.667.img Listing 6-3 The /boot/grub/grub.conf GRUB configuration file All lines beginning with a # (hash character) are comments and will be ignored GRUB also ignores blank lines The lines following the lines beginning with the hash character and before the line beginning with title are the menu interface commands that GRUB uses to display the menu These lines have the following meanings: ■ ■ default=0 — This command tells GRUB to boot the first listing beginning with title If you had two entries beginning with title, you could set this number to to boot the second entry ■ ■ timeout=5 — This command tells GRUB to boot the default entry after five seconds To change the time, increase or decrease the number as desired ■ ■ splashimage=(hd0,0)/grub/splash.xpm.gz — This command tells GRUB where to look for the splash image it displays for the menu You can create you own images if you desire Just be sure to follow the same format as shown here 139 140 Chapter ■■ hiddenmenu — This command tells GRUB not to display the menu and to boot the default after the timeout expires You can still see the menu by pressing any key ■■ title — This command tells GRUB to list a boot name on the menu using the name following the title command In this example the title is Fedora Core (2.6.9-1.667), which is the name of the operating system and the kernel version number The lines following the title are explained here: ■■ root (hd0,0) — This line tells GRUB to boot the system from the first partition of the first hard drive ■■ kernel — This line tells GRUB the location of the kernel, as well as passes kernel parameters to the kernel All locations are relative to the boot partition, so the listing here indicates that the kernel is in the root of the boot partition If you want to pass kernel parameters to the kernel before it loads, this is the line to add them to There are already two options shown here The rhgb on the kernel line tells the system to use a graphical boot Finally, the quiet option tells the system not to display detailed information about system booting ■■ initrd — This line tells GRUB the location of the initial ramdisk image that is used to load special drivers for the system All locations are relative to the boot partition, so the listing here indicates that the initial ramdisk image is in the root of the boot partition Summary In this chapter, you learned about the procedure Fedora Core and Red Hat Enterprise Linux uses to start and stop the system Each step of the boot process was explained in the order in which it occurs, and the programs that run at each step were listed In addition, you learned about boot loaders and their significance in starting the system The GRUB boot loader was explained in detail to give you a better understanding of how it works The role of the init process and runlevels in the system were also explained You took a look at the GRUB configuration file to learn how it works Finally, you learned how to gracefully bring the system down using the shutdown command CHAPTER The File System Explained IN THIS CHAPTER ■ ■ ■ ■ ■ ■ ■ ■ Understanding the File System Structure Working with Linux-Supported File Systems Memory and Virtual File Systems Linux Disk Management This chapter begins with a description of the file system structure and an explanation of the directories and the files they contain Following the look at the file system structure are the file system commands, essential to proper file system management In addition to the native Linux file system, Fedora Core and Red Hat Enterprise Linux support many other file system types This chapter explains the other file system types and ends with a discussion of Linux disk management Understanding the File System Structure Understanding the organization, or layout, of the file system is one of the most important aspects of system administration For administrators, programmers, users, and installed software, knowing how and where the files are stored on the system is critical for proper system operation A standard should be in place that specifies locations for specific types of data Fortunately, Red Hat has chosen to follow the standards outlined in the Filesystem Hierarchy Standard (FHS) This section briefly explains the FHS and its relevance to proper system administration For the complete standard, refer to pathname com/fhs 141 142 Chapter The FHS provides specific requirements for the placement of files in the directory structure Placement is based on the type of information contained in the file Two categories of file information exist: shareable or unshareable, and variable or static Shareable files are files that can be accessed by other hosts, and unshareable files can be accessed only by the local system Variable files contain information that can change at any time on their own, without anyone actually changing the file A log file is an example of such a file A static file contains information that does not change unless a user changes it Program documentation and binary files are examples of static files Figure 7-1 shows the organization of the file system on a typical Fedora Core and Red Hat Enterprise Linux system Following the figure is an explanation of each directory and the types of files it may contain As shown in the illustration, the file system is organized in a flat, hierarchical file system Linux’s method of mounting its file systems in a flat, logical, hierarchical method has advantages over the file system mounting method used by Windows Linux references everything relative to the root file system point /, whereas Windows has a different root mount point for every drive If you have a / partition that fills up in Linux, you can create another file system called /usr/local and move your data from /usr/local in the original file system to the new file system definition This practice frees up space on the / partition, and is an easy way to bring your system back up to a fully functional state Figure 7-1 The file system organization for a typical Fedora and Red Hat Enterprise Linux system The File System Explained This trick wouldn’t work on a Windows machine, because Windows maps its file locations to static device disk definitions You would have to change programs’ file references from c:\ to d:\, and so forth Linux’s file system management is another good reason to use Linux on your production servers instead of Windows The / Directory The / directory is called the root directory and is at the top of the file system structure In many systems, the / directory is the only partition on the system, and all other directories are mounted under it Figure 7-1 shows a file system with the / directory mounted as the only partition, with all other directories contained within it The primary purpose of the / directory is booting the system and correcting any problems that might be preventing the system from booting According to the FHS, the / directory must contain, or have links to, the following directories: ■ ■ bin — This directory contains command files for use by the system administrator or other users The bin directory cannot contain subdirectories ■ ■ boot — On Red Hat systems, this is the directory containing the kernel, the core of the operating system Also in this directory are files related to booting the system, such as the boot loader and the initial ramdisk ■ ■ dev — This directory contains device nodes through which the operating system can access hardware and software devices on the system ■ ■ etc — This directory and its subdirectories contain most of the system configuration files If you have the X Window System installed on your system, the X11 subdirectory is located here Networking and systemrelated files are in the subdirectory sysconfig Another subdirectory of etc is the skel directory, which holds files used as templates used to create files in users’ home directories when the users are created ■ ■ home — This directory contains the directories of users on the system Subdirectories of home will be named for the user to whom they belong ■ ■ initrd — This directory is used as a mount point when the system is booting It doesn’t contain any data, but it is very important that it be there This directory is not part of the FHS ■ ■ lib — The shared system files and kernel modules are contained in this directory and its subdirectories 143 ... at the file system structure are the file system commands, essential to proper file system management In addition to the native Linux file system, Fedora Core and Red Hat Enterprise Linux support... at System Boot Shutting Down the System Changing the GRUB Configuration All Red Hat systems, whether Fedora Core or Enterprise Linux, use a similar procedure for starting up the operating system. .. layout, of the file system is one of the most important aspects of system administration For administrators, programmers, users, and installed software, knowing how and where the files are stored

Ngày đăng: 07/07/2014, 09:20

TỪ KHÓA LIÊN QUAN