Red Hat Linux 7.2 Bible, Unlimited ed phần 3 pot

86 346 0
Red Hat Linux 7.2 Bible, Unlimited ed phần 3 pot

Đ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

If the results look fine, you can run the command again, without the −−test option, to have the package removed. Querying packages with rpm Using the query options (−q) of rpm, you can get information about RPM packages. This can be simply listing the packages that are installed or printing detailed information about a package. Here is the basic format of an rpm query command (at least one option is required): rpm −q [options] The following are some useful options you can use with an rpm query: • −qa — Lists all installed packages. • −qf file — Lists the package that owns file. (The file must include the full path name or rpm assumes the current directory.) • −qi package — Lists lots of information about a package. • −qR package — Lists components (such as libraries and commands) that package depends on. • −ql package — Lists all the files contained in package. • −qd package — Lists all documentation files that come in package. • −qc package — Lists all configuration files that come in package. To list all the packages installed on your computer, use the −a query option. Because this is a long list, you should either pipe the output to more or, possibly, use grep to find the package you want. The following command line displays a list of all installed RPM packages, and then shows only those names that include the string of characters xfree. (The −i option to grep says to ignore case.) rpm −qa |grep −i xfree If you are interested in details about a particular package, you can use the rpm −i query option. In the following example, information about the dosfstools package (for working with DOS filesystems in Linux) is displayed: # rpm −qi dosfstools Name : dosfstools Relocations: (not relocatable) Version : 2.7 Vendor: Red Hat, Inc. Release : 1 Build Date: Fri 06 Jul 2001 08:29:15 AM PDT Install date: Sun 29 Jul 2001 01:12:47 PM PDT Build Host: devel.redhat.com Group : Applications/System Source RPM: dosfstools−2.7−1.src.rpm Size : 194162 License: GPL Packager : Red Hat, Inc. <bugzilla.redhat.com/bugzilla> Summary : Utilities for making and checking MS−DOS FAT filesystems in Linux. Description : The dosfstools package includes the mkdosfs and dosfsck utilities, which respectively make and check MS−DOS FAT filesystems on hard drives or on floppies. To find out more about a package’s contents, you can use the −l (list) option with your query. The following example shows the complete path names of files contained in the xpilot package: # rpm −ql xpilot | more /etc/X11/wmconfig/xpilot /etc/X11/wmconfig/xpilots /usr/X11R6/bin/xp−replay /usr/X11R6/bin/xpilot . . . Would you like to know how to use the components in a package? Using the −d option with query will display the documentation (man pages, README files, HOWTOs, etc.) that is included with the package. If you are having trouble getting your X Window System running properly, you can use the following command line to find documents that may help: # rpm −qd XFree86 | more /usr/X11R6/man/man1/editres.1x.gz /usr/X11R6/man/man1/iceauth.1x.gz /usr/X11R6/man/man1/lbxproxy.1x.gz /usr/X11R6/man/man1/libxrx.1x.gz /usr/X11R6/man/man1/lndir.1x.gz /usr/X11R6/man/man1/makedepend.1x.gz /usr/X11R6/man/man1/makepsres.1x.gz /usr/X11R6/man/man1/makestrs.1x.gz /usr/X11R6/man/man1/mkcfm.1x.gz . . . Many packages have configuration files associated with them. To see what configuration files are associated with a particular package, use the −c option with a query. For example, this is what you would type to see configuration files that are used with the ppp package: # rpm −qc ppp /etc/pam.d/ppp /etc/ppp/chap−secrets /etc/ppp/options /etc/ppp/pap−secrets If you ever want to know which package a particular command or configuration file came from, you can use the −qf option. In the following example, the −qf option displays the fact that the chgrp command comes from the fileutils package: # rpm −qf /bin/chgrp fileutils−4.1−4 Verifying packages with rpm If something in a software package isn’t working properly, or if you suspect that your system has been tampered with, the verify (−V) option of rpm can help you verify the contents of your software packages. Information about each installed package is stored on your computer in the RPM database. By using the verify option, you can check if any changes were made to the components in the package. Various file size and permissions tests are done during a verify operation. If everything is fine, there is no output. Any components that have been changed from when they were installed, however, will be printed along with information indicating how they were changed. Here’s an example: # rpm −V ppp S.5 T c /etc/ppp/chap−secrets S.5 T c /etc/ppp/options S.5 T c /etc/ppp/pap−secrets This output shows that the ppp package (used to dial−up a TCP/IP network such as the Internet) has had three files changed since it was installed. The notation at the beginning shows that the file size (S), the MD5 sum (5), and the modification time (T) have all changed. The letter c shows that these are all configuration files. By reviewing these files and seeing that the changes were only those that I made to get PPP working, I can verify that the package is okay. The indicators that you may see when you verify the contents of a configuration file are: • 5 — MD5 Sum — An md5 checksum indicates a change to the file contents. • S — File size — The number of characters in the file has changed. • L — Symlink — The file has become a symbolic link to another file. • T — Mtime — The modification time of the file has changed. • D — Device — The file has become a device special file. • U — User — The user name that owns the file has changed. • G — Group — The group assigned to the file has changed. • M — Mode — If the ownership or permission of the file changed. Tip There is a utility available for browsing the contents of RPM files in a Windows system. By using the rpmbrowser.exe utility, you can list and extract files from an RPM distribution. This utility is available from winsite.com (search for rpmbrowser from www.winsite.com/ws_search.html). Building and installing from source code If no binary version of the package that you want is available, or if you just want to tailor a package to your needs, you can always install the package from source code. The source code CD that comes with Red Hat Linux contains the source code equivalent (SRPMS) of the binary packages you installed. You can modify the source code and rebuild it to suit your needs. Note Though the Red Hat Linux source code CD is not included with this book, you can obtain a copy of the CD from Hungry Minds. Refer to the Linux source code mail−in coupon available on the third CD with this book. Software packages that are not available in SRPMS format are typically available in tar/gzip format. Although the exact instructions for installing an application from a source code archive vary, many packages that are in the .gz and .tar formats follow the same basic procedure. Tip Before you install from source code, you will need to install a variety of software development packages. If you have the disk space, I recommend that you install all software development packages that are recommended during Red Hat installation. (It’s annoying to have an install fail because of a missing component. You can end up wasting a lot of time figuring out what is missing.) The following is a minimal list of C−programming software development tools: • glibc — Contains important shared libraries, the C library, and standard math library. • glibc−devel — Contains standard header files needed to create executables. • binutils — Contains utilities needed to compile programs (such as the assembler and linker). • kernel−source — Contains the Linux kernel source code and is needed to build most C programs. • libc — Contains libraries needed for programs that were based on libc 5, so older applications can run on glibc (libc 6) systems. Installing software in SRPMS format To install a source package from the Red Hat Linux source CD, use the following procedure: 1. Insert the Red Hat Linux source CD into the CD−ROM drive. It should mount automatically. (If it doesn't, type mount /mnt/cdrom in a Terminal window.) 2. Change to the source directory on the CD. For example: cd /mnt/cdrom/SRPMS 3. Choose the package you want to install (type ls to see the packages) and install it using the following command: rpm −iv packagename*.src.rpm (Replace packagename with the name of the package you are installing.) The source is installed in the Red Hat Linux source tree (/usr/src/redhat). Spec files are copied to /usr/src/redhat/SPECS. 4. Change to the SPECS directory as follows: cd /usr/src/redhat/SPECS 5. Unpack the source code as follows: rpm −bp packagename*.spec The source code for the package is installed into the /usr/src/redhat/BUILD/package directory. 6. You can now make changes to the files in the package's BUILD directory. Read the README, Makefile, and other documentation files for details on how to build the individual package. Installing software in gzip/tar format Here are some generic instructions that you can use to install many Linux software packages that are in gzip/tar format: 1. Get the source code package from the Internet or from a CD distribution and copy it into an empty directory (preferably using a name that identifies the package). 2. Assuming the file is compressed using gzip, uncompress the file using the following command: gzip −d package.tar.gz The result is that the package is uncompressed and the .gz is removed from the package name (for example, package.tar). 3. From the resulting tar archive, run the tar command as follows: tar xvf package.tar This command extracts the files from the archive and copies them to a subdirectory of the current directory. 4. Change directories to the new subdirectory created in Step 3, as follows: cd newdir 5. Look for a file called INSTALL or README. One of these files should give you instructions on how to proceed with the installation. In general, the make command is used to install the package. Here are a few things to look for in the current directory: ♦ If there is a Make.in file, try running: ./configure −prefix=/usr make all ♦ If there is an Imake file, try running: xmkmf –a make all ♦ If there is a Make file, try running: make all After the program is built and installed, you may need to do additional configuration. You should consult the man pages and/or the HOWTOs that come with the software for information on how to proceed. Tip Even if you are not a programmer, reading the source code used to make a program can often give you insight into how that program works. To try out this procedure, I downloaded the whichman package, which includes utilities that let you find manual pages by entering keywords. The file I downloaded, whichman−1.5.tar.gz, was placed in a directory that I created called /usr/sw/which. I then ran the gzip and tar commands, using whichman−1.5.tar.gz and whichman−1.5.tar as options, respectively. I changed to the new directory, cd /usr/sw/which/whichman−1.5. I then listed its contents. The README file contained information about the contents of the package and how to install it. As the README file suggested, I typed make, and then make install. The commands whichman, ftwhich, and ftff were installed in /usr/bin. (At this point, you can check the man page for each component to see what it does.) The last thing I found in the README file was that a bit of configuration needed to be done. I added a MANPATH variable to my $HOME/.bashrc to identify the location of man pages on my computer to be searched by the whichman utility. The line I added looked like this: export MANPATH=/usr/man:/usr/X11R6/man:/usr/doc/samba−2.0.2/docs In case you are wondering, whichman, ftwhich, and ftff are commands that you can use to search for man pages. They can be used to find several locations of a man page, man pages that are close to the name you enter, or man pages that are located beneath a point in the directory structure, respectively. Running X Window Applications Setting up and configuring the X Window System to your liking is the hard part. By comparison, using X to run applications is relatively easy. If you have used Microsoft Windows operating systems, you already know the most basic ways of running an application from a graphical desktop. X, however, provides a much more flexible environment for running native Linux applications. Cross−Reference See Chapter 4 for information on setting up an X desktop. Starting applications from a menu To run applications on your own desktop, most X window managers provide a menu, similar to the Microsoft Start menu, to display and select X applications. Applications are usually organized in categories. Open the menu, select the category, and then select the application to run. Figure 5−1 is an example of the GNOME Main Menu. Figure 5−1: Start X applications from the GNOME Main Menu. Starting applications from a Run Program window Not all installed applications appear on the menus provided with your window manager. For running other applications, some window managers provide a window, similar to the GNOME Run Program window, that lets you type in the name of the program you want to run. To access the Run Program window: 1. Open the GNOME Main Menu 2. Click Run. The Run Program window displays a list of programs you can select from. 3. Click the program you want and then click Run. If the application you want isn't on the list, you can click Advanced. Then you can either type the command you want to run (along with any options) and click Run, or you can click Browse to browse through your directories to select a program to run. If you are running a program that needs to run in a Terminal window, such as the vi command, click the Run in Terminal button before running the command. Figure 5−2 is an example of the Run Program window. Figure 5−2: Select a program to run from the list in the Run Program window. Starting applications from a Terminal window I prefer to run an X application, at least for the first time, from a Terminal window. There are several reasons why I prefer a Terminal window to selecting an application from a menu or Run Program window: • If there is a problem with the application, you get to see error messages. Applications usually just fail silently if an application that is started from a menu or Run Program window fails. • Applications selected from menus are run with set options. If you want to change those options, you have to change the configuration file that set up the menu and make the changes there. • If you want to try out a few different options with an application, a Terminal window is an easy way to start it, stop it, and change its options. When you have found an application and figured out the options that you like, you can add it to a menu or a panel (if your window manager supports those features). In that way, you can run a program exactly as you want, instead of the way it is given to you on a menu. Tip To add an application so that it appears in your GNOME desktop Panel, open the GNOME menu and choose Panel → Add to Panel → Launcher. Fill in the fields needed to identify the application. In the Command field, type in the command name and the options that you like. Click the Icon box to select an icon to represent the command. Click OK when you are done, and the application appears on the launcher. Here is a procedure to run X applications from a Terminal window. 1. Open a Terminal window from your desktop (look for a Terminal icon on your Panel or a Terminal selection on a menu.) 2. Type $ echo $DISPLAY The result should be something similar to the following: :0 This indicates that the Terminal window will, by default, direct any X application you run from this window to display 0 on your system. (If you don’t see a value when you type that command, type export DISPLAY=:0 to set the display value.) 3. Type the following command: $ xmms & The xmms program should appear on your desktop, ready to work with. You should note the following: ♦ The xmms command runs in the background of the Terminal window (&). This means that you can continue to use the Terminal window while xmms is running. Because it is a child process of the Terminal window, xmms will close if you close the Terminal window. ♦ I encountered no errors running xmms on this occasion. With other applications at times, however, text appeared in the Terminal window after the command was run. The text may tell me that the command can't find certain information or perhaps that certain fonts or colors cannot be displayed. That information would be lost if I had run the command from a menu. 4. If you want to know what options are available, type: $ xmms −−help 5. Try it with a few options. For example, if you want to begin by playing a file, you could type: $ xmms file.wav Cross−Reference Refer to Chapter 4 for information on X resources and options that are available to most X commands. 6. When you are ready to close the window, you can either do so from the xmms window (right−click on the xmms window and select Exit) or you can kill the process in the Terminal window. Type jobs to see the job number of the process. If it was job number 2, for example, you would type kill %2 to kill the xmms program. You should try running a few other X commands. Many X commands are stored in /usr/X11R6/bin. A few of these commands are described in the following sections. Using X Window utilities A common set of X utilities comes with most versions of the X Window System. The Terminal window (xterm command) is a useful X Window utility because it enables you to run other commands and utilities. To get a feel for using X utilities, try several, such as a simple text editor (xedit), a calculator (xcalc), and some clock programs (xclock, rclock, wmclock, and xdaliclock). Using a Terminal window The UNIX system, on which Red Hat Linux is based, began as a completely text−based system. There were no colors or graphics. There was no mouse. Everything had to be done by typing letters, numbers, and special keys (for example, function keys, Ctrl, Alt, and so on) from a keyboard. The shell command interpreter (usually just referred to as the shell) interpreted the keystrokes. Cross−Reference See Chapter 3 for a description of the shell command interpreter. If you are accessing Red Hat Linux from the X Window System, the Terminal window provides your text−based interface to Linux. As you use Red Hat Linux, you will find that there are many times when you want to use a Terminal window. Moving up and down the file system can be quicker in a Terminal window than in a file manager. Some useful utilities don’t have graphical equivalents. And, as I stated earlier, there are even reasons for starting X applications from a Terminal window. Every window manager provides a menu selection for one or more ways of opening a Terminal window. As an alternative, there are several different commands available with Red Hat Linux that can be used to start a Terminal window, like the following: • xterm — This is the most common command used to open a Terminal window. Most other Terminal windows are based on this command. • rxvt — A reduced−size Terminal window, which is designed to run more efficiently. • gnome−terminal — A Terminal window available with the GNOME window manager. If you are using the GNOME window manager, which is the default, there are several features that make it easier for you to customize the GNOME Terminal window (gnome−terminal command). This window has a menu bar that offers File, Settings, and Help buttons. Figure 5−3 shows a GNOME Terminal window. Figure 5−3: An added menu bar helps customize the GNOME Terminal window. [...]... directly for Linux and other UNIX systems, those that have been ported to Linux, and those that can run in emulation, there are hundreds of applications available that can be used with Red Hat Linux There are dozens of locations on the Internet for downloading Linux applications, and many more that can be purchased on CD To simplify the process of installing and managing your Linux applications, Red Hat developed... software such as WINE (described later) Whether or not a Windows application will run in an emulator in Linux must really be checked on a case−by−case basis Emulation programs for running DOS programs are available for Red Hat Linux You need to install the dosemu and/or xdosemu packages (which are available from Red Hat Linux FTP sites, though not part of the basic Red Hat Linux distribution) DOS emulation... document while writing Plain text macros, inserted into the document, are used to process documents for printing after the writing is done Checklist of your document requirements I have prepared a list of questions that will help you understand what you are getting into by publishing with Red Hat Linux These questions will help you understand what Red Hat Linux documentation tools can and cannot currently... indicates that the table should be centered on the page (center) and surrounded by a line box and that a colon will be used to separate the data into cells (tab(:)) The next line shows that the heading should be centered in the box (c) and should span across the next two cells (s s) The line after that indicates that the heading of each cell should be centered (c | c | c) and that the data cells that follow... well with Linux documentation tools For example, a technical book with a few flow charts and images can be easily produced and maintained using Red Hat Linux documentation tools Letters and memos are also easy to do with these tools And, of course, Red Hat Linux man pages (which provide separate write−ups for every command, file, and device in Linux) and other Linux documentation are created with these... becoming available, as well as several commercial word processing applications that provide graphical, X−based interfaces In this chapter, I look at the pros and cons of using Red Hat Linux as a publishing platform I include descriptions of text−based and GUI−based document preparation software that either comes with Red Hat Linux or is available as an add−on (usually at very reasonable costs) I also... operations have noted, for example, that there are no Linux tools for doing color separations or some of the other advanced photographic image manipulations Attributes of Linux publishing Some attributes of the traditional Linux publishing tools make them particularly well suited for certain types of document publishing As noted earlier, Groff and LaTeX (which is based on TeX) come with Red Hat Linux and are... Guide Using a Text Editor One of the most intimidating tasks in Linux is learning to use a text editor The most popular editors are vi and emacs People who use one of these editors typically claim that their editor is the most powerful and easy to use The truth is that both take some time to learn Cross−Reference See Chapter 3 for a description of how to use the vi editor One editor that takes almost... applications, Red Hat developed the Red Hat Package Manager (RPM) Using tools developed for RPM, such as the rpm command, you can easily install, remove, and do a variety of queries on Linux packages that are in RPM format Of the types of applications that can run in Linux, those created for the X Window System provide the greatest level of compatibility and flexibility when used in Linux However, using emulation... /dev/fd0 Using dosemu and xdosemu The DOS emulator packages dosemu and xdosemu no longer come with the Red Hat Linux distribution These packages were previously part of the Red Hat PowerTools Now you can obtain these packages from a Red Hat Linux FTP site or by using the rpmfind command With the utilities that come with the dosemu and xdosemu packages, you can run DOS applications, as well as use your computer . 29 Jul 20 01 01: 12: 47 PM PDT Build Host: devel.redhat.com Group : Applications/System Source RPM: dosfstools 2 .7 1.src.rpm Size : 1941 62 License: GPL Packager : Red Hat, Inc. <bugzilla.redhat.com/bugzilla>. source is installed in the Red Hat Linux source tree (/usr/src/redhat). Spec files are copied to /usr/src/redhat/SPECS. 4. Change to the SPECS directory as follows: cd /usr/src/redhat/SPECS 5. Unpack. xdosemu no longer come with the Red Hat Linux distribution. These packages were previously part of the Red Hat PowerTools. Now you can obtain these packages from a Red Hat Linux FTP site or by using

Ngày đăng: 14/08/2014, 06:21

Từ khóa liên quan

Mục lục

  • Chapter 5: Accessing and Running Applications

    • Installing Red Hat Linux Applications

      • Building and installing from source code

      • Running X Window Applications

        • Starting applications from a menu

        • Starting applications from a Run Program window

        • Starting applications from a Terminal window

        • Using X Window utilities

        • Running remote X applications

        • Using Emulators to Run Applications from Other Operating Systems

          • Running DOS applications

          • Running Windows and Macintosh applications

          • Summary

          • Chapter 6: Publishing with Red Hat Linux

            • Overview

            • Choosing Red Hat Linux as Your Publishing Platform

              • Checklist of your document requirements

              • Attributes of Linux publishing

              • Creating Documents in Groff or LaTeX

                • Text processing with Groff

                • Text processing with TeX/LaTeX

                • Converting documents

                • Creating DocBook Documents

                • Understanding SGML and XML

                • Using Free and Commercial Word Processors

                  • Using Anyware Office

                  • Using Star Office

                  • Using Corel WordPerfect

Tài liệu cùng người dùng

Tài liệu liên quan