Index: head/zh_TW.UTF-8/books/handbook/book.xml =================================================================== --- head/zh_TW.UTF-8/books/handbook/book.xml (revision 47471) +++ head/zh_TW.UTF-8/books/handbook/book.xml (revision 47472) @@ -1,282 +1,281 @@ %chapters; %txtfiles; ]> FreeBSD 使用手冊 FreeBSD 文件計畫 $FreeBSD$ $FreeBSD$ 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 FreeBSD 文件計畫 &legalnotice; &tm-attrib.freebsd; &tm-attrib.3com; &tm-attrib.3ware; &tm-attrib.arm; &tm-attrib.adaptec; &tm-attrib.adobe; &tm-attrib.apple; &tm-attrib.creative; &tm-attrib.google; &tm-attrib.heidelberger; &tm-attrib.ibm; &tm-attrib.ieee; &tm-attrib.intel; &tm-attrib.intuit; &tm-attrib.linux; &tm-attrib.lsilogic; &tm-attrib.microsoft; &tm-attrib.opengroup; &tm-attrib.oracle; &tm-attrib.realnetworks; &tm-attrib.redhat; &tm-attrib.sun; &tm-attrib.themathworks; &tm-attrib.thomson; &tm-attrib.usrobotics; &tm-attrib.vmware; &tm-attrib.waterloomaple; &tm-attrib.wolframresearch; &tm-attrib.xfree86; &tm-attrib.xiph; &tm-attrib.general; 歡迎使用FreeBSD! 本使用手冊涵蓋範圍包括了 FreeBSD &rel3.current;-RELEASEFreeBSD &rel2.current;-RELEASEFreeBSD &rel.current;-RELEASE 的安裝和日常使用。 這份使用手冊是很多人的集體創作,而且仍然『持續不斷』的進行中。 許多章節仍未完成,已完成的部份也有些需要更新。 如果您有興趣協助本計畫的話,請寄 e-mail 到 &a.doc;。 在 FreeBSD 網站 可以找到這份文件的最新版本(舊版文件可從 http://docs.FreeBSD.org/doc/ 取得),也可以從 FreeBSD FTP 伺服器 或是眾多 mirror 站臺 下載不同格式的資料。 如果比較偏好實體書面資料,那可以在 FreeBSD Mall 購買。 此外,也可以在 使用手冊 中搜尋資料。 &chap.preface; 開始使用 FreeBSD 這部份是提供給初次使用 FreeBSD 的使用者和系統管理者。 這些章節包括: 介紹 FreeBSD 給您。 在安裝過程給您指引。 教您 &unix; 的基礎及原理。 展示給您看如何安裝豐富的 FreeBSD 的應用軟體 向您介紹 X, &unix; 的視窗系統以及詳細的桌面環境設定,讓您更有生產力。 我們試著儘可能的讓這段文字的參考連結數目降到最低,讓您在讀使用手冊的這部份時可以不太需要常常前後翻頁。 &chap.introduction; &chap.bsdinstall; - &chap.install; &chap.basics; &chap.ports; &chap.x11; 一般性工作 既然基礎的部分已經提過了,接下來的這個部分將會討論一些常會用到的 FreeBSD 的特色,這些章節包括: 介紹給您常見且實用的桌面應用軟體:網頁瀏覽器、生產力工具、文件檢視程式等。 介紹給您眾多 FreeBSD 上可用的多媒體工具。 解釋如何編譯自訂 FreeBSD 核心以增加額外系統功能的流程。 詳細描述列印系統,包含桌上型印表機及網路印表機的設定。 展示給您看如何在您的 FreeBSD 系統中執行 Linux 應用軟體。 這些章節中有些需要您預先閱讀些相關文件,在各章節開頭的概要內會提及。 &chap.desktop; &chap.multimedia; &chap.kernelconfig; &chap.printing; &chap.linuxemu; 系統管理 FreeBSD 使用手冊剩下的這些章節涵蓋了全方位的 FreeBSD 系統管理。 每個章節的開頭會先描述在該您讀完該章節後您會學到什麼,也會詳述在您在看這些資料時應該要有的一些背景知識。 這些章節是讓您在需要查資料的時候翻閱用的。 您不需要依照特定的順序來讀,也不需要將這些章節全部過讀之後才開始用 FreeBSD。 &chap.config; &chap.boot; &chap.security; &chap.jails; &chap.mac; &chap.audit; &chap.disks; &chap.geom; &chap.zfs; &chap.filesystems; &chap.virtualization; &chap.l10n; &chap.cutting-edge; &chap.dtrace; 網路通訊 FreeBSD 是一種廣泛的被使用在高效能的網路伺服器中的作業系統,這些章節包含了: 序列埠通訊 PPP 和 PPPoE 電子郵件 執行網路伺服程式 防火牆 其他的進階網路主題 這些章節是讓您在需要查資料的時候翻閱用的。 您不需要依照特定的順序來讀,也不需要將這些章節全部讀過之後才將 FreeBSD 用在網路環境下。 &chap.serialcomms; &chap.ppp-and-slip; &chap.mail; &chap.network-servers; &chap.firewalls; &chap.advanced-networking; 附錄 &chap.mirrors; &chap.bibliography; &chap.eresources; &chap.pgpkeys; &chap.freebsd-glossary; &chap.index; &chap.colophon; Index: head/zh_TW.UTF-8/books/handbook/bsdinstall/chapter.xml =================================================================== --- head/zh_TW.UTF-8/books/handbook/bsdinstall/chapter.xml (revision 47471) +++ head/zh_TW.UTF-8/books/handbook/bsdinstall/chapter.xml (revision 47472) @@ -1,2676 +1,2676 @@ 安裝 &os; 9.<replaceable>X</replaceable> 和更新的版本 Jim Mock Restructured, reorganized, and parts rewritten by Gavin Atkinson Updated for bsdinstall by Warren Block Allan Jude Updated for root-on-ZFS by 概述 安裝 自從 &os; 9.0-RELEASE開始, &os; 提供一個易用,文字介面的安裝程式 bsdinstall。 -本章描述如何用 bsdinstall來安裝 &os;。使用的安裝程式sysinstall則在說明。 +本章描述如何用 bsdinstall來安裝 &os;。 一般來說,本章所寫的安裝說明是針對&i386; 和 AMD64 架構。如果可以用於其他平台,將會列表說明。 安裝程式和本章所敘述的內容可能會有些微差異,所以請將本章視為通用的指引,而不是完全照著來做。 喜歡用圖形化安裝程式安裝 &os; 的使用者, 可能會對 pc-sysinstall有興趣,這是PC-BSD計畫所使用的。 他可以用來安裝圖形化桌面 (PC-BSD) 或是命令列版本的 &os;。 細節請參考 PC-BSD 使用者 Handbook (http://wiki.pcbsd.org/index.php/PC-BSD%C2%AE_Users_Handbook/10.1)。 讀完這章,您將了解: 最低的硬體需求和 &os; 支援的架構。 如何建立 &os; 的安裝媒體。 如何開始執行 bsdinstall bsdinstall會詢問的問題,問題代表的意思,以及如何回答。 安裝失敗時如何做故障排除。 如何在正式安裝前使用 live 版本的 &os;。 在開始閱讀這章之前,您需要︰ 閱讀即將安裝的 &os; 版本所附帶的硬體支援清單,並核對系統的硬體是否有支援。 最低硬體需求 安裝 &os; 的硬體需求隨 &os; 的版本和硬體架構而不同。 &os;發行版支援的硬體架構和裝置列在硬體支援清單的檔案裡。 這個檔案通常名為 HARDWARE.TXT,位於發行媒體的根目錄。 支援硬體清單的副本也可以在&os; 網站 (http://www.FreeBSD.org/releases/index.html)的發行資訊頁面找到。 &os; 最小安裝需要至少 64 MB 的 RAM 和 1.5 GB 的可用硬碟空間 但是這真的是 最小,幾乎沒有剩下多餘的空間。 較實際的安裝,不用圖形化環境最少需要 4 GB ,如果要用圖形化介面至少要有 8 GB 以上。 第三方應用程式需要更多空間。建議增加 It is recommended to increase RAM 和硬碟空間以應付應用程式的需求和未來可能儲存的資料量。 每一種架構的處理器需求概述如下: &arch.amd64; 有兩類處理器可以跑 &arch.amd64;。 第一類是 AMD64 處理器,包括 &amd.athlon;64 和 &amd.opteron; 處理器。 第二類包括那些使用 &intel; EM64T 架構的處理器。 這些包括除了Sossaman以外的所有多核心 &intel; &xeon; 處理器。 單核心 &intel; &xeon; 處理器 Nocona, Irwindale, Potomac, 和 Cranford, &intel; &core; 2 (非 Core Duo) 和更新的處理器,所有的 &intel; &pentium; D 處理器, 和某些 &intel; &pentium; 4s 與使用Prescott核心的 Celeron Ds 。 單處理器 (UP) 和對稱多處理器 (SMP)的設定都有支援。 &arch.i386; 幾乎所有有浮點運算裝置的 i386 相容處理器都有支援。所有 &intel; 486或是更新的處理器也有支援。 如果 CPUs 有支援,&os; 會利用實體位址延伸 有開啟 PAE 支援的核心會偵測超過 4 GB 的記憶體,讓他能被系統使用。 這項功能為 &os; 的驅動程式與部分功能帶來一些限制,詳情請見 &man.pae.4;。 ia64 目前支援的處理器是 &itanium; 和 &itanium; 2。支援的晶片組包括 HP zx1, &intel; 460GX 和 &intel; E8870。 單處理器 (UP) 和對稱多處理器 (SMP)的設定都有支援。 pc98 NEC PC-9801/9821 系列幾乎所有 i386 相容處理器包括 80486, &pentium;, &pentium; Pro 和 &pentium; II 都有支援。 所有 AMD, Cyrix, IBM, and IDT 的i386 相容處理器都有支援。 相容NEC PC-9801 的EPSON PC-386/486/586 系列都有支援。 NEC FC-9801/9821 and NEC SV-98 系列也有支援。 高解析度模式並不支援。NEC PC-98XA/XL/RL/XL^2 和 NEC PC-H98 系列只支援正常 (PC-9801 相容) 模式。 &os; 對稱多處理器 SMP 相關特色並不支援。 PC-H98, SV-H98 和FC-H98 新延伸標準架構 (NESA) 匯流排不支援。 &arch.powerpc; 所有內建USB的 New World ROM &apple; &mac; 系統都有支援。 SMP 在多 CPUs的機器都有支援。 32位元的核心只能使用前 2 GB的RAM &arch.sparc64; &os;/&arch.sparc64; 支援的系統列在 FreeBSD/sparc64 計劃 (http://www.freebsd.org/platforms/sparc.html). 所有超過一個處理器的系統都有支援SMP。需要專用的磁碟系統,因為此時無法和其他作業系統共用磁碟。 安裝前的工作 Once it has been determined that the system meets the minimum hardware requirements for installing &os;, the installation file should be downloaded and the installation media prepared. Before doing this, check that the system is ready for an installation by verifying the items in this checklist: 備份重要資料 Before installing any operating system, always backup all important data first. Do not store the backup on the system being installed. Instead, save the data to a removable disk such as a USB drive, another system on the network, or an online backup service. Test the backup before starting the installation to make sure it contains all of the needed files. Once the installer formats the system's disk, all data stored on that disk will be lost. Decide Where to Install &os; If &os; will be the only operating system installed, this step can be skipped. But if &os; will share the disk with another operating system, decide which disk or partition will be used for &os;. In the &arch.i386; and &arch.amd64; architectures, disks can be divided into multiple partitions using one of two partitioning schemes. A traditional Master Boot Record (MBR) holds a partition table defining up to four primary partitions. For historical reasons, &os; calls these primary partition slices. One of these primary partitions can be made into an extended partition containing multiple logical partitions. The GUID Partition Table (GPT) is a newer and simpler method of partitioning a disk. Common GPT implementations allow up to 128 partitions per disk, eliminating the need for logical partitions. Some older operating systems, like &windows; XP, are not compatible with the GPT partition scheme. If &os; will be sharing a disk with such an operating system, MBR partitioning is required. The &os; boot loader requires either a primary or GPT partition. If all of the primary or GPT partitions are already in use, one must be freed for &os;. To create a partition without deleting existing data, use a partition resizing tool to shrink an existing partition and create a new partition using the freed space. A variety of free and commercial partition resizing tools are listed at http://en.wikipedia.org/wiki/List_of_disk_partitioning_software. GParted Live (http://gparted.sourceforge.net/livecd.php) is a free live CD which includes the GParted partition editor. GParted is also included with many other Linux live CD distributions. When used properly, disk shrinking utilities can safely create space for creating a new partition. Since the possibility of selecting the wrong partition exists, always backup any important data and verify the integrity of the backup before modifying disk partitions. Disk partitions containing different operating systems make it possible to install multiple operating systems on one computer. An alternative is to use virtualization () which allows multiple operating systems to run at the same time without modifying any disk partitions. 收集網路資訊 Some &os; installation methods require a network connection in order to download the installation files. After any installation, the installer will offer to setup the system's network interfaces. If the network has a DHCP server, it can be used to provide automatic network configuration. If DHCP is not available, the following network information for the system must be obtained from the local network administrator or Internet service provider: 需要的網路資訊 IP address Subnet mask IP address of default gateway Domain name of the network IP addresses of the network's DNS servers 檢查 &os; 勘誤表 Although the &os; Project strives to ensure that each release of &os; is as stable as possible, bugs occasionally creep into the process. On very rare occasions those bugs affect the installation process. As these problems are discovered and fixed, they are noted in the &os; Errata (http://www.freebsd.org/releases/&rel.current;R/errata.html) on the &os; web site. Check the errata before installing to make sure that there are no problems that might affect the installation. Information and errata for all the releases can be found on the release information section of the &os; web site (http://www.freebsd.org/releases/index.html). 準備安裝的媒體 The &os; installer is not an application that can be run from within another operating system. Instead, download a &os; installation file, burn it to the media associated with its file type and size (CD, DVD, or USB), and boot the system to install from the inserted media. &os; installation files are available at www.freebsd.org/where.html#download. Each installation file's name includes the release version of &os;, the architecture, and the type of file. For example, to install &os; 10.0 on an &arch.amd64; system from a DVD, download FreeBSD-10.0-RELEASE-amd64-dvd1.iso, burn this file to a DVD, and boot the system with the DVD inserted. Several file types are available, though not all file types are available for all architectures. The possible file types are: -bootonly.iso: This is the smallest installation file as it only contains the installer. A working Internet connection is required during installation as the installer will download the files it needs to complete the &os; installation. This file should be burned to a CD using a CD burning application. -disc1.iso: This file contains all of the files needed to install &os;, its source, and the Ports Collection. It should be burned to a CD using a CD burning application. -dvd1.iso: This file contains all of the files needed to install &os;, its source, and the Ports Collection. It also contains a set of popular binary packages for installing a window manager and some applications so that a complete system can be installed from media without requiring a connection to the Internet. This file should be burned to a DVD using a DVD burning application. -memstick.img: This file contains all of the files needed to install &os;, its source, and the Ports Collection. It should be burned to a USB stick using the instructions below. Also download CHECKSUM.SHA256 from the same directory as the image file and use it to check the image file's integrity by calculating a checksum. &os; provides &man.sha256.1; for this, while other operating systems have similar programs. Compare the calculated checksum with the one shown in CHECKSUM.SHA256. The checksums must match exactly. If the checksums do not match, the file is corrupt and should be downloaded again. 將印象檔寫入<acronym>USB</acronym> The *.img file is an image of the complete contents of a memory stick. It cannot be copied to the target device as a file. Several applications are available for writing the *.img to a USB stick. This section describes two of these utilities. Before proceeding, back up any important data on the USB stick. This procedure will erase the existing data on the stick. 使用 <command>dd</command> 指令來寫入印象檔 This example uses /dev/da0 as the target device where the image will be written. Be very careful that the correct device is used as this command will destroy the existing data on the specified target device. The &man.dd.1; command-line utility is available on BSD, &linux;, and &macos; systems. To burn the image using dd, insert the USB stick and determine its device name. Then, specify the name of the downloaded installation file and the device name for the USB stick. This example burns the &arch.amd64; installation image to the first USB device on an existing &os; system. &prompt.root; dd if=FreeBSD-10.0-RELEASE-amd64-memstick.img of=/dev/da0 bs=64k If this command fails, verify that the USB stick is not mounted and that the device name is for the disk, not a partition. Some operating systems might require this command to be run with &man.sudo.8;. Systems like &linux; might buffer writes. To force all writes to complete, use &man.sync.8;. 使用&windows; 來寫入映象檔 Be sure to give the correct drive letter as the existing data on the specified drive will be overwritten and destroyed. 取得<application>Image Writer for &windows;</application> Image Writer for &windows; 是一個免費的應用程式,可以正確地將映像檔寫入隨身碟。 從 https://launchpad.net/win32-image-writer/ 下載,並解壓縮到一個資料夾。 用 Image Writer 寫入映象檔 雙擊 Win32DiskImager icon 啟動程式。 Verify that the drive letter shown under Device is the drive with the memory stick. Click the folder icon and select the image to be written to the memory stick. Click [ Save ] to accept the image file name. Verify that everything is correct, and that no folders on the memory stick are open in other windows. When everything is ready, click [ Write ] to write the image file to the memory stick. You are now ready to start installing &os;. Starting the Installation By default, the installation will not make any changes to the disk(s) before the following message: Your changes will now be written to disk. If you have chosen to overwrite existing data, it will be PERMANENTLY ERASED. Are you sure you want to commit your changes? The install can be exited at any time prior to this warning. If there is a concern that something is incorrectly configured, just turn the computer off before this point and no changes will be made to the system's disks. This section describes how to boot the system from the installation media which was prepared using the instructions in . When using a bootable USB stick, plug in the USB stick before turning on the computer. When booting from CD or DVD, turn on the computer and insert the media at the first opportunity. How to configure the system to boot from the inserted media depends upon the architecture. Booting on &i386; and &arch.amd64; These architectures provide a BIOS menu for selecting the boot device. Depending upon the installation media being used, select the CD/DVD or USB device as the first boot device. Most systems also provide a key for selecting the boot device during startup without having to enter the BIOS. Typically, the key is either F10, F11, F12, or Escape. If the computer loads the existing operating system instead of the &os; installer, then either: The installation media was not inserted early enough in the boot process. Leave the media inserted and try restarting the computer. The BIOS changes were incorrect or not saved. Double-check that the right boot device is selected as the first boot device. This system is too old to support booting from the chosen media. In this case, the Plop Boot Manager (http://www.plop.at/en/bootmanager.html) can be used to boot the system from the selected media. Booting on &powerpc; On most machines, holding C on the keyboard during boot will boot from the CD. Otherwise, hold Command Option O F , or Windows Alt O F on non-&apple; keyboards. At the 0 > prompt, enter boot cd:,\ppc\loader cd:0 Booting on &sparc64; Most &sparc64; systems are set up to boot automatically from disk. To install &os; from a CD requires a break into the PROM. To do this, reboot the system and wait until the boot message appears. The message depends on the model, but should look something like this: Sun Blade 100 (UltraSPARC-IIe), Keyboard Present Copyright 1998-2001 Sun Microsystems, Inc. All rights reserved. OpenBoot 4.2, 128 MB memory installed, Serial #51090132. Ethernet address 0:3:ba:b:92:d4, Host ID: 830b92d4. If the system proceeds to boot from disk at this point, press L1A or StopA on the keyboard, or send a BREAK over the serial console. When using tip or cu, ~# will issue a BREAK. The PROM prompt will be ok on systems with one CPU and ok {0} on SMP systems, where the digit indicates the number of the active CPU. At this point, place the CD into the drive and type boot cdrom from the PROM prompt. &os; 開機選單 Once the system boots from the installation media, a menu similar to the following will be displayed:
&os; 開機管理程式選單
By default, the menu will wait ten seconds for user input before booting into the &os; installer or, if &os; is already installed, before booting into &os;. To pause the boot timer in order to review the selections, press Space. To select an option, press its highlighted number, character, or key. The following options are available. Boot Multi User: This will continue the &os; boot process. If the boot timer has been paused, press 1, upper- or lower-case B, or Enter. Boot Single User: This mode can be used to fix an existing &os; installation as described in . Press 2 or the upper- or lower-case S to enter this mode. Escape to loader prompt: This will boot the system into a repair prompt that contains a limited number of low-level commands. This prompt is described in . Press 3 or Esc to boot into this prompt. Reboot: Reboots the system. Configure Boot Options: Opens the menu shown in, and described under, .
&os; 開機選項選單
The boot options menu is divided into two sections. The first section can be used to either return to the main boot menu or to reset any toggled options back to their defaults. The next section is used to toggle the available options to On or Off by pressing the option's highlighted number or character. The system will always boot using the settings for these options until they are modified. Several options can be toggled using this menu: ACPI Support: If the system hangs during boot, try toggling this option to Off. Safe Mode: If the system still hangs during boot even with ACPI Support set to Off, try setting this option to On. Single User: Toggle this option to On to fix an existing &os; installation as described in . Once the problem is fixed, set it back to Off. Verbose: Toggle this option to On to see more detailed messages during the boot process. This can be useful when troubleshooting a piece of hardware. After making the needed selections, press 1 or Backspace to return to the main boot menu, then press Enter to continue booting into &os;. A series of boot messages will appear as &os; carries out its hardware device probes and loads the installation program. Once the boot is complete, the welcome menu shown in will be displayed.
歡迎選單
Press Enter to select the default of [ Install ] to enter the installer. The rest of this chapter describes how to use this installer. Otherwise, use the right or left arrows or the colorized letter to select the desired menu item. The [ Shell ] can be used to access a &os; shell in order to use command line utilities to prepare the disks before installation. The [ Live CD ] option can be used to try out &os; before installing it. The live version is described in . To review the boot messages, including the hardware device probe, press the upper- or lower-case S and then Enter to access a shell. At the shell prompt, type more /var/run/dmesg.boot and use the space bar to scroll through the messages. When finished, type exit to return to the welcome menu.
使用 <application>bsdinstall</application> This section shows the order of the bsdinstall menus and the type of information that will be asked before the system is installed. Use the arrow keys to highlight a menu option, then Space to select or deselect that menu item. When finished, press Enter to save the selection and move onto the next screen. Selecting the Keymap Menu Depending on the system console being used, bsdinstall may initially display the menu shown in .
Keymap Selection
To configure the keyboard layout, press Enter with [ YES ] selected, which will display the menu shown in . To instead use the default layout, use the arrow key to select [ NO ] and press Enter to skip this menu screen.
選擇鍵盤選單
When configuring the keyboard layout, use the up and down arrows to select the keymap that most closely represents the mapping of the keyboard attached to the system. Press Enter to save the selection. Pressing Esc will exit this menu and use the default keymap. If the choice of keymap is not clear, United States of America ISO-8859-1 is also a safe option. In &os; 10.0-RELEASE and later, this menu has been enhanced. The full selection of keymaps is shown, with the default preselected. In addition, when selecting a different keymap, a dialog is displayed that allows the user to try the keymap and ensure it is correct before proceeding.
Enhanced Keymap Menu
設定主機名稱 The next bsdinstall menu is used to set the hostname for the newly installed system.
設定主機名稱
Type in a hostname that is unique for the network. It should be a fully-qualified hostname, such as machine3.example.com.
選擇要安裝的組件 Next, bsdinstall will prompt to select optional components to install.
選擇要安裝的組件
Deciding which components to install will depend largely on the intended use of the system and the amount of disk space available. The &os; kernel and userland, collectively known as the base system, are always installed. Depending on the architecture, some of these components may not appear: doc - Additional documentation, mostly of historical interest, to install into /usr/share/doc. The documentation provided by the FreeBSD Documentation Project may be installed later using the instructions in . games - Several traditional BSD games, including fortune, rot13, and others. lib32 - Compatibility libraries for running 32-bit applications on a 64-bit version of &os;. ports - The &os; Ports Collection is a collection of files which automates the downloading, compiling and installation of third-party software packages. discusses how to use the Ports Collection. The installation program does not check for adequate disk space. Select this option only if sufficient hard disk space is available. The &os; Ports Collection takes up about &ports.size; of disk space. src - The complete &os; source code for both the kernel and the userland. Although not required for the majority of applications, it may be required to build device drivers, kernel modules, or some applications from the Ports Collection. It is also used for developing &os; itself. The full source tree requires 1 GB of disk space and recompiling the entire &os; system requires an additional 5 GB of space.
從網路安裝 The menu shown in only appears when installing from a -bootonly.iso CD as this installation media does not hold copies of the installation files. Since the installation files must be retrieved over a network connection, this menu indicates that the network interface must be first configured.
從網路安裝
To configure the network connection, press Enter and follow the instructions in . Once the interface is configured, select a mirror site that is located in the same region of the world as the computer on which &os; is being installed. Files can be retrieved more quickly when the mirror is close to the target computer, reducing installation time.
選擇鏡像站
Installation will then continue as if the installation files were located on the local installation media.
配置磁碟空間 The next menu is used to determine the method for allocating disk space. The options available in the menu depend upon the version of &os; being installed.
Partitioning Choices on &os; 9.x
Partitioning Choices on &os; 10.x and Higher
Guided partitioning automatically sets up the disk partitions, Manual partitioning allows advanced users to create customized partitions from menu options, and Shell opens a shell prompt where advanced users can create customized partitions using command-line utilities like &man.gpart.8;, &man.fdisk.8;, and &man.bsdlabel.8;. ZFS partitioning, only available in &os; 10 and later, creates an optionally encrypted root-on-ZFS system with support for boot environments. This section describes what to consider when laying out the disk partitions. It then demonstrates how to use the different partitioning methods. Designing the Partition Layout partition layout /etc /var /usr When laying out file systems, remember that hard drives transfer data faster from the outer tracks to the inner. Thus, smaller and heavier-accessed file systems should be closer to the outside of the drive, while larger partitions like /usr should be placed toward the inner parts of the disk. It is a good idea to create partitions in an order similar to: /, swap, /var, and /usr. The size of the /var partition reflects the intended machine's usage. This partition is used to hold mailboxes, log files, and printer spools. Mailboxes and log files can grow to unexpected sizes depending on the number of users and how long log files are kept. On average, most users rarely need more than about a gigabyte of free disk space in /var. Sometimes, a lot of disk space is required in /var/tmp. When new software is installed, the packaging tools extract a temporary copy of the packages under /var/tmp. Large software packages, like Firefox, OpenOffice or LibreOffice may be tricky to install if there is not enough disk space under /var/tmp. The /usr partition holds many of the files which support the system, including the &os; Ports Collection and system source code. At least 2 gigabytes is recommended for this partition. When selecting partition sizes, keep the space requirements in mind. Running out of space in one partition while barely using another can be a hassle. swap sizing swap partition As a rule of thumb, the swap partition should be about double the size of physical memory (RAM). Systems with minimal RAM may perform better with more swap. Configuring too little swap can lead to inefficiencies in the VM page scanning code and might create issues later if more memory is added. On larger systems with multiple SCSI disks or multiple IDE disks operating on different controllers, it is recommended that swap be configured on each drive, up to four drives. The swap partitions should be approximately the same size. The kernel can handle arbitrary sizes but internal data structures scale to 4 times the largest swap partition. Keeping the swap partitions near the same size will allow the kernel to optimally stripe swap space across disks. Large swap sizes are fine, even if swap is not used much. It might be easier to recover from a runaway program before being forced to reboot. By properly partitioning a system, fragmentation introduced in the smaller write heavy partitions will not bleed over into the mostly read partitions. Keeping the write loaded partitions closer to the disk's edge will increase I/O performance in the partitions where it occurs the most. While I/O performance in the larger partitions may be needed, shifting them more toward the edge of the disk will not lead to a significant performance improvement over moving /var to the edge. Guided Partitioning When this method is selected, a menu will display the available disk(s). If multiple disks are connected, choose the one where &os; is to be installed.
Selecting from Multiple Disks
Once the disk is selected, the next menu prompts to install to either the entire disk or to create a partition using free space. If [ Entire Disk ] is chosen, a general partition layout filling the whole disk is automatically created. Selecting [ Partition ] creates a partition layout from the unused space on the disk.
Selecting Entire Disk or Partition
After the partition layout has been created, review it to ensure it meets the needs of the installation. Selecting [ Revert ] will reset the partitions to their original values and pressing [ Auto ] will recreate the automatic &os; partitions. Partitions can also be manually created, modified, or deleted. When the partitioning is correct, select [ Finish ] to continue with the installation.
Review Created Partitions
Manual Partitioning Selecting this method opens the partition editor:
Manually Create Partitions
Highlight the installation drive (ada0 in this example) and select [ Create ] to display a menu of available partition schemes:
Manually Create Partitions
GPT is usually the most appropriate choice for &arch.amd64; computers. Older computers that are not compatible with GPT should use MBR. The other partition schemes are generally used for uncommon or older computers. Partitioning Schemes Abbreviation Description APM Apple Partition Map, used by &powerpc;. BSD BSD label without an MBR, sometimes called dangerously dedicated mode as non-BSD disk utilities may not recognize it. GPT GUID Partition Table (http://en.wikipedia.org/wiki/GUID_Partition_Table). MBR Master Boot Record (http://en.wikipedia.org/wiki/Master_boot_record). PC98 MBR variant used by NEC PC-98 computers (http://en.wikipedia.org/wiki/Pc9801). VTOC8 Volume Table Of Contents used by Sun SPARC64 and UltraSPARC computers.
After the partitioning scheme has been selected and created, select [ Create ] again to create the partitions.
Manually Create Partitions
A standard &os; GPT installation uses at least three partitions: freebsd-boot - Holds the &os; boot code. freebsd-ufs - A &os; UFS file system. freebsd-swap - &os; swap space. Another partition type worth noting is freebsd-zfs, used for partitions that will contain a &os; ZFS file system (). Refer to &man.gpart.8; for descriptions of the available GPT partition types. Multiple file system partitions can be created and some people prefer a traditional layout with separate partitions for /, /var, /tmp, and /usr. See for an example. The Size may be entered with common abbreviations: K for kilobytes, M for megabytes, or G for gigabytes. Proper sector alignment provides the best performance, and making partition sizes even multiples of 4K-bytes helps to ensure alignment on drives with either 512-byte or 4K-byte sectors. Generally, using partition sizes that are even multiples of 1M or 1G is the easiest way to make sure every partition starts at an even multiple of 4K. There is one exception: the freebsd-boot partition should be no larger than 512K due to current boot code limitations. A Mountpoint is needed if the partition will contain a file system. If only a single UFS partition will be created, the mountpoint should be /. The Label is a name by which the partition will be known. Drive names or numbers can change if the drive is connected to a different controller or port, but the partition label does not change. Referring to labels instead of drive names and partition numbers in files like /etc/fstab makes the system more tolerant to hardware changes. GPT labels appear in /dev/gpt/ when a disk is attached. Other partitioning schemes have different label capabilities and their labels appear in different directories in /dev/. Use a unique label on every partition to avoid conflicts from identical labels. A few letters from the computer's name, use, or location can be added to the label. For instance, use labroot or rootfslab for the UFS root partition on the computer named lab. Creating Traditional Split File System Partitions For a traditional partition layout where the /, /var, /tmp, and /usr directories are separate file systems on their own partitions, create a GPT partitioning scheme, then create the partitions as shown. Partition sizes shown are typical for a 20G target disk. If more space is available on the target disk, larger swap or /var partitions may be useful. Labels shown here are prefixed with ex for example, but readers should use other unique label values as described above. By default, &os;'s gptboot expects the first UFS partition to be the / partition. Partition Type Size Mountpoint Label freebsd-boot 512K freebsd-ufs 2G / exrootfs freebsd-swap 4G exswap freebsd-ufs 2G /var exvarfs freebsd-ufs 1G /tmp extmpfs freebsd-ufs accept the default (remainder of the disk) /usr exusrfs After the custom partitions have been created, select [ Finish ] to continue with the installation.
Root-on-ZFS Automatic Partitioning Support for automatic creation of root-on-ZFS installations was added in &os; 10.0-RELEASE. This partitioning mode only works with whole disks and will erase the contents of the entire disk. The installer will automatically create partitions aligned to 4k boundaries and force ZFS to use 4k sectors. This is safe even with 512 byte sector disks, and has the added benefit of ensuring that pools created on 512 byte disks will be able to have 4k sector disks added in the future, either as additional storage space or as replacements for failed disks. The installer can also optionally employ GELI disk encryption as described in . If encryption is enabled, a 2 GB unencrypted boot pool containing the /boot directory is created. It holds the kernel and other files necessary to boot the system. A swap partition of a user selectable size is also created, and all remaining space is used for the ZFS pool. The main ZFS configuration menu offers a number of options to control the creation of the pool.
<acronym>ZFS</acronym> Partitioning Menu
Select T to configure the Pool Type and the disk(s) that will constitute the pool. The automatic ZFS installer currently only supports the creation of a single top level vdev, except in stripe mode. To create more complex pools, use the instructions in to create the pool. The installer supports the creation of various pool types, including stripe (not recommended, no redundancy), mirror (best performance, least usable space), and RAID-Z 1, 2, and 3 (with the capability to withstand the concurrent failure of 1, 2, and 3 disks, respectively). while selecting the pool type, a tooltip is displayed across the bottom of the screen with advice about the number of required disks, and in the case of RAID-Z, the optimal number of disks for each configuration.
<acronym>ZFS</acronym> Pool Type
Once a Pool Type has been selected, a list of available disks is displayed, and the user is prompted to select one or more disks to make up the pool. The configuration is then validated, to ensure enough disks are selected. If not, select <Change Selection> to return to the list of disks, or <Cancel> to change the pool type.
Disk Selection
Invalid Selection
If one or more disks are missing from the list, or if disks were attached after the installer was started, select - Rescan Devices to repopulate the list of available disks. To ensure that the correct disks are selected, so as not to accidently destroy the wrong disks, the - Disk Info menu can be used to inspect each disk, including its partition table and various other information such as the device model number and serial number, if available.
Analysing a Disk
The main ZFS configuration menu also allows the user to enter a pool name, disable forcing 4k sectors, enable or disable encryption, switch between GPT (recommended) and MBR partition table types, and select the amount of swap space. Once all options have been set to the desired values, select the >>> Install option at the top of the menu. If GELI disk encryption was enabled, the installer will prompt twice for the passphrase to be used to encrypt the disks.
Disk Encryption Password
The installer then offers a last chance to cancel before the contents of the selected drives are destroyed to create the ZFS pool.
Last Chance
The installation then proceeds normally.
Shell Mode Partitioning When creating advanced installations, the bsdinstall paritioning menus may not provide the level of flexibility required. Advanced users can select the Shell option from the partitioning menu in order to manually partition the drives, create the file system(s), populate /tmp/bsdinstall_etc/fstab, and mount the file systems under /mnt. Once this is done, type exit to return to bsdinstall and continue the installation.
Committing to the Installation Once the disks are configured, the next menu provides the last chance to make changes before the selected hard drive(s) are formatted. If changes need to be made, select [ Back ] to return to the main partitioning menu. [ Revert & Exit ] will exit the installer without making any changes to the hard drive.
Final Confirmation
To instead start the actual installation, select [ Commit ] and press Enter. Installation time will vary depending on the distributions chosen, installation media, and speed of the computer. A series of messages will indicate the progress. First, the installer formats the selected disk(s) and initializes the partitions. Next, in the case of a bootonly media, it downloads the selected components:
Fetching Distribution Files
Next, the integrity of the distribution files is verified to ensure they have not been corrupted during download or misread from the installation media:
Verifying Distribution Files
Finally, the verified distribution files are extracted to the disk:
Extracting Distribution Files
Once all requested distribution files have been extracted, bsdinstall displays the first post-installation configuration screen. The available post-configuration options are described in the next section.
Post-Installation Once &os; is installed, bsdinstall will prompt to configure several options before booting into the newly installed system. This section describes these configuration options. Once the system has booted, bsdconfig provides a menu-driven method for configuring the system using these and additional options. Setting the <systemitem class="username">root</systemitem> Password First, the root password must be set. While entering the password, the characters being typed are not displayed on the screen. After the password has been entered, it must be entered again. This helps prevent typing errors.
Setting the <systemitem class="username">root</systemitem> Password
Configuring Network Interfaces Next, a list of the network interfaces found on the computer is shown. Select the interface to configure. The network configuration menus will be skipped if the network was previously configured as part of a bootonly installation.
Choose a Network Interface
If an Ethernet interface is selected, the installer will skip ahead to the menu shown in . If a wireless network interface is chosen, the system will instead scan for wireless access points:
Scanning for Wireless Access Points
Wireless networks are identified by a Service Set Identifier (SSID), a short, unique name given to each network. SSIDs found during the scan are listed, followed by a description of the encryption types available for that network. If the desired SSID does not appear in the list, select [ Rescan ] to scan again. If the desired network still does not appear, check for problems with antenna connections or try moving the computer closer to the access point. Rescan after each change is made.
Choosing a Wireless Network
Next, enter the encryption information for connecting to the selected wireless network. WPA2 encryption is strongly recommended as older encryption types, like WEP, offer little security. If the network uses WPA2, input the password, also known as the Pre-Shared Key (PSK). For security reasons, the characters typed into the input box are displayed as asterisks.
WPA2 Setup
Next, choose whether or not an IPv4 address should be configured on the Ethernet or wireless interface:
Choose <acronym>IPv4</acronym> Networking
There are two methods of IPv4 configuration. DHCP will automatically configure the network interface correctly and should be used if the network provides a DHCP server. Otherwise, the addressing information needs to be input manually as a static configuration. Do not enter random network information as it will not work. If a DHCP server is not available, obtain the information listed in from the network administrator or Internet service provider. If a DHCP server is available, select [ Yes ] in the next menu to automatically configure the network interface. The installer will appear to pause for a minute or so as it finds the DHCP server and obtains the addressing information for the system.
Choose <acronym>IPv4</acronym> <acronym>DHCP</acronym> Configuration
If a DHCP server is not available, select [ No ] and input the following addressing information in this menu:
<acronym>IPv4</acronym> Static Configuration
IP Address - The IPv4 address assigned to this computer. The address must be unique and not already in use by another piece of equipment on the local network. Subnet Mask - The subnet mask for the network. Default Router - The IP address of the network's default gateway. The next screen will ask if the interface should be configured for IPv6. If IPv6 is available and desired, choose [ Yes ] to select it.
Choose IPv6 Networking
IPv6 also has two methods of configuration. StateLess Address AutoConfiguration (SLAAC) will automatically request the correct configuration information from a local router. Refer to http://tools.ietf.org/html/rfc4862 for more information. Static configuration requires manual entry of network information. If an IPv6 router is available, select [ Yes ] in the next menu to automatically configure the network interface. The installer will appear to pause for a minute or so as it finds the router and obtains the addressing information for the system.
Choose IPv6 SLAAC Configuration
If an IPv6 router is not available, select [ No ] and input the following addressing information in this menu:
IPv6 Static Configuration
IPv6 Address - The IPv6 address assigned to this computer. The address must be unique and not already in use by another piece of equipment on the local network. Default Router - The IPv6 address of the network's default gateway. The last network configuration menu is used to configure the Domain Name System (DNS) resolver, which converts hostnames to and from network addresses. If DHCP or SLAAC was used to autoconfigure the network interface, the Resolver Configuration values may already be filled in. Otherwise, enter the local network's domain name in the Search field. DNS #1 and DNS #2 are the IPv4 and/or IPv6 addresses of the DNS servers. At least one DNS server is required.
DNS Configuration
設定時區 The next menu asks if the system clock uses UTC or local time. When in doubt, select [ No ] to choose the more commonly-used local time.
Select Local or UTC Clock
The next series of menus are used to determine the correct local time by selecting the geographic region, country, and time zone. Setting the time zone allows the system to automatically correct for regional time changes, such as daylight savings time, and perform other time zone related functions properly. The example shown here is for a machine located in the Eastern time zone of the United States. The selections will vary according to the geographical location.
選擇區域
The appropriate region is selected using the arrow keys and then pressing Enter.
選擇國家
Select the appropriate country using the arrow keys and press Enter.
選擇時區
使用方向鍵選擇適當的時區,並按下 Enter
確認時區
Confirm the abbreviation for the time zone is correct. If it is, press Enter to continue with the post-installation configuration.
開啟服務 The next menu is used to configure which system services will be started whenever the system boots. All of these services are optional. Only start the services that are needed for the system to function.
Selecting Additional Services to Enable
Here is a summary of the services which can be enabled in this menu: sshd - The Secure Shell (SSH) daemon is used to remotely access a system over an encrypted connection. Only enable this service if the system should be available for remote logins. moused - Enable this service if the mouse will be used from the command-line system console. ntpd - The Network Time Protocol (NTP) daemon for automatic clock synchronization. Enable this service if there is a &windows;, Kerberos, or LDAP server on the network. powerd - System power control utility for power control and energy saving.
Enabling Crash Dumps The next menu is used to configure whether or not crash dumps should be enabled. Enabling crash dumps can be useful in debugging issues with the system, so users are encouraged to enable crash dumps.
Enabling Crash Dumps
加入使用者 The next menu prompts to create at least one user account. It is recommended to login to the system using a user account rather than as root. When logged in as root, there are essentially no limits or protection on what can be done. Logging in as a normal user is safer and more secure. Select [ Yes ] to add new users.
加入使用者帳號
Follow the prompts and input the requested information for the user account. The example shown in creates the asample user account.
輸入使用者資訊
Here is a summary of the information to input: Username - The name the user will enter to log in. A common convention is to use the first letter of the first name combined with the last name, as long as each username is unique for the system. The username is case sensitive and should not contain any spaces. Full name - The user's full name. This can contain spaces and is used as a description for the user account. Uid - User ID. Typically, this is left blank so the system will assign a value. Login group - The user's group. Typically this is left blank to accept the default. Invite user into other groups? - Additional groups to which the user will be added as a member. If the user needs administrative access, type wheel here. Login class - Typically left blank for the default. Shell - Type in one of the listed values to set the interactive shell for the user. Refer to for more information about shells. Home directory - The user's home directory. The default is usually correct. Home directory permissions - Permissions on the user's home directory. The default is usually correct. Use password-based authentication? - Typically yes so that the user is prompted to input their password at login. Use an empty password? - Typically no as it is insecure to have a blank password. Use a random password? - Typically no so that the user can set their own password in the next prompt. Enter password - The password for this user. Characters typed will not show on the screen. Enter password again - The password must be typed again for verification. Lock out the account after creation? - Typically no so that the user can login. After entering everything, a summary is shown for review. If a mistake was made, enter no and try again. If everything is correct, enter yes to create the new user.
離開使用者和群組管理
If there are more users to add, answer the Add another user? question with yes. Enter no to finish adding users and continue the installation. For more information on adding users and user management, see .
最後設定 After everything has been installed and configured, a final chance is provided to modify settings.
最後設定
Use this menu to make any changes or do any additional configuration before completing the installation. Add User - Described in . Root Password - Described in . Hostname - Described in . Network - Described in . Services - Described in . Time Zone - Described in . Handbook - Download and install the &os; Handbook. After any final configuration is complete, select Exit.
Manual Configuration
bsdinstall will prompt if there are any additional configuration that needs to be done before rebooting into the new system. Select [ Yes ] to exit to a shell within the new system or [ No ] to proceed to the last step of the installation.
Complete the Installation
If further configuration or special setup is needed, select [ Live CD ] to boot the install media into Live CD mode. If the installation is complete, select [ Reboot ] to reboot the computer and start the new &os; system. Do not forget to remove the &os; install media or the computer may boot from it again. As &os; boots, informational messages are displayed. After the system finishes booting, a login prompt is displayed. At the login: prompt, enter the username added during the installation. Avoid logging in as root. Refer to for instructions on how to become the superuser when administrative access is needed. The messages that appeared during boot can be reviewed by pressing Scroll-Lock to turn on the scroll-back buffer. The PgUp, PgDn, and arrow keys can be used to scroll back through the messages. When finished, press Scroll-Lock again to unlock the display and return to the console. To review these messages once the system has been up for some time, type less /var/run/dmesg.boot from a command prompt. Press q to return to the command line after viewing. If sshd was enabled in , the first boot may be a bit slower as the system will generate the RSA and DSA keys. Subsequent boots will be faster. The fingerprints of the keys will be displayed, as seen in this example: Generating public/private rsa1 key pair. Your identification has been saved in /etc/ssh/ssh_host_key. Your public key has been saved in /etc/ssh/ssh_host_key.pub. The key fingerprint is: 10:a0:f5:af:93:ae:a3:1a:b2:bb:3c:35:d9:5a:b3:f3 root@machine3.example.com The key's randomart image is: +--[RSA1 1024]----+ | o.. | | o . . | | . o | | o | | o S | | + + o | |o . + * | |o+ ..+ . | |==o..o+E | +-----------------+ Generating public/private dsa key pair. Your identification has been saved in /etc/ssh/ssh_host_dsa_key. Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub. The key fingerprint is: 7e:1c:ce:dc:8a:3a:18:13:5b:34:b5:cf:d9:d1:47:b2 root@machine3.example.com The key's randomart image is: +--[ DSA 1024]----+ | .. . .| | o . . + | | . .. . E .| | . . o o . . | | + S = . | | + . = o | | + . * . | | . . o . | | .o. . | +-----------------+ Starting sshd. Refer to for more information about fingerprints and SSH. &os; does not install a graphical environment by default. Refer to for more information about installing and configuring a graphical window manager. Proper shutdown of a &os; computer helps protect data and hardware from damage. Do not turn off the power before the system has been properly shut down! If the user is a member of the wheel group, become the superuser by typing su at the command line and entering the root password. Then, type shutdown -p now and the system will shut down cleanly, and if the hardware supports it, turn itself off.
故障排除 installation troubleshooting This section covers basic installation troubleshooting, such as common problems people have reported. Check the Hardware Notes (http://www.freebsd.org/releases/index.html) document for the version of &os; to make sure the hardware is supported. If the hardware is supported and lock-ups or other problems occur, build a custom kernel using the instructions in to add support for devices which are not present in the GENERIC kernel. The default kernel assumes that most hardware devices are in their factory default configuration in terms of IRQs, I/O addresses, and DMA channels. If the hardware has been reconfigured, a custom kernel configuration file can tell &os; where to find things. Some installation problems can be avoided or alleviated by updating the firmware on various hardware components, most notably the motherboard. Motherboard firmware is usually referred to as the BIOS. Most motherboard and computer manufacturers have a website for upgrades and upgrade information. Manufacturers generally advise against upgrading the motherboard BIOS unless there is a good reason for doing so, like a critical update. The upgrade process can go wrong, leaving the BIOS incomplete and the computer inoperative. If the system hangs while probing hardware during boot, or it behaves strangely during install, ACPI may be the culprit. &os; makes extensive use of the system ACPI service on the &arch.i386;, &arch.amd64;, and ia64 platforms to aid in system configuration if it is detected during boot. Unfortunately, some bugs still exist in both the ACPI driver and within system motherboards and BIOS firmware. ACPI can be disabled by setting the hint.acpi.0.disabled hint in the third stage boot loader: set hint.acpi.0.disabled="1" This is reset each time the system is booted, so it is necessary to add hint.acpi.0.disabled="1" to the file /boot/loader.conf. More information about the boot loader can be found in . 使用 Live <acronym>CD</acronym> The welcome menu of bsdinstall, shown in , provides a [ Live CD ] option. This is useful for those who are still wondering whether &os; is the right operating system for them and want to test some of the features before installing. The following points should be noted before using the [ Live CD ]: To gain access to the system, authentication is required. The username is root and the password is blank. As the system runs directly from the installation media, performance will be significantly slower than that of a system installed on a hard disk. This option only provides a command prompt and not a graphical interface.
Index: head/zh_TW.UTF-8/books/handbook/chapters.ent =================================================================== --- head/zh_TW.UTF-8/books/handbook/chapters.ent (revision 47471) +++ head/zh_TW.UTF-8/books/handbook/chapters.ent (revision 47472) @@ -1,69 +1,68 @@ %pgpkeys; - "> Index: head/zh_TW.UTF-8/books/handbook/preface/preface.xml =================================================================== --- head/zh_TW.UTF-8/books/handbook/preface/preface.xml (revision 47471) +++ head/zh_TW.UTF-8/books/handbook/preface/preface.xml (revision 47472) @@ -1,558 +1,548 @@ 給讀者的話 若您是第一次接觸 FreeBSD 的新手,可以在本書第一部分找到 FreeBSD 的安裝方法,同時會逐步介紹 &unix; 的基礎概念與一些常用、共通的東西。而閱讀這部分並不難,只需要您有探索的精神和接受新概念。 讀完這些之後,手冊中的第二部分花很長篇幅介紹的各種廣泛主題,相當值得系統管理者去注意。 在閱讀這些章節的內容時所需要的背景知識,都註釋在該章的大綱裡面,若不熟的話,可在閱讀前先預習一番。 延伸閱讀方面,可參閱 第三版的主要修訂 您目前看到的這本手冊第三版是 FreeBSD 文件計劃的成員歷時兩年完成的心血之作。 新版的主要修訂部分,如下: , 設定與效能調校(Tuning),該章節針對新內容作更新,比如: ACPI 電源管理、cron、以及其他更多的 kernel tuning 選項說明內容。 , 系統安全篇,該章節增加了虛擬私人網路(VPN)、檔案系統的存取控制(ACL),以及安全公告(Security Advisories)的內容。 , 集權式存取控制(MAC)是本版所增加的章節。本章介紹:什麼是 MAC 機制?以及如何運用它來使您的 FreeBSD 系統更安全。 , 儲存設備篇,新增了像是:USB 隨身碟、檔案系統快照(snapshot)、檔案系統配額(quota) 、檔案及網路的備援檔案系統、以及如何對硬碟分割區作加密等詳解。 PPP 及 SLIP 一章中增加了故障排除的說明。 電子郵件一章中新增有關如何使用其它的 MTA 程式、SMTP 認証、UUCP、fecthmail、procmail 的運用以及其它進階專題。 , 網路伺服器篇,是新版中全新的一章。這一章介紹了如何架設 Apache HTTP 伺服器、FTPd,以及用於支援 Microsoft Windows client 的 Samba 伺服器。其中有些段落來自原先的進階網路應用一章。 進階網路應用一章新增有關在 FreeBSD 中使用藍芽設備、安裝無線網路以及使用 ATM(Asynchronous Transfer Mode) 網路的介紹。 增加了一份詞彙表(Glossary),用以說明全書中出現的術語。 重新美編書中所列的圖表。 第二版的主要修訂 本手冊的第二版是 FreeBSD 文件計劃的成員歷時兩年完成的心血之作。第二版包含了如下的主要變動︰ 增加完整的目錄索引。 所有的 ASCII 圖表均改成圖檔格式的圖表。 每個章節均加入概述,以便快速的瀏覽該章節內容摘要、讀者所欲了解的部分。 內容架構重新組織成三大部分: 開始使用 FreeBSD, 系統管理, and 附錄 - (安裝 FreeBSD) 已經重新改寫,並加入許多說明圖片, - 讓第一次接觸 FreeBSD 的人,直接看圖就很清楚明瞭重點(一圖抵千字的效果)。 - - (&unix; 基礎概念篇)新增了 processes, daemons 和 signals 的介紹。 (軟體套件管理篇)新增了介紹如何管理 binary package 套件的資訊。 (X Window 視窗系統篇) 經過全面改寫,著重於在 &xfree86; 4.X 上的流行 x11-wm,像是: KDEGNOME (FreeBSD 開機流程篇)更新相關內容。 (儲存設備篇(Storage)) 分別以兩個章節 DisksBackups 來撰寫。我們認為這樣子會比單一章節來得容易瞭解。還有關於 RAID(包含硬體、軟體RAID) 的段落也新增上去了。 (Serial 通訊篇)架構重新改寫,並更新至 FreeBSD 4.X/5.X 的內容。 (PPP 及 SLIP)有相當程度的更新。 (進階網路應用篇)加入許多新內容。 (電子郵件篇)大量新增了設定 sendmail 的介紹。 (&linux; 相容篇) 增加許多有關安裝 &oracle;&sap.r3; 的介紹。 此外,第二版還新加章節,以介紹下列專題: , 設定與效能調校(Tuning)。 , 多媒體影音娛樂(Multimedia)。 本書架構 本書主要分為五大部分,第一部份『開始使用』:介紹 FreeBSD 的安裝、基本操作。 讀者可根據自己的程度,循序或者跳過一些熟悉的主題來閱讀; 第二部分『常用操作』:介紹 FreeBSD 常用功能,這部分可以不按順序來讀。 每章前面都會有概述,概述會描述本章節涵蓋的內容和讀者應該已知的, 這主要是讓讀者可以挑喜歡的章節閱讀; 第三部分『系統管理』:介紹 FreeBSD 老手所感興趣的各種專題部分; 第四部分『網路通訊』:則包括網路和各式 Server 專題;而第五部分『附錄』:是各種有關 FreeBSD 的資源。 , 簡介篇 向新手介紹 FreeBSD。該篇說明了 FreeBSD 計劃的歷史、目標和開發模式。 - - - - , 安裝篇 - - 介紹安裝程序。其中還有介紹一些進階的安裝主題,包括像是如何透過 serial console 來安裝。 , &unix; 基礎概念篇 Covers the basic commands and functionality of the FreeBSD operating system. If you are familiar with &linux; or another flavor of &unix; then you can probably skip this chapter. , 軟體套件管理篇 Covers the installation of third-party software with both FreeBSD's innovative Ports Collection and standard binary packages. , X Window 視窗系統篇 Describes the X Window System in general and using X11 on FreeBSD in particular. Also describes common desktop environments such as KDE and GNOME. , Desktop Applications Lists some common desktop applications, such as web browsers and productivity suites, and describes how to install them on FreeBSD. , Multimedia Shows how to set up sound and video playback support for your system. Also describes some sample audio and video applications. , Configuring the FreeBSD Kernel Explains why you might need to configure a new kernel and provides detailed instructions for configuring, building, and installing a custom kernel. , 列印篇 Describes managing printers on FreeBSD, including information about banner pages, printer accounting, and initial setup. , &linux; Binary Compatibility Describes the &linux; compatibility features of FreeBSD. Also provides detailed installation instructions for many popular &linux; applications such as &oracle;, &sap.r3;, and &mathematica;. Describes the parameters available for system administrators to tune a &os; system for optimum performance. Also describes the various configuration files used in &os; and where to find them. Describes the &os; boot process and explains how to control this process with configuration options. Describes many different tools available to help keep your &os; system secure, including Kerberos, IPsec and OpenSSH. Describes the jails framework, and the improvements of jails over the traditional chroot support of &os;. Explains what Mandatory Access Control (MAC) is and how this mechanism can be used to secure a &os; system. Describes what &os; Event Auditing is, how it can be installed, configured, and how audit trails can be inspected or monitored. Describes how to manage storage media and filesystems with &os;. This includes physical disks, RAID arrays, optical and tape media, memory-backed disks, and network filesystems. Describes what the GEOM framework in &os; is and how to configure various supported RAID levels. Examines support of non-native file systems in &os;, like the Z File System from &sun;. Describes what virtualization systems offer, and how they can be used with &os;. Describes how to use &os; in languages other than English. Covers both system and application level localization. Explains the differences between &os;-STABLE, &os;-CURRENT, and &os; releases. Describes which users would benefit from tracking a development system and outlines that process. Covers the methods users may take to update their system to the latest security release. Describes how to configure and use the &dtrace; tool from &sun; in &os;. Dynamic tracing can help locate performance issues, by performing real time system analysis. , Serial Communications Explains how to connect terminals and modems to your FreeBSD system for both dial in and dial out connections. , PPP and SLIP Describes how to use PPP, SLIP, or PPP over Ethernet to connect to remote systems with FreeBSD. , Electronic Mail Explains the different components of an email server and dives into simple configuration topics for the most popular mail server software: sendmail. , Network Servers Provides detailed instructions and example configuration files to set up your FreeBSD machine as a network filesystem server, domain name server, network information system server, or time synchronization server. , Firewalls Explains the philosophy behind software-based firewalls and provides detailed information about the configuration of the different firewalls available for FreeBSD. , Advanced Networking Describes many networking topics, including sharing an Internet connection with other computers on your LAN, advanced routing topics, wireless networking, bluetooth, ATM, IPv6, and much more. , Obtaining FreeBSD Lists different sources for obtaining FreeBSD media on CDROM or DVD as well as different sites on the Internet that allow you to download and install FreeBSD. , Bibliography This book touches on many different subjects that may leave you hungry for a more detailed explanation. The bibliography lists many excellent books that are referenced in the text. , Resources on the Internet Describes the many forums available for FreeBSD users to post questions and engage in technical conversations about FreeBSD. , PGP Keys Lists the PGP fingerprints of several FreeBSD Developers. 本書的編排體裁 為方便閱讀本書,以下是一些本書所遵循的編排體裁: 文字編排體裁 斜體字(Italic) 斜體字型(Italic) 用於:檔名、目錄、網址(URL)、 強調語氣、以及第一次提及的技術詞彙。 定寬字(Monospace) 定寬字(Monospace) 用於: 錯誤訊息、指令、環境變數、port 名稱、主機名稱(hostname)、帳號、群組、設備(device)名稱、變數、 程式碼等。 粗體字型(Bold) 粗體字表示:應用程式、命令、按鍵。 使用者輸入 鍵盤輸入以 粗體字(Bold) 表示,以便與一般文字做區隔。 組合鍵是指同時按下一些按鍵,我們以 `+' 來表示連接,像是: Ctrl Alt Del 也就是說,一起按 Ctrl 鍵、 Alt 鍵,以及 Del 鍵。 若要逐一按鍵,那麼會以逗號(,)來表示,像是: Ctrl X , Ctrl S 也就是說:先同時按下 CtrlX 鍵, 然後放開後再同時按 CtrlS 鍵。 舉個實例 下面例子以 E:\> 為開頭的代表 &ms-dos; 指令部分。 若沒有特殊情況的話,這些指令應該是在 µsoft.windows; 環境的 命令提示字元(Command Prompt) 內執行。 E:\> tools\fdimage floppies\kern.flp A: 例子若是先以 &prompt.root; 為開頭再接指令的話,就是指在 FreeBSD 中以 root 權限來下命令。 你可以先以 root登入系統並下指令,或是以你自己的帳號登入,並使用 &man.su.1; 來取得 root 權限。 &prompt.root; dd if=kern.flp of=/dev/fd0 例子若是先以 &prompt.user; 為開頭再接指令的話,就是指在 FreeBSD 中以一般帳號來下命令即可。 除非有提到其他用法,否則都是預設為 C-shell(csh/tcsh) 語法,用來設定環境變數以及下其他指令的意思。 &prompt.user; top 致謝 您所看到的這本書是經過數百個分散在世界各地的人所努力而來的結果。 無論他們只是糾正一些錯誤或提交完整的章節,所有的點滴貢獻都是非常寶貴有用的。 也有一些公司透過提供資金讓作者專注於撰稿、提供出版資金等模式來支持文件的寫作。 其中,BSDi (之後併入 Wind River Systems) 資助 FreeBSD 文件計劃成員來專職改善這本書直到 2000 年 3 月第一版的出版。(ISBN 1-57176-241-8) Wind River Systems 同時資助其他作者來對輸出架構做很多改進,以及給文章增加一些附加章節。這項工作結束於 2001 年 11 月第二版。(ISBN 1-57176-303-1) 在 2003-2004 兩年中,FreeBSD Mall 把報酬支付給改進這本手冊以使第三版印刷版本能夠出版的志工。 Index: head/zh_TW.UTF-8/books/handbook/virtualization/chapter.xml =================================================================== --- head/zh_TW.UTF-8/books/handbook/virtualization/chapter.xml (revision 47471) +++ head/zh_TW.UTF-8/books/handbook/virtualization/chapter.xml (revision 47472) @@ -1,886 +1,885 @@ Virtualization(虛擬機器) MurrayStokelyContributed by Synopsis 虛擬機器軟體可以讓同一台機器得以同時執行多種作業系統。 在 PC 上, 通常這類系統都是在宿主(host)機器上裝虛擬機器軟體,來跑一堆 guest OS 。 讀完這章,您將了解︰ host OS 以及 guest OS 的區別。 如何在搭載 &intel; CPU 的 &apple; &macintosh; 電腦上安裝 FreeBSD 。 如何在 Linux 上以 &xen; 來安裝 FreeBSD。 如何在 µsoft.windows; 上以 Virtual PC 安裝 FreeBSD。 如何在虛擬機器對 FreeBSD 系統作性能調校,以取得最佳效能。 在開始閱讀這章之前,您需要︰ 瞭解 &unix; 及 FreeBSD 相關基本概念 ()。 - 知道如何安裝 FreeBSD()。 + 知道如何安裝 FreeBSD()。 知道如何設定網路()。 知道如何以 ports/packages 來安裝應用程式 ()。 安裝 FreeBSD 為 Guest OS MacOS 上的 Parallels &mac; 版的 Parallels Desktop 乃是可用於搭配 &intel; CPU 以及 &macos; 10.4.6 以上的 &apple; &mac; 電腦的商業軟體。 FreeBSD 是其有完整支援的 guest OS 之一。 在 &macos; X 裝好 Parallels 後, 必須針對所欲安裝的 guest OS 來作相關的虛擬機器設定。 在 Parallels/&macos; X 上安裝 FreeBSD 在 &macos; X/Parallels 上安裝 FreeBSD 的第一步是新增虛擬機器。 如下所示,在提示視窗內請將 Guest OS Type 勾選為 FreeBSD 並依據自身需求來規劃硬碟容量跟記憶體的分配。 對大多數在 Parallels 使用的情況而言,大約 4GB 硬碟以及 512MB RAM 就夠用了: 接下來,選擇網路種類以及網路卡: 最後,儲存設定檔就完成設定了: 在 FreeBSD 虛擬機器新增後,就可以繼續以其安裝 FreeBSD。 安裝方面,比較好的作法是使用官方的 FreeBSD 光碟或者從官方 FTP 站下載 ISO image 檔。 若您的 &mac; 本機已經有該 ISO 檔, 或者 &mac; 的光碟機內有放安裝片,那麼就可以在 FreeBSD 的 Parallels 視窗右下角按下光碟片圖示。 接著會出現一個視窗,可以把虛擬機器內的光碟機設定到該 ISO 檔, 或者是實體光碟機。 設好光碟片來源之後,就可以按下重開機圖示以重開 FreeBSD 虛擬機器。 Parallels 會以特殊 BIOS 開機,並與普通的 BIOS 一樣會先檢查是否有光碟機。 - 此時,它就會找到 FreeBSD 安裝片,並開始在 內所介紹到的 - sysinstall 安裝過程。 這時候也可順便裝 - X11,但先不要進行相關設定。 + 此時,它就會找到 FreeBSD 安裝片,並開始安裝過程。 這時候也可順便裝 + &xorg;, 但先不要進行相關設定。 完成安裝過程之後,就可以重開剛裝的 FreeBSD 虛擬機器。 在 &macos; X/Parallels 上設定 FreeBSD 把 FreeBSD 成功裝到 &macos; X 的 Parallels 之後,還需要作一些設定步驟, 以便將虛擬機器內的 FreeBSD 最佳化。 設定 boot loader 參數 最重要的步驟乃是藉由調降 來降低 Parallels 環境內 FreeBSD 的 CPU 佔用率。 可以在 /boot/loader.conf 內加上下列設定即可: kern.hz=100 若不作這設定,那麼光是 idle 狀態的 FreeBSD (Parallels guest OS) 就會在僅單一處理器的 &imac; 上佔了大約 15% 的 CPU 佔用率。 作上述修改之後,佔用率就會降至大約 5%。 設定新的 kernel 設定檔 可以放心把所有 SCSI、FireWire、USB 相關設備都移除。 Parallels 有提供 &man.ed.4; 的虛擬網卡,因此,除了 &man.ed.4; 以及 &man.miibus.4; 以外的其他網路卡也都可以從 kernel 中移除。 設定網路 可以替虛擬機器簡單用 DHCP 來設定與 &mac; 相同的 LAN 網路環境,只要在 /etc/rc.conf 內加上 ifconfig_ed0="DHCP" 即可完成。 其他進階的網路設定方式,請參考 在 Linux 透過 &xen; 跑 FreeBSD FukangChen (Loader)Contributed by &xen; hypervisor 乃是開放源碼的 paravirtualization 產品,並由商業公司(XenSource)提供支援。 Guest OS 通常被稱為 domU domains,而 host OS 則是被稱為 dom0。 在 Linux 上建立 FreeBSD 虛擬機器的第一步,則是安裝 Linux dom0 的 &xen;。 在本例中, host OS 乃是 Slackware Linux。 在 Linux dom0 上設定 &xen; 3 從 XenSource 網站下載 &xen; 3.0 http://www.xensource.com/ 下載 xen-3.0.4_1-src.tgz。 解壓縮 &prompt.root; cd xen-3.0.4_1-src &prompt.root; KERNELS="linux-2.6-xen0 linux-2.6-xenU" make world &prompt.root; make install 為 dom0 重新編譯 kernel: &prompt.root; cd xen-3.0.4_1-src/linux-2.6.16.33-xen0 &prompt.root; make menuconfig &prompt.root; make &prompt.root; make install 舊版的 &xen; 可能需要用 make ARCH=xen menuconfig 增加選項到 Grub 的 menu.lst 選單 修改 /boot/grub/menu.lst 加上下列設定: title Xen-3.0.4 root (hd0,0) kernel /boot/xen-3.0.4-1.gz dom0_mem=262144 module /boot/vmlinuz-2.6.16.33-xen0 root=/dev/hda1 ro 重開機並進入 &xen; 首先,修改 /etc/xen/xend-config.sxp 加上下列設定: (network-script 'network-bridge netdev=eth0') 接下來,就可以啟動 &xen; &prompt.root; /etc/init.d/xend start &prompt.root; /etc/init.d/xendomains start 現在 dom0 已經開始運作: &prompt.root; xm list Name ID Mem VCPUs State Time(s) Domain-0 0 256 1 r----- 54452.9 FreeBSD 7-CURRENT domU http://www.fsmware.com/ 下載搭配 &xen; 3.0 的 FreeBSD domU kernel 相關檔案 kernel-current mdroot-7.0.bz2 xmexample1.bsd xmexample1.bsd 設定檔放到 /etc/xen/,並修改 kernel 及 disk image 相關位置。 以下是示範的例子: kernel = "/opt/kernel-current" memory = 256 name = "freebsd" vif = [ '' ] disk = [ 'file:/opt/mdroot-7.0,hda1,w' ] #on_crash = 'preserve' extra = "boot_verbose" extra += ",boot_single" extra += ",kern.hz=100" extra += ",vfs.root.mountfrom=ufs:/dev/xbd769a" 其中 mdroot-7.0.bz2 檔要記得解壓縮之。 接下來,要修改 kernel-current 設定檔的 __xen_guest 小節,並加上 &xen; 3.0.3 所需的 VIRT_BASE: &prompt.root; objcopy kernel-current -R __xen_guest &prompt.root; perl -e 'print "LOADER=generic,GUEST_OS=freebsd,GUEST_VER=7.0,XEN_VER=xen-3.0,BSD_SYMTAB,VIRT_BASE=0xC0000000\x00"' > tmp &prompt.root; objcopy kernel-current --add-section __xen_guest=tmp &prompt.root; objdump -j __xen_guest -s kernel-current kernel-current: file format elf32-i386 Contents of section __xen_guest: 0000 4c4f4144 45523d67 656e6572 69632c47 LOADER=generic,G 0010 55455354 5f4f533d 66726565 6273642c UEST_OS=freebsd, 0020 47554553 545f5645 523d372e 302c5845 GUEST_VER=7.0,XE 0030 4e5f5645 523d7865 6e2d332e 302c4253 N_VER=xen-3.0,BS 0040 445f5359 4d544142 2c564952 545f4241 D_SYMTAB,VIRT_BA 0050 53453d30 78433030 30303030 3000 SE=0xC0000000. 現在可以新增並啟動 domU 囉: &prompt.root; xm create /etc/xen/xmexample1.bsd -c Using config file "/etc/xen/xmexample1.bsd". Started domain freebsd WARNING: loader(8) metadata is missing! Copyright (c) 1992-2006 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 7.0-CURRENT #113: Wed Jan 4 06:25:43 UTC 2006 kmacy@freebsd7.gateway.2wire.net:/usr/home/kmacy/p4/freebsd7_xen3/src/sys/i386-xen/compile/XENCONF WARNING: DIAGNOSTIC option enabled, expect reduced performance. Xen reported: 1796.927 MHz processor. Timecounter "ixen" frequency 1796927000 Hz quality 0 CPU: Intel(R) Pentium(R) 4 CPU 1.80GHz (1796.93-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0xf29 Stepping = 9 Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH, DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> Features2=0x4400<CNTX-ID,<b14>> real memory = 265244672 (252 MB) avail memory = 255963136 (244 MB) xc0: <Xen Console> on motherboard cpu0 on motherboard Timecounters tick every 10.000 msec [XEN] Initialising virtual ethernet driver. xn0: Ethernet address: 00:16:3e:6b:de:3a [XEN] Trying to mount root from ufs:/dev/xbd769a WARNING: / was not properly dismounted Loading configuration files. No suitable dump device was found. Entropy harvesting: interrupts ethernet point_to_point kickstart. Starting file system checks: /dev/xbd769a: 18859 files, 140370 used, 113473 free (10769 frags, 12838 blocks, 4.2% fragmentation) Setting hostname: demo.freebsd.org. lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 Additional routing options:. Mounting NFS file systems:. Starting syslogd. /etc/rc: WARNING: Dump device does not exist. Savecore not run. ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/X11R6/lib /usr/local/lib a.out ldconfig path: /usr/lib/aout /usr/lib/compat/aout /usr/X11R6/lib/aout Starting usbd. usb: Kernel module not available: No such file or directory Starting local daemons:. Updating motd. Starting sshd. Initial i386 initialization:. Additional ABI support: linux. Starting cron. Local package initialization:. Additional TCP options:. Starting background file system checks in 60 seconds. Sun Apr 1 02:11:43 UTC 2007 FreeBSD/i386 (demo.freebsd.org) (xc0) login: 現在 domU 應該可以跑 &os; 7.0-CURRENT kernel: &prompt.root; uname -a FreeBSD demo.freebsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #113: Wed Jan 4 06:25:43 UTC 2006 kmacy@freebsd7.gateway.2wire.net:/usr/home/kmacy/p4/freebsd7_xen3/src/sys/i386-xen/compile/XENCONF i386 接下來是設定 domU 的網路,&os; domU 會用代號為 xn0 的特殊網路卡: &prompt.root; ifconfig xn0 10.10.10.200 netmask 255.0.0.0 &prompt.root; ifconfig xn0: flags=843<UP,BROADCAST,RUNNING,SIMPLEX> mtu 1500 inet 10.10.10.200 netmask 0xff000000 broadcast 10.255.255.255 ether 00:16:3e:6b:de:3a lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 在 dom0 Slackware 上應該會出現一些 &xen; 專用的網路卡: &prompt.root; ifconfig eth0 Link encap:Ethernet HWaddr 00:07:E9:A0:02:C2 inet addr:10.10.10.130 Bcast:0.0.0.0 Mask:255.0.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:815 errors:0 dropped:0 overruns:0 frame:0 TX packets:1400 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:204857 (200.0 KiB) TX bytes:129915 (126.8 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:99 errors:0 dropped:0 overruns:0 frame:0 TX packets:99 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:9744 (9.5 KiB) TX bytes:9744 (9.5 KiB) peth0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 RX packets:1853349 errors:0 dropped:0 overruns:0 frame:0 TX packets:952923 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2432115831 (2.2 GiB) TX bytes:86528526 (82.5 MiB) Base address:0xc000 Memory:ef020000-ef040000 vif0.1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 RX packets:1400 errors:0 dropped:0 overruns:0 frame:0 TX packets:815 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:129915 (126.8 KiB) TX bytes:204857 (200.0 KiB) vif1.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:2 errors:0 dropped:157 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:140 (140.0 b) TX bytes:158 (158.0 b) xenbr1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 RX packets:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:112 (112.0 b) TX bytes:0 (0.0 b) &prompt.root; brctl show bridge name bridge id STP enabled interfaces xenbr1 8000.feffffffffff no vif0.1 peth0 vif1.0 &windows; 上的 Virtual PC Virtual PC 是 µsoft; 的 &windows; 軟體產品,可以免費下載使用。 相關系統需求,請參閱 system requirements 說明。 在 µsoft.windows; 裝完 Virtual PC 之後, 必須針對所欲安裝的虛擬機器來作相關設定。 在 Virtual PC/µsoft.windows; 上安裝 FreeBSD 在 µsoft.windows;/Virtual PC 上安裝 FreeBSD 的第一步是新增虛擬機器。 如下所示, 在提示視窗內請選擇 Create a virtual machine 然後在 Operating system 處選 Other 並依據自身需求來規劃硬碟容量跟記憶體的分配。 對大多數在 Virtual PC 使用 FreeBSD 的情況而言,大約 4GB 硬碟空間以及 512MB RAM 就夠用了: 儲存設定檔: 接下來選剛剛所新增的 FreeBSD 虛擬機器,並按下 Settings,以設定網路種類以及網路卡: 在 FreeBSD 虛擬機器新增後,就可以繼續以其安裝 FreeBSD。 安裝方面,比較好的作法是使用官方的 FreeBSD 光碟或者從官方 FTP 站下載 ISO image 檔。 若您的 &windows; 檔案系統內已經有該 ISO 檔, 或者光碟機內有放安裝片,那麼就可以在 FreeBSD 虛擬機器上連按兩下,以開始啟動。 接著在 Virtual PC 視窗內按 CD 再按 Capture ISO Image... 。 接著會出現一個視窗,可以把虛擬機器內的光碟機設定到該 ISO 檔, 或者是實體光碟機。 設好光碟片來源之後,就可以重開機,也就是先按 Action 再按 Reset 即可。 Virtual PC 會以特殊 BIOS 開機,並與普通 BIOS 一樣會先檢查是否有光碟機。 - 此時,它就會找到 FreeBSD 安裝片,並開始在 內所介紹到的 sysinstall - 安裝過程。 這時候也可順便裝 X11,但先不要進行相關設定。 + 此時,它就會找到 FreeBSD 安裝片,並開始安裝過程。 這時候也可順便裝 + &xorg;, 但先不要進行相關設定。 完成安裝之後,記得把光碟片退出或者 ISO image 退片。 最後, 把裝好的 FreeBSD 虛擬機器重開機即可。 調整 µsoft.windows;/Virtual PC 上的 FreeBSD 在 µsoft.windows; 上以 Virtual PC 裝好 FreeBSD 後,還需要作一些設定步驟, 以便將虛擬機器內的 FreeBSD 最佳化。 設定 boot loader 參數 最重要的步驟乃是藉由調降 來降低 Virtual PC 環境內 FreeBSD 的 CPU 佔用率。 可以在 /boot/loader.conf 內加上下列設定即可: kern.hz=100 若不作這設定,那麼光是 idle 狀態的 FreeBSD Virtual PC guest OS 就會在僅單一處理器的電腦上佔了大約 40% 的 CPU 佔用率。 作上述修改之後,佔用率就會降至大約 3%。 設定新的 kernel 設定檔 可以放心把所有 SCSI、FireWire、USB 相關設備都移除。 Virtual PC 有提供 &man.de.4; 的虛擬網卡,因此除了 &man.de.4; 以及 &man.miibus.4; 以外的其他網路卡也都可以從 kernel 中移除。 設定網路 可以替虛擬機器簡單用 DHCP 來設定與 host(µsoft.windows;) 相同的 LAN 網路環境,只要在 /etc/rc.conf 加上 ifconfig_de0="DHCP" 即可完成。 其他進階的網路設定方式,請參閱 在 MacOS 上的 VMware &mac; 上的 VMWare Fusion 乃是可用於搭配 &intel; CPU 以及 &macos; 10.4.9 之 &apple; &mac; 以上的 &apple; &mac; 電腦之商業軟體。 FreeBSD 是其有完整支援的 guest OS 之一。 在 &macos; X 上裝完 VMWare Fusion 之後, 必須針對所欲安裝的 guest OS 來作相關的虛擬機器設定。 在 VMWare/&macos; X 上安裝 FreeBSD 首先執行 VMWare Fusion,而其 Virtual Machine Library 也會隨之一併載入,這時請按 "New" 來建立 VM(虛擬機器): 接著會有 New Virtual Machine Assistant 來協助您建立 VM,請按 Continue 繼續: Operating SystemOther,以及 Version 處請選擇是否要 FreeBSDFreeBSD 64-bit,這部份請依自身需求是否有要 64-bit 支援而定: 接著設定 VM image 檔要存到何處,以及決定名稱: 決定該 VM 的虛擬硬碟要用多大: 選擇要裝 VM 的方式為何,要用 ISO image 檔或者光碟機: 按 Finish 以完畢,接著就會啟動該 VM: 接著就照以往安裝 &os; 的方式來裝,若不熟的話請參閱 - + 裝完之後,就可以修改一些 VM 設定,像是記憶體大小: VM 在運作之時,不能修改 VM 的硬體設定。 調整 VM 的 CPU 數量: 光碟機狀態,通常不再需要用的時候,就可以切斷其與 VM 的連接: 最後要改的則是 VM 的網路設定。 若除了 Host OS 之外的機器也能連到 VM,那麼請選 Connect directly to the physical network (Bridged),否則就選 Share the host's internet connection (NAT) 即可讓 VM 連到 Internet, 但外面則無法連入該 VM。 改完上述設定之後,就可以啟動新裝妥的 FreeBSD 虛擬機器。 調整 &macos; X/VMWare 上的 FreeBSD 把 FreeBSD 成功裝到 &macos; X 的 VMWare 之後,還需要作一些設定步驟, 以便將虛擬機器內的 FreeBSD 最佳化。 設定 boot loader 參數 最重要的步驟乃是藉由調降 來降低 VMWare 環境內 FreeBSD 的 CPU 佔用率。 可以在 /boot/loader.conf 內加上下列設定即可: kern.hz=100 若不作這設定,那麼光是 idle 狀態的 FreeBSD (VMWare guest OS) 就會在僅單一處理器的 &imac; 上佔了大約 15% 的 CPU 佔用率。 作上述修改之後, 佔用率就會降至大約 5%。 設定新的 kernel 設定檔 可以放心把所有 FireWire、USB 相關設備都移除。 VMWare 有提供 &man.em.4; 的虛擬網卡, 因此,除了 &man.em.4; 以及 &man.miibus.4; 以外的其他網路卡, 也都可以從 kernel 中移除。 設定網路 可以替虛擬機器簡單用 DHCP 來設定與 host &mac; 相同的 LAN 網路環境,只要在 /etc/rc.conf 加上 ifconfig_em0="DHCP" 即可。 其他進階的網路設定方式,請參考 以 FreeBSD 為 Host OS 目前,尚未有任何虛擬機器軟體有官方支援 FreeBSD 作為 host OS, 但蠻多人都有在用舊版 VMware 所提供的這項功能。 不過,目前已經有人為讓 &xen; 能夠以 FreeBSD 為 host OS 為目標,而進行相關工作。 Index: head/zh_TW.UTF-8/books/handbook/x11/chapter.xml =================================================================== --- head/zh_TW.UTF-8/books/handbook/x11/chapter.xml (revision 47471) +++ head/zh_TW.UTF-8/books/handbook/x11/chapter.xml (revision 47472) @@ -1,1516 +1,1515 @@ X Window 視窗系統 KenTomUpdated for X.Org's X11 server by MarcFonvieille 概述 FreeBSD 使用 X11 來提供使用者相當好用的 GUI 介面。 X11 是 X Window 系統,包括 &xorg; 以及 &xfree86; 實作的自由軟體版本 (以及其他未在本章有介紹的軟體)。 &os; 一直到 &os; 5.2.1-RELEASE 都仍可在預設的安裝程式內去裝 &xfree86; (由 The &xfree86; Project, Inc 發行的 X11 server)。 而 &os; 5.3-RELEASE 起,預設的 X11 改為 &xorg;(由 X.Org 基金會所開發的 X11 server,並採用與 &os; 相當類似的 license)。 此外,當然也有商業 X servers 的 &os; 版。 本章主要是介紹 X11 (主要著重於 &xorg; &xorg.version; 版部分)的安裝與設定。 若欲瞭解 &xfree86; 的詳細資料(早期的 &os; 內, &xfree86; 乃是預設的 X11 套件),請參閱舊版的 &os; Handbook,網址為 http://docs.FreeBSD.org/doc/ 欲知 X11 對於顯示方面硬體的支援情況,請參閱 &xorg; 網站。 讀完這章,您將了解: X Window 系統的各組成部份,以及它們是如何相互運作。 如何安裝、設定 X11。 如何安裝並使用不同的 window managers。 如何在 X11 上使用 &truetype; 字型。 如何設定系統以使用圖形登入介面。 (XDM) 在開始閱讀這章之前,您需要︰ 知道如何運用 ports、packages 來安裝軟體。 () 瞭解 X 的世界 第一次接觸 X 的人,大概都會有些震撼,尤其是熟悉其他 GUI 介面(像是 µsoft.windows; 或 &macos;)的使用者。 雖然 X 各元件的所有細節及運作方式,並不是必須要知道的。 但對它們有些基本概念會更容易上手。 為何叫做 X? X 並非 &unix; 上第一套視窗系統,但它卻是最廣為流傳運用。 原本的 X 研發團隊在研發 X 之前有開發另一套視窗系統。 那套系統叫做 W(取 Window 的第一個字)。 而 X 則是 W 之後的下一個羅馬字母。 X 亦被稱之為 XX Window SystemX11,以及其他一些詞彙。 使用 X Windows 這字眼來稱呼 X11,可能會讓有些人不爽;這部分細節可參閱 &man.X.7; 說明。 X 的 Client/Server 架構 X 一開始是設計為網路架構環境,並採用 client-server 架構。 在 X 架構下, X server 是在有鍵盤、螢幕、滑鼠的電腦上運作。 而 server 部份則是負責像是顯示部份的管理、 處理來自鍵盤、滑鼠及其他設備(比方像是以繪圖板來輸入、 或者是顯示到投影機)的輸入等等, 每個 X 程式(像是 XTerm,或 &netscape;)都是 client。 client 會傳訊息到 server 上,比如:Please draw a window at these coordinates,接著 server 會傳回訊息,比如: The user just clicked on the OK button 在家庭或小辦公室環境,通常 X server 跟 X client 都是在同一台電腦上執行的。 然而,也可以在比較爛的桌機上執行 X server, 並在比較強、比較貴的電腦上跑 X 程式(client)來做事情。 在這種場景,X client 與 server 之間的溝通就需透過網路來進行。 這點可能會讓有些人產生困惑,因為 X 術語與他們原本的認知剛好相反。 他們原本以為 X server 是要在最強悍的機器上跑才行,而 X client 則是在他們桌機上面跑。 實際上卻不是這樣。 有點相當重要,請記住 X server 是在有接螢幕、鍵盤的機器上運作, 而 X client 則是顯示這些視窗的程式。 協定(protocol)內並無強制規定 client 以及 server 兩邊機器都得是同一作業系統,或者得是同型機器才可以。 換句話說,也可以在 µsoft.windows; 或蘋果電腦(Apple)的 &macos; 上跑 X server,而且可以透過許多免費或商業軟體完成這些安裝、設定。 The Window Manager X 設計哲學與 &unix; 設計哲學相當類似,都是 tools, not policy。 也就是說,X 不會試圖強制規定某任務應該要如何完成,而是只提供使用者一些工具, 至於如何運用這些工具,則是使用者本身的事了。 X 延續這哲學,它並不規定:螢幕上的視窗該長什麼樣、要如何移動滑鼠指標、 該用什麼組合鍵來切換各視窗(比如:在 µsoft.windows; 的 Alt Tab 鍵)、各視窗的標題列長相,以及是否該有關閉鈕等等。 事實上,X 把這部分交給所謂的 Window Manager 來管理。 有一堆 window manager 程式,像是: AfterStepBlackboxctwmEnlightenmentfvwmSawfishtwmWindow Maker 等等。每一種 window manager 都提供不同的使用經驗; 有些還可使用 virtual desktops(虛擬桌面) ;有些則可自訂組合鍵來管理桌面;有些會有 Start(開始) 鈕或其他類似設計;有些則是 可更換佈景主題, 可自行安裝新的佈景主題以更換外觀。 這些跟其他的 window manager 在 Ports Collection 內的 x11-wm 目錄內都有。 此外,KDEGNOME 桌面環境則有其自屬並整合完整的 window manager。 每個 window manager 也各有其不同的設定機制;有些需手動寫設定檔, 而有的則可透過 GUI 工具來完成大部分的設定。舉個例子: Sawfish 就有以 Lisp 語言寫的設定檔。 Focus Policy window manager 的另一特色就是負責滑鼠指標的 focus policy。 每一種視窗系統都需要選擇作用視窗的方式 ,以接受鍵盤輸入,以及決定目前哪個視窗是處於使用中的狀態。 通常較為人熟悉的 focus policy 叫做 click-to-focus, 這是 µsoft.windows; 所採用的模式,也就是指標在該視窗按一下的話, 該視窗就會處於使用中的狀態。 X 並不支援一些特殊的 focus policy。 換句話說,window manager 會控制哪個視窗在何時是作用中。 不同的 window manager 有不同的支援方式。 但它們都支援 click-to-focus, 而且大多數都有支援多種方式。 以下是目前最流行的 focus policy: focus-follows-mouse 滑鼠移到哪個視窗就是使用該視窗。 該視窗不一定位於其他視窗上面, 但只要把滑鼠移到該視窗就可以改變作用中的視窗, 而不需在它上面點擊。 sloppy-focus 該 policy 是針對 focus-follows-mouse 的小小延伸。 對於 focus-follows-mouse 而言,若把游標移到最初的視窗(或桌面), 那所有其他視窗都會處於非作用中,而且所有鍵盤輸入也會失效。 若是選用 sloppy-focus,則只有在游標移到新視窗時, 作用中的視窗才會變成新的, 而只離開目前作用中的視窗仍不會改變作用狀態。 click-to-focus 由游標點擊才會決定作用中的視窗。 並且該視窗會被 raised(凸顯) 到所有其他視窗之前, 即使游標移到其他視窗,所有的鍵盤輸入仍會由該視窗所接收。 許多 window manager 也支援其他 policy,與這些相比起來又有些不同, 細節部分請參閱該 window manager 的文件說明。 Widgets The X approach of providing tools and not policy extends to the widgets seen on screen in each application. Widget is a term for all the items in the user interface that can be clicked or manipulated in some way; buttons, check boxes, radio buttons, icons, lists, and so on. µsoft.windows; calls these controls. µsoft.windows; and Apple's &macos; both have a very rigid widget policy. Application developers are supposed to ensure that their applications share a common look and feel. With X, it was not considered sensible to mandate a particular graphical style, or set of widgets to adhere to. As a result, do not expect X applications to have a common look and feel. There are several popular widget sets and variations, including the original Athena widget set from MIT, &motif; (on which the widget set in µsoft.windows; was modeled, all bevelled edges and three shades of grey), OpenLook, and others. Most newer X applications today will use a modern-looking widget set, either Qt, used by KDE, or GTK+, used by the GNOME project. In this respect, there is some convergence in look-and-feel of the &unix; desktop, which certainly makes things easier for the novice user. 安裝 X11 &xorg; 是 &os; 預設的 X11 實作。 &xorg; 是由 X.Org 基金會所發行之開放源碼軟體 X Window 系統實作的 X server。 &xorg; 乃是以 &xfree86; 4.4RC2 以及 X11R6.6 為基礎所產生的。 目前 &os; Ports Collection 內的 &xorg; 版本為 &xorg.version;。 從 Ports Collection 來安裝 &xorg; 的安裝方式: &prompt.root; cd /usr/ports/x11/xorg &prompt.root; make install clean 若要編譯完整的 &xorg;, 請先確認至少有 4 GB 的磁碟空間。 此外 X11 也可直接透過 package 方式來安裝,可使用 &man.pkg.add.1; 來安裝編譯好的 X11 套件,記得在透過網路安裝時不要指定版本即可, &man.pkg.add.1; 會自動抓該套件最新版的套件回來。 若要自動透過 package 方式來裝 &xorg; ,直接打下面這行即可: &prompt.root; pkg_add -r xorg 上面的例子會裝完整的 X11 套件,包括 server、client、字型等。 此外,還有其他的 X11 子套件可透過 package 或 port 方式來單獨安裝。 本章其餘部分將介紹如何設定 X11, 以及如何打造高生產力的桌面環境。 設定 X11 ChristopherShumwayContributed by &xorg; X11 在開始之前 在開始設定 X11 之前,要先瞭解所要裝的機器資料為何: 螢幕規格 顯示卡的晶片規格 顯示卡的記憶體容量 horizontal scan rate vertical scan rate X11 會依螢幕規格來決定解析度以及更新頻率。 這些規格通常可從螢幕所附的文件或廠商網站上取得。 最重要的是要知道水平、垂直更新頻率為何。 而顯示卡晶片則決定 X11 要用哪一種驅動程式模組。 大多數的晶片都可以自動偵測,但最好還是要知道是何種晶片, 以免萬一自動偵測失敗。 Video memory on the graphic adapter determines the resolution and color depth which the system can run at. This is important to know so the user knows the limitations of the system. 設定 X11 &xorg; 自 7.3 版起不再需任何設定檔,只要打下列即可: &prompt.user; startx 若這指令不行或預設設定無法使用,那麼就需要手動設定 X11。 設定 X11 需要幾個步驟,首先是以系統管理者帳號來建立初始設定檔: &prompt.root; Xorg -configure 這會在 /root 目錄內產生 xorg.conf.new 設定檔(無論是用 &man.su.1; 或直接登入為 root,都會改變 root 預設的 $HOME 環境變數)。 X11 程式接著會偵測系統的顯示卡相關硬體,並將偵測到硬體訊息寫入設定檔, 以便載入正確的驅動程式。 下一步是測試現有的設定檔,以便確認 &xorg; 可以與顯示卡、螢幕相關硬體正確運作: &prompt.root; Xorg -config xorg.conf.new 若看得到一堆黑灰夾雜的網格畫面,以及 X 形的滑鼠游標, 那麼設定檔就是成功的。 要退出測試,只要同時按下 Ctrl Alt Backspace 即可。 - 若滑鼠不正確運作,那麼需要先對其作設定。 請參閱 - &os; 安裝一章中的 說明。 + 若滑鼠不正確運作,那麼需要先對其作設定。 X11 tuning Next, tune the xorg.conf.new configuration file to taste. Open the file in a text editor such as &man.emacs.1; or &man.ee.1;. First, add the frequencies for the target system's monitor. These are usually expressed as a horizontal and vertical synchronization rate. These values are added to the xorg.conf.new file under the "Monitor" section: Section "Monitor" Identifier "Monitor0" VendorName "Monitor Vendor" ModelName "Monitor Model" HorizSync 30-107 VertRefresh 48-120 EndSection The HorizSync and VertRefresh keywords may be missing in the configuration file. If they are, they need to be added, with the correct horizontal synchronization rate placed after the HorizSync keyword and the vertical synchronization rate after the VertRefresh keyword. In the example above the target monitor's rates were entered. X allows DPMS (Energy Star) features to be used with capable monitors. The &man.xset.1; program controls the time-outs and can force standby, suspend, or off modes. If you wish to enable DPMS features for your monitor, you must add the following line to the monitor section: Option "DPMS" xorg.conf While the xorg.conf.new configuration file is still open in an editor, select the default resolution and color depth desired. This is defined in the "Screen" section: Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Viewport 0 0 Depth 24 Modes "1024x768" EndSubSection EndSection The DefaultDepth keyword describes the color depth to run at by default. This can be overridden with the command line switch to &man.Xorg.1;. The Modes keyword describes the resolution to run at for the given color depth. Note that only VESA standard modes are supported as defined by the target system's graphics hardware. In the example above, the default color depth is twenty-four bits per pixel. At this color depth, the accepted resolution is 1024 by 768 pixels. Finally, write the configuration file and test it using the test mode given above. One of the tools available to assist you during troubleshooting process are the X11 log files, which contain information on each device that the X11 server attaches to. &xorg; log file names are in the format of /var/log/Xorg.0.log. The exact name of the log can vary from Xorg.0.log to Xorg.8.log and so forth. If all is well, the configuration file needs to be installed in a common location where &man.Xorg.1; can find it. This is typically /etc/X11/xorg.conf or /usr/local/etc/X11/xorg.conf. &prompt.root; cp xorg.conf.new /etc/X11/xorg.conf The X11 configuration process is now complete. &xorg; 目前可透過 &man.startx.1; 來啟動之。 The X11 server may also be started with the use of &man.xdm.1;. There is also a graphical configuration tool, &man.xorgcfg.1;, which comes with the X11 distribution. It allows you to interactively define your configuration by choosing the appropriate drivers and settings. This program can be invoked from the console, by typing the command xorgcfg -textmode. For more details, refer to the &man.xorgcfg.1; manual pages. Alternatively, there is also a tool called &man.xorgconfig.1;. This program is a console utility that is less user friendly, but it may work in situations where the other tools do not. 進階設定專欄 設定 &intel; i810 繪圖晶片組 Intel i810 graphic chipset Configuration with &intel; i810 integrated chipsets requires the agpgart AGP programming interface for X11 to drive the card. 詳情請參閱 &man.agp.4; 說明。 This will allow configuration of the hardware as any other graphics board. Note on systems without the &man.agp.4; driver compiled in the kernel, trying to load the module with &man.kldload.8; will not work. This driver has to be in the kernel at boot time through being compiled in or using /boot/loader.conf. 為寬螢幕打造更舒適環境 widescreen flatpanel configuration 本節假設各位已經有些微進階設定的功力。 如果試著使用上述設定工具會有問題的話,請多利用相關 log 檔 (會記錄相關訊息)以便找出解法。 找尋解法過程中,可能會需要用到文字編輯器作為輔助。 目前的寬螢幕 (WSXGA, WSXGA+, WUXGA, WXGA, WXGA+ 等) 都有支援 16:10 及 10:9 比例,以及一些可能有問題的比例。 以下是一些常見的 16:10 螢幕解析度: 2560x1600 1920x1200 1680x1050 1440x900 1280x800 某方面而言,要增加這些解析度設定也是相當容易的, 只要在 Section "Screen" 內的 Mode 加上去就好,比如: Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Viewport 0 0 Depth 24 Modes "1680x1050" EndSubSection EndSection &xorg; 可以透過 I2C/DDC 來得知該寬螢幕所支援的解析度等相關資訊, 因此就能正確偵測出該螢幕所能支援的頻率、解析度。 若驅動程式並未包括 ModeLine 訊息的話, 那麼就要為 &xorg; 做些設定才行。 我們可以透過 /var/log/Xorg.0.log 檔來取得 ModeLine 相關設定資料,即可讓螢幕正常顯示。 應該可以看到類似下面的訊息: (II) MGA(0): Supported additional Video Mode: (II) MGA(0): clock: 146.2 MHz Image Size: 433 x 271 mm (II) MGA(0): h_active: 1680 h_sync: 1784 h_sync_end 1960 h_blank_end 2240 h_border: 0 (II) MGA(0): v_active: 1050 v_sync: 1053 v_sync_end 1059 v_blanking: 1089 v_border: 0 (II) MGA(0): Ranges: V min: 48 V max: 85 Hz, H min: 30 H max: 94 kHz, PixClock max 170 MHz 這些訊息被稱為 EDID 訊息。 可以藉由這些資料, 搭配下列的正確順序來產生 ModeLine 設定: ModeLine <name> <clock> <4 horiz. timings> <4 vert. timings> 所以這個案例 Section "Monitor"ModeLine 就會是像下面這樣: Section "Monitor" Identifier "Monitor1" VendorName "Bigname" ModelName "BestModel" ModeLine "1680x1050" 146.2 1680 1784 1960 2240 1050 1053 1059 1089 Option "DPMS" EndSection 這樣子就簡單完成了,X 視窗就可以打造為新的寬螢幕環境囉。 在 X11 中使用字型 MurrayStokelyContributed by Type1 規格的字型 The default fonts that ship with X11 are less than ideal for typical desktop publishing applications. Large presentation fonts show up jagged and unprofessional looking, and small fonts in &netscape; are almost completely unintelligible. However, there are several free, high quality Type1 (&postscript;) fonts available which can be readily used with X11. For instance, the URW font collection (x11-fonts/urwfonts) includes high quality versions of standard type1 fonts (Times Roman, Helvetica, Palatino and others). The Freefonts collection (x11-fonts/freefonts) includes many more fonts, but most of them are intended for use in graphics software such as the Gimp, and are not complete enough to serve as screen fonts. In addition, X11 can be configured to use &truetype; fonts with a minimum of effort. For more details on this, see the &man.X.7; manual page or the section on &truetype; fonts. To install the above Type1 font collections from the ports collection, run the following commands: &prompt.root; cd /usr/ports/x11-fonts/urwfonts &prompt.root; make install clean And likewise with the freefont or other collections. To have the X server detect these fonts, add an appropriate line to the X server configuration file (/etc/X11/xorg.conf), which reads: FontPath "/usr/local/lib/X11/fonts/URW/" Alternatively, at the command line in the X session run: &prompt.user; xset fp+ /usr/local/lib/X11/fonts/URW &prompt.user; xset fp rehash This will work but will be lost when the X session is closed, unless it is added to the startup file (~/.xinitrc for a normal startx session, or ~/.xsession when logging in through a graphical login manager like XDM). A third way is to use the new /usr/local/etc/fonts/local.conf file: see the section on anti-aliasing. &truetype; 規格的字型 TrueType Fonts fonts TrueType &xorg; has built in support for rendering &truetype; fonts. There are two different modules that can enable this functionality. The freetype module is used in this example because it is more consistent with the other font rendering back-ends. To enable the freetype module just add the following line to the "Module" section of the /etc/X11/xorg.conf file. Load "freetype" Now make a directory for the &truetype; fonts (for example, /usr/local/lib/X11/fonts/TrueType) and copy all of the &truetype; fonts into this directory. Keep in mind that &truetype; fonts cannot be directly taken from a &macintosh;; they must be in &unix;/&ms-dos;/&windows; format for use by X11. Once the files have been copied into this directory, use ttmkfdir to create a fonts.dir file, so that the X font renderer knows that these new files have been installed. ttmkfdir is available from the FreeBSD Ports Collection as x11-fonts/ttmkfdir. &prompt.root; cd /usr/local/lib/X11/fonts/TrueType &prompt.root; ttmkfdir -o fonts.dir Now add the &truetype; directory to the font path. This is just the same as described above for Type1 fonts, that is, use &prompt.user; xset fp+ /usr/local/lib/X11/fonts/TrueType &prompt.user; xset fp rehash or add a FontPath line to the xorg.conf file. That's it. Now &netscape;, Gimp, &staroffice;, and all of the other X applications should now recognize the installed &truetype; fonts. Extremely small fonts (as with text in a high resolution display on a web page) and extremely large fonts (within &staroffice;) will look much better now. Anti-Aliased 規格的字型 Joe MarcusClarkeUpdated by anti-aliased fonts fonts anti-aliased Anti-aliasing has been available in X11 since &xfree86; 4.0.2. However, font configuration was cumbersome before the introduction of &xfree86; 4.3.0. Beginning with &xfree86; 4.3.0, all fonts in X11 that are found in /usr/local/lib/X11/fonts/ and ~/.fonts/ are automatically made available for anti-aliasing to Xft-aware applications. Not all applications are Xft-aware, but many have received Xft support. Examples of Xft-aware applications include Qt 2.3 and higher (the toolkit for the KDE desktop), GTK+ 2.0 and higher (the toolkit for the GNOME desktop), and Mozilla 1.2 and higher. In order to control which fonts are anti-aliased, or to configure anti-aliasing properties, create (or edit, if it already exists) the file /usr/local/etc/fonts/local.conf. Several advanced features of the Xft font system can be tuned using this file; this section describes only some simple possibilities. For more details, please see &man.fonts-conf.5;. XML This file must be in XML format. Pay careful attention to case, and make sure all tags are properly closed. The file begins with the usual XML header followed by a DOCTYPE definition, and then the <fontconfig> tag: <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> As previously stated, all fonts in /usr/local/lib/X11/fonts/ as well as ~/.fonts/ are already made available to Xft-aware applications. If you wish to add another directory outside of these two directory trees, add a line similar to the following to /usr/local/etc/fonts/local.conf: <dir>/path/to/my/fonts</dir> After adding new fonts, and especially new font directories, you should run the following command to rebuild the font caches: &prompt.root; fc-cache -f Anti-aliasing makes borders slightly fuzzy, which makes very small text more readable and removes staircases from large text, but can cause eyestrain if applied to normal text. To exclude font sizes smaller than 14 point from anti-aliasing, include these lines: <match target="font"> <test name="size" compare="less"> <double>14</double> </test> <edit name="antialias" mode="assign"> <bool>false</bool> </edit> </match> <match target="font"> <test name="pixelsize" compare="less" qual="any"> <double>14</double> </test> <edit mode="assign" name="antialias"> <bool>false</bool> </edit> </match> fonts spacing Spacing for some monospaced fonts may also be inappropriate with anti-aliasing. This seems to be an issue with KDE, in particular. One possible fix for this is to force the spacing for such fonts to be 100. Add the following lines: <match target="pattern" name="family"> <test qual="any" name="family"> <string>fixed</string> </test> <edit name="family" mode="assign"> <string>mono</string> </edit> </match> <match target="pattern" name="family"> <test qual="any" name="family"> <string>console</string> </test> <edit name="family" mode="assign"> <string>mono</string> </edit> </match> (this aliases the other common names for fixed fonts as "mono"), and then add: <match target="pattern" name="family"> <test qual="any" name="family"> <string>mono</string> </test> <edit name="spacing" mode="assign"> <int>100</int> </edit> </match> Certain fonts, such as Helvetica, may have a problem when anti-aliased. Usually this manifests itself as a font that seems cut in half vertically. At worst, it may cause applications such as Mozilla to crash. To avoid this, consider adding the following to local.conf: <match target="pattern" name="family"> <test qual="any" name="family"> <string>Helvetica</string> </test> <edit name="family" mode="assign"> <string>sans-serif</string> </edit> </match> Once you have finished editing local.conf make sure you end the file with the </fontconfig> tag. Not doing this will cause your changes to be ignored. The default font set that comes with X11 is not very desirable when it comes to anti-aliasing. A much better set of default fonts can be found in the x11-fonts/bitstream-vera port. This port will install a /usr/local/etc/fonts/local.conf file if one does not exist already. If the file does exist, the port will create a /usr/local/etc/fonts/local.conf-vera file. Merge the contents of this file into /usr/local/etc/fonts/local.conf, and the Bitstream fonts will automatically replace the default X11 Serif, Sans Serif, and Monospaced fonts. Finally, users can add their own settings via their personal .fonts.conf files. To do this, each user should simply create a ~/.fonts.conf. This file must also be in XML format. LCD screen Fonts LCD screen One last point: with an LCD screen, sub-pixel sampling may be desired. This basically treats the (horizontally separated) red, green and blue components separately to improve the horizontal resolution; the results can be dramatic. To enable this, add the line somewhere in the local.conf file: <match target="font"> <test qual="all" name="rgba"> <const>unknown</const> </test> <edit name="rgba" mode="assign"> <const>rgb</const> </edit> </match> Depending on the sort of display, rgb may need to be changed to bgr, vrgb or vbgr: experiment and see which works best. Mozilla disabling anti-aliased fonts Anti-aliasing should be enabled the next time the X server is started. However, programs must know how to take advantage of it. At present, the Qt toolkit does, so the entire KDE environment can use anti-aliased fonts. GTK+ and GNOME can also be made to use anti-aliasing via the Font capplet (see for details). By default, Mozilla 1.2 and greater will automatically use anti-aliasing. To disable this, rebuild Mozilla with the -DWITHOUT_XFT flag. The X Display Manager SethKingsleyContributed by Overview X Display Manager The X Display Manager (XDM) is an optional part of the X Window System that is used for login session management. This is useful for several types of situations, including minimal X Terminals, desktops, and large network display servers. Since the X Window System is network and protocol independent, there are a wide variety of possible configurations for running X clients and servers on different machines connected by a network. XDM provides a graphical interface for choosing which display server to connect to, and entering authorization information such as a login and password combination. Think of XDM as providing the same functionality to the user as the &man.getty.8; utility (see for details). That is, it performs system logins to the display being connected to and then runs a session manager on behalf of the user (usually an X window manager). XDM then waits for this program to exit, signaling that the user is done and should be logged out of the display. At this point, XDM can display the login and display chooser screens for the next user to login. Using XDM The XDM daemon program is located in /usr/local/bin/xdm. This program can be run at any time as root and it will start managing the X display on the local machine. If XDM is to be run every time the machine boots up, a convenient way to do this is by adding an entry to /etc/ttys. For more information about the format and usage of this file, see . There is a line in the default /etc/ttys file for running the XDM daemon on a virtual terminal: ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure By default this entry is disabled; in order to enable it change field 5 from off to on and restart &man.init.8; using the directions in . The first field, the name of the terminal this program will manage, is ttyv8. This means that XDM will start running on the 9th virtual terminal. Configuring XDM The XDM configuration directory is located in /usr/local/lib/X11/xdm. In this directory there are several files used to change the behavior and appearance of XDM. Typically these files will be found: File Description Xaccess Client authorization ruleset. Xresources Default X resource values. Xservers List of remote and local displays to manage. Xsession Default session script for logins. Xsetup_* Script to launch applications before the login interface. xdm-config Global configuration for all displays running on this machine. xdm-errors Errors generated by the server program. xdm-pid The process ID of the currently running XDM. Also in this directory are a few scripts and programs used to set up the desktop when XDM is running. The purpose of each of these files will be briefly described. The exact syntax and usage of all of these files is described in &man.xdm.1;. The default configuration is a simple rectangular login window with the hostname of the machine displayed at the top in a large font and Login: and Password: prompts below. This is a good starting point for changing the look and feel of XDM screens. Xaccess The protocol for connecting to XDM-controlled displays is called the X Display Manager Connection Protocol (XDMCP). This file is a ruleset for controlling XDMCP connections from remote machines. It is ignored unless the xdm-config is changed to listen for remote connections. By default, it does not allow any clients to connect. Xresources This is an application-defaults file for the display chooser and login screens. In it, the appearance of the login program can be modified. The format is identical to the app-defaults file described in the X11 documentation. Xservers This is a list of the remote displays the chooser should provide as choices. Xsession This is the default session script for XDM to run after a user has logged in. Normally each user will have a customized session script in ~/.xsession that overrides this script. Xsetup_* These will be run automatically before displaying the chooser or login interfaces. There is a script for each display being used, named Xsetup_ followed by the local display number (for instance Xsetup_0). Typically these scripts will run one or two programs in the background such as xconsole. xdm-config This contains settings in the form of app-defaults that are applicable to every display that this installation manages. xdm-errors This contains the output of the X servers that XDM is trying to run. If a display that XDM is trying to start hangs for some reason, this is a good place to look for error messages. These messages are also written to the user's ~/.xsession-errors file on a per-session basis. Running a Network Display Server In order for other clients to connect to the display server, you must edit the access control rules, and enable the connection listener. By default these are set to conservative values. To make XDM listen for connections, first comment out a line in the xdm-config file: ! SECURITY: do not listen for XDMCP or Chooser requests ! Comment out this line if you want to manage X terminals with xdm DisplayManager.requestPort: 0 and then restart XDM. Remember that comments in app-defaults files begin with a ! character, not the usual #. More strict access controls may be desired — look at the example entries in Xaccess, and refer to the &man.xdm.1; manual page for further infomation. Replacements for XDM Several replacements for the default XDM program exist. One of them, kdm (bundled with KDE) is described later in this chapter. The kdm display manager offers many visual improvements and cosmetic frills, as well as the functionality to allow users to choose their window manager of choice at login time. 桌面環境 ValentinoVaschettoContributed by 本章會介紹在 FreeBSD 中的 X 裡頭,有哪些不同的桌面環境。 桌面環境範圍很廣,從簡單的 window manager 到 完整的桌面應用程式,例如 KDEGNOME GNOME 關於 GNOME GNOME GNOME is a user-friendly desktop environment that enables users to easily use and configure their computers. GNOME includes a panel (for starting applications and displaying status), a desktop (where data and applications can be placed), a set of standard desktop tools and applications, and a set of conventions that make it easy for applications to cooperate and be consistent with each other. Users of other operating systems or environments should feel right at home using the powerful graphics-driven environment that GNOME provides. More information regarding GNOME on FreeBSD can be found on the FreeBSD GNOME Project's web site. The web site also contains fairly comprehensive FAQs about installing, configuring, and managing GNOME. Installing GNOME 可透過 package 或 Ports Collection 的方式來輕鬆安裝: 透過網路利用 package 安裝 GNOME &prompt.root; pkg_add -r gnome2 從 ports tree 透過原始碼編譯安裝 GNOME &prompt.root; cd /usr/ports/x11/gnome2 &prompt.root; make install clean GNOME 安裝完成後, 必須告訴 X server 啟動 GNOME 而非原本的 window manager。 啟動 GNOME 最簡單的方法是利 用 GDM(GNOME Display Manager)。 GDM, which is installed as a part of the GNOME desktop (but is disabled by default), can be enabled by adding gdm_enable="YES" to /etc/rc.conf. Once you have rebooted, GNOME will start automatically once you log in — no further configuration is necessary. GNOME may also be started from the command-line by properly configuring a file named .xinitrc. If a custom .xinitrc is already in place, simply replace the line that starts the current window manager with one that starts /usr/local/bin/gnome-session instead. If nothing special has been done to the configuration file, then it is enough simply to type: &prompt.user; echo "/usr/local/bin/gnome-session" > ~/.xinitrc Next, type startx, and the GNOME desktop environment will be started. If an older display manager, like XDM, is being used, this will not work. Instead, create an executable .xsession file with the same command in it. To do this, edit the file and replace the existing window manager command with /usr/local/bin/gnome-session: &prompt.user; echo "#!/bin/sh" > ~/.xsession &prompt.user; echo "/usr/local/bin/gnome-session" >> ~/.xsession &prompt.user; chmod +x ~/.xsession Yet another option is to configure the display manager to allow choosing the window manager at login time; the section on KDE details explains how to do this for kdm, the display manager of KDE. Anti-aliased Fonts with GNOME GNOME anti-aliased fonts X11 supports anti-aliasing via its RENDER extension. GTK+ 2.0 and greater (the toolkit used by GNOME) can make use of this functionality. Configuring anti-aliasing is described in . So, with up-to-date software, anti-aliasing is possible within the GNOME desktop. Just go to Applications Desktop Preferences Font, and select either Best shapes, Best contrast, or Subpixel smoothing (LCDs). For a GTK+ application that is not part of the GNOME desktop, set the environment variable GDK_USE_XFT to 1 before launching the program. KDE KDE About KDE KDE is an easy to use contemporary desktop environment. Some of the things that KDE brings to the user are: A beautiful contemporary desktop A desktop exhibiting complete network transparency An integrated help system allowing for convenient, consistent access to help on the use of the KDE desktop and its applications Consistent look and feel of all KDE applications Standardized menu and toolbars, keybindings, color-schemes, etc. Internationalization: KDE is available in more than 40 languages Centralized, consistent, dialog-driven desktop configuration A great number of useful KDE applications KDE comes with a web browser called Konqueror, which is a solid competitor to other existing web browsers on &unix; systems. More information on KDE can be found on the KDE website. For FreeBSD specific information and resources on KDE, consult the KDE on FreeBSD team's website. 安裝 KDE 如同 GNOME 或其他桌面管理軟體一樣, 也可以輕鬆透過 package 或 Ports Collection 來安裝: To install the KDE package from the network, simply type: &prompt.root; pkg_add -r kde &man.pkg.add.1; will automatically fetch the latest version of the application. To build KDE from source, use the ports tree: &prompt.root; cd /usr/ports/x11/kde3 &prompt.root; make install clean After KDE has been installed, the X server must be told to launch this application instead of the default window manager. This is accomplished by editing the .xinitrc file: &prompt.user; echo "exec startkde" > ~/.xinitrc Now, whenever the X Window System is invoked with startx, KDE will be the desktop. If a display manager such as XDM is being used, the configuration is slightly different. Edit the .xsession file instead. Instructions for kdm are described later in this chapter. More Details on KDE Now that KDE is installed on the system, most things can be discovered through the help pages, or just by pointing and clicking at various menus. &windows; or &mac; users will feel quite at home. The best reference for KDE is the on-line documentation. KDE comes with its own web browser, Konqueror, dozens of useful applications, and extensive documentation. The remainder of this section discusses the technical items that are difficult to learn by random exploration. The KDE Display Manager KDE display manager An administrator of a multi-user system may wish to have a graphical login screen to welcome users. XDM can be used, as described earlier. However, KDE includes an alternative, kdm, which is designed to look more attractive and include more login-time options. In particular, users can easily choose (via a menu) which desktop environment (KDE, GNOME, or something else) to run after logging on. To enable kdm, the ttyv8 entry in /etc/ttys has to be adapted. The line should look as follows: ttyv8 "/usr/local/bin/kdm -nodaemon" xterm on secure XFce About XFce XFce is a desktop environment based on the GTK+ toolkit used by GNOME, but is much more lightweight and meant for those who want a simple, efficient desktop which is nevertheless easy to use and configure. Visually, it looks very much like CDE, found on commercial &unix; systems. Some of XFce's features are: A simple, easy-to-handle desktop Fully configurable via mouse, with drag and drop, etc. Main panel similar to CDE, with menus, applets and applications launchers Integrated window manager, file manager, sound manager, GNOME compliance module, and more Themeable (since it uses GTK+) Fast, light and efficient: ideal for older/slower machines or machines with memory limitations More information on XFce can be found on the XFce website. Installing XFce A binary package for XFce exists (at the time of writing). To install, simply type: &prompt.root; pkg_add -r xfce4 Alternatively, to build from source, use the ports collection: &prompt.root; cd /usr/ports/x11-wm/xfce4 &prompt.root; make install clean Now, tell the X server to launch XFce the next time X is started. Simply type this: &prompt.user; echo "/usr/local/bin/startxfce4" > ~/.xinitrc The next time X is started, XFce will be the desktop. As before, if a display manager like XDM is being used, create an .xsession, as described in the section on GNOME, but with the /usr/local/bin/startxfce4 command; or, configure the display manager to allow choosing a desktop at login time, as explained in the section on kdm.