diff --git a/zh_TW.Big5/books/handbook/basics/chapter.sgml b/zh_TW.Big5/books/handbook/basics/chapter.sgml index f570ed39a6..f6d4f9ed02 100644 --- a/zh_TW.Big5/books/handbook/basics/chapter.sgml +++ b/zh_TW.Big5/books/handbook/basics/chapter.sgml @@ -1,2382 +1,2363 @@ Chris Shumway Rewritten by UNIX 基礎概念 概述 接下來的這一章將涵蓋 FreeBSD 作業系統的基本指令及功能。 大部份的內容在 &unix;-like 作業系統中都是相通的。 如果您對這些內容熟悉的話,可以放心的跳過。 如果您剛接觸 FreeBSD,那您一定要仔細的讀完這章。 讀完這章,您將了解: 如何使用 FreeBSD 的virtual consoles &unix; 檔案權限運作的方式以及 &os; 中檔案的 flags。 預設的 &os; 檔案系統配置。 &os; 的磁碟結構。 如何掛載(mount)、卸載(umount)檔案系統 什麼是processes、daemons 以及 signals 。 什麼是 shell ,以及如何變更您預設的登入環境。 如何使用基本的文字編輯器。 什麼是 devices 和 device nodes 。 &os; 下使用的 binary 格式。 如何閱讀 manual pages 以獲得更多的資訊。 Virtual Consoles 和終端機 virtual consoles terminals 有很多方法可以操作 FreeBSD ,其中一種就是在文字終端機上打字。 如此使用 FreeBSD 即可輕易的體會到 &unix; 作業系統的威力和彈性。 這一節描述什麼是終端機console ,以及可以如何在 FreeBSD 中運用它們。 The Console console 如果您沒有將 FreeBSD 設定成開機時自動進入圖形化模式,系統會在啟動的 script 跑完之後顯示登入的提示符號。 您將會看到像是這樣的東西: Additional ABI support:. Local package initialization:. Additional TCP options:. Fri Sep 20 13:01:06 EEST 2002 FreeBSD/i386 (pc3.example.org) (ttyv0) login: 這個訊息在您的系統上會有些許的不同,但是應該會看到類似的東西。 我們感興趣的是最後兩行,最後兩行是: FreeBSD/i386 (pc3.example.org) (ttyv0) 這行包含了剛開機完系統的資訊。 您看到的是在 Intel 或相容處理器的 x86 架構上執行的 FreeBSD的 console 這就是 i386 的意義。 注意即使您不是在 Intel 的 386 處理器上執行 FreeBSD ,一樣是i386。 這不是指你的處理器的型號,這裡顯示的是你處理器的架構 。 這台機器的名字(每台 &unix; 機器都有一個名字)是 pc3.example.org,而您現在看到的是它的系統 console— ttyv0終端機。 最後的一行應該都會是: login: 這是您應該要輸入您的帳號名稱的地方。 下一小節將告訴您如何登入 FreeBSD。 登入 FreeBSD FreeBSD 是一個 multiuser、multiprocessing 的系統。 這是一個正式的名稱,指的是在單一機器上可以同時被不同人使用, 但同時可以執行很多程式的系統。 每一種多使用者系統都需要可以分辨不同使用者的方法。 在 FreeBSD (以及所有的 &unix;-like 作業系統) 中,所有的使用者在執行程式之前必須先登入系統。 每個使用者都有一組獨特的帳號名稱 (username)及密碼(password)。 FreeBSD 在允許使用者執行程式前將會先問這兩個問題。 startup scripts 在 FreeBSD 開機並跑完起動的 script 之後 這些起動的 script 是在開機的時候 FreeBSD 會自動執行的程式。 他們主要的功能是將所有該執行的東西設定好, 並將您設定成背景執行的服務啟動。 ,它將會印出提示字元要求您輸入正確的帳號名稱: login: 在這個範例裡,我們假設您的帳號是john。 在提示字元處輸入 john 並按下 Enter 。 接著您應該會看到另一個提示字元要您輸入密碼 login: john Password: 輸入 john 的密碼,再按下 Enter。 輸入的密碼 不會顯示在螢幕上。 您不需要為此擔心,這樣做是為了安全上的問題。 如果您輸入了正確的密碼,您應該已經登入 FreeBSD。 現在就可以嘗試所有可用的指令了。 您應該會看到MOTD (即今日訊息、Messages Of The Day),後面接著命令提示字元 (一個 #,$, 或是 % 字元)。 這就表示您已經成功登入 FreeBSD 了。 多重 Console 在一個 Console 下執行 &unix; 當然是沒有問題,然而 FreeBSD 是可以同時執行很多程式的。 像 FreeBSD 這樣可以同時執行一大堆程式的作業系統,只有一個 console 可以輸入指令實在是有點浪費。 因此 virtual consoles 就顯得相當好用。 可以設定讓 FreeBSD 同時有很多 virtual console, 用幾個按鍵的組合就可以從一個 virtual console 跳到別的 virtual console 。 每一個 console 都有自已不同的輸出頻道,當從某一個 virtual console 切換到下一個的時候,FreeBSD 會自動處理鍵盤輸入及螢幕輸出。 FreeBSD 保留了特別的按鍵組合來切換 console 在 &man.syscons.4;、&man.atkbd.4;、&man.vidcontrol.1;、以及 &man.kbdcontrol.1;等 manual page 中,對於 FreeBSD 的 console 及鍵盤驅動程式有詳細的技術說明。 我們在這裡不討論細節, 有興趣的讀者隨時可以在 manual pages 中查到關於運作方式的更詳細且完整的解釋。。 您可以用 AltF1AltF2、到 AltF8 來切換 FreeBSD 的不同 console。 當您從一個 console 切換到下一個的時候,FreeBSD 會處理螢幕輸出的儲存及回復。 這就好像有很多虛擬的螢幕和鍵盤, 可以讓您輸入指令到 FreeBSD 執行。 在某一個 console 上執行的程式並不會因為切到別的 console 而停止執行,切換到另一個 console 時,它們仍會繼續執行。 <filename>/etc/ttys</filename> 檔 FreeBSD 預設的虛擬 console 總共有 8 個, 但這並非硬性規定,您可輕鬆設定這些虛擬 console 的數量增減。 有關虛擬 console 的編號跟設定都在 /etc/ttys 這檔案內設定。 可以用 /etc/ttys 檔案來設定 FreeBSD 的虛擬 console。 檔案內每行非註解文字(該行開頭沒有 # 這字)都是設定終端機或虛擬 console。 FreeBSD 預設有 9 個虛擬 console 但只啟動 8 個,也就是以下以 ttyv 開頭的那幾行設定。 # name getty type status comments # ttyv0 "/usr/libexec/getty Pc" cons25 on secure # Virtual terminals ttyv1 "/usr/libexec/getty Pc" cons25 on secure ttyv2 "/usr/libexec/getty Pc" cons25 on secure ttyv3 "/usr/libexec/getty Pc" cons25 on secure ttyv4 "/usr/libexec/getty Pc" cons25 on secure ttyv5 "/usr/libexec/getty Pc" cons25 on secure ttyv6 "/usr/libexec/getty Pc" cons25 on secure ttyv7 "/usr/libexec/getty Pc" cons25 on secure ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure 有關各欄位的設定以及其他選項,請參閱 &man.ttys.5; 說明。 Single User 模式的 Console 有關 single user 模式 的介紹在 這邊有詳盡介紹。 在 single user 模式時,能夠使用的 console 只有一個,並無虛擬 console 可用。 而 single user 模式相關設定值可以在 /etc/ttys 檔做調整。 下面以 console 開頭的那行,就是了: # name getty type status comments # # If console is marked "insecure", then init will ask for the root password # when going to single-user mode. console none unknown off secure console 那行前面的註解有提到,可以把那行的 secure 改為 insecure, 如此一來,即使 FreeBSD 進入 single user 模式, 仍會要求您輸入 root 的密碼。 請審慎考慮是否要改為 insecure。 因為萬一忘記 root 密碼的話,若要登入 single user 模式就有些麻煩了。儘管還有其他方式可以登入,但對不熟 FreeBSD 開機程序的人而言,就會相當棘手。 權限 UNIX FreeBSD 源自於 BSD &unix;,繼承了幾個重要的 &unix; 概念。 首先也最明顯,它是一款 multi-user 作業系統。 它可以同時處理多人多工, 負責徹底的分享與管理來自每位使用者對硬碟裝置、週邊設備、記憶體及 CPU 時間的要求。 也因為系統能夠支援多使用者, 所以系統管理的一切都有權限來決定誰可以讀取、寫入或執行資源。 這些權限分別使用三組八進位的數字儲存,一組代表檔案的所有者, 一組代表檔案所屬的群組,而最後一組則代表其他所有人。 表示這些數字的方式如下: permissions file permissions 權限 目錄顯示 0 不可讀取, 不可寫入, 不可執行 --- 1 不可讀取, 不可寫入, 可執行 --x 2 不可讀取, 可寫入, 不可執行 -w- 3 不可讀取, 可寫入, 可執行 -wx 4 可讀取, 不可寫入, 不可執行 r-- 5 可讀取, 不可寫入, 可執行 r-x 6 可讀取, 可寫入, 不可執行 rw- 7 可讀取, 可寫入, 可執行 rwx ls directories 使用 &man.ls.1; 指令時,可以加上 參數, 來檢視詳細的目錄清單。 清單中欄位的資訊包含檔案對所有者、群組及其他人的權限。 在任一個目錄底下執行 ls -l,會顯示如下的結果: &prompt.user; ls -l total 530 -rw-r--r-- 1 root wheel 512 Sep 5 12:31 myfile -rw-r--r-- 1 root wheel 512 Sep 5 12:31 otherfile -rw-r--r-- 1 root wheel 7680 Sep 5 12:31 email.txt ... 在這裡告所您該如何區分 ls -l 第一欄當中的資訊: -rw-r--r-- 第一個 (最左邊) 的字元用來表示這個檔案的類型為何, 除標準檔案以外,尚有目錄、特殊字元裝置 (Special character device)、 Socket 及其他特殊虛擬檔案裝置 (Special pseudo-file device), 在此例當中,- 表示該檔案為一個標準的檔案。 範例中接下來的三個字元中,rw- 代表所有者對檔案擁有的權限。 再接下來的三個字元, r-- 則代表群組對檔案擁有的權限, 最後三個字元,r-- 則代表其他人對檔案擁有的權限。 破折號 (-) 表示沒有權限,範例中的這個檔案的權限, 只允許所有者讀取、寫入檔案,群組以及其他人僅能讀取檔案。 根據以上的表格,此種權限的檔案可以使用 644 來表示, 每組數字分別代表檔案的三種權限。 以上是不錯的方式,但系統該如何控制裝置的權限? 實際上 FreeBSD 對大多的硬碟裝置就如同檔案,程式可以開啟、讀取以及寫入資料如一般檔案。 這些特殊裝置檔案 (Special device file) 都儲存於 /dev 目錄中。 目錄也同如檔案,擁有讀取、寫入及執行的權限, 但在執行權限上與檔案有明顯的差異。 當目錄被標示為可執行時,代表可以使用 cd (更改目錄) 進入該目錄。 也代表能夠存取在此目錄之中的已知檔名的檔案 (當然,檔案仍擁有自己的權限) 尤其,要能夠列出目錄內容,必須擁有目錄的讀取權限。 而當要刪除已知檔名的檔案時,也必須擁有檔案所在目錄的寫入 以及 執行的權限。 還有一些權限,但這些權限主要在特殊情況使用,如 setuid binaries 及 sticky directories。 如果您還想知道更多檔案權限的資訊及使用方法,請務必參閱 &man.chmod.1; 說明文件。 Tom Rhodes Contributed by 權限符號 permissionssymbolic 權限符號可稱做符號表示, 使用字元的方式來取代使用數值來設定檔案或目錄的權限。 符號表示的格式依序為 (某人)(動作)(權限),可使用的符號如下: 項目 字母 意義 (某人) u 使用者 (某人) g 群組所有者 (某人) o 其他 (某人) a 全部(world) (動作) + 增加權限 (動作) - 移除權限 (動作) = 指定權限 (權限) r 讀取 (權限) w 寫入 (權限) x 執行 (權限) t Sticky bit (權限) s Set UID 或 GID 如先前同樣使用 &man.chmod.1; 指令來設定,但使用的參數為這些字元。 例如,您可以使用下列指令禁止其他使用者存取檔案 FILE: &prompt.user; chmod go= FILE 若有兩個以上的符號表示可以使用逗號 (,) 區隔。 例如,下列指令將會移除群組及其他人對檔案 FILE 的寫入權限, 並使全部人(world)對該檔有執行權限。 &prompt.user; chmod go-w,a+x FILE Tom Rhodes Contributed by &os; 檔案旗標(Flag) 除了前面提到的檔案權限外,&os; 支援使用 檔案旗標。 這些旗標增加了檔案的安全性及管理性,但不包含目錄。 檔案旗標增加了管理性,確保在某些時候 root 不會意外將檔案修改或移除。 修改的檔案 flag 僅需要使用擁有簡易的介面的 &man.chflags.1; 工具。 例如,標示系統禁止刪除的旗標於檔案 file1,使用下列指令: &prompt.root; chflags sunlink file1 若要移除系統禁止刪除的旗標,只需要簡單在 前加上 no,例如: &prompt.root; chflags nosunlink file1 使用 &man.ls.1; 及參數 可檢視檔案目前的旗標: &prompt.root; ls -lo file1 輸出的結果如下: -rw-r--r-- 1 trhodes trhodes sunlnk 0 Mar 1 05:54 file1 多數的旗標僅能由 root 使用者來標示或移除,而部份旗標可由檔案所有者設定。 我們建議系統管理者可閱讀 &man.chflags.1; 及 &man.chflags.2; 說明以瞭解相關細節。 目錄結構 directory hierarchy 認識 FreeBSD 的目錄架構,就可對系統有概略的基礎理解。 最重要的莫過於整個目錄的根目錄,就是 / 目錄, 該目錄會在開機時最先掛載 (mount),裡面會有開機所會用到必備檔案。 此外,根目錄還有紀錄其他檔案系統的掛載點相關設定。 「掛載點」就是讓新增的檔案系統,能接到上層的檔案系統 (通常就是「根目錄」檔案系統) 的目錄。 在 這邊對此有更詳細介紹。 標準的掛載點包括了 /usr/var/tmp/mnt 以及 /cdrom。 這些目錄通常會記錄在 /etc/fstab 設定檔內。 /etc/fstab 是記錄各檔案系統及相關掛載點的表格。 大部分在 /etc/fstab 有記錄的檔案系統,會在開機時由 &man.rc.8; script 來自動掛載,除非它們有設定 選項。 其中細節說明可參閱 有關檔案系統架構的完整說明可參閱 &man.hier.7;。 現在呢,讓我們大致先一窺常見的目錄有哪些吧。 目錄 說明 / 檔案系統的根目錄。 /bin/ single-user、multi-user 兩種模式皆可使用的基本工具 。 /boot/ 作業系統開機過程會用到的程式、設定檔。 /boot/defaults/ 預設的開機啟動設定檔,詳情請參閱 &man.loader.conf.5; 。 /dev/ Device nodes,詳情請參閱 &man.intro.4;。 /etc/ 系統設定檔及一些 script 檔。 /etc/defaults/ 預設的系統設定檔,詳情請參閱 &man.rc.8;。 /etc/mail/ MTA(Mail Transport Agent)的相關設定檔,像是 &man.sendmail.8;。 /etc/namedb/ named 設定檔,詳情請參閱 &man.named.8;。 /etc/periodic/ 每日、每週、每月透過 &man.cron.8;; 執行的定期排程 script, 詳情請參閱 &man.periodic.8;。 /etc/ppp/ ppp 設定檔,詳情請參閱 &man.ppp.8;。 /mnt/ 系統管理者慣用充當臨時掛載點的空目錄。 /proc/ Process 檔案系統,詳情請參閱 &man.procfs.5; 及 &man.mount.procfs.8;。 /rescue/ 緊急救援用途的一些 statically linked 程式,詳情請參閱 &man.rescue.8;。 /root/ root 帳號的家目錄。 /sbin/ 供 single-user 及 multi-user 環境使用的系統程式及管理工具 。 /tmp/ 臨時檔案。 一般而言,重開機之後 /tmp 內的東西會被清除掉。 而通常會將 memory-based 檔案系統掛載在 /tmp 上。 這些瑣事可透過 tmpmfs 相關的 &man.rc.conf.5; 環境變數來自動完成 。(或是在 /etc/fstab 內做設定, 詳情請參閱 &man.mdmfs.8;。) /usr/ 主要是使用者所安裝的工具程式、應用程式存放處。 /usr/bin/ 常用工具、開發工具、應用軟體。 /usr/include/ 標準 C include 的相關 header 檔案庫。 /usr/lib/ 函式庫存放處。 /usr/libdata/ 其他各式工具的資料檔。 /usr/libexec/ 系統 daemons 及系統工具程式(透過其他程式來執行)。 /usr/local/ 存放一些自行安裝的執行檔、函式庫等等。 同時,也是 FreeBSD ports 架構的預設安裝目錄。 /usr/local 內的目錄架構大致與 /usr 相同,詳情請參閱 &man.hier.7; 說明。 但 man 目錄例外,它們是直接放在 /usr/local 底下,而非 /usr/local/share,而 ports 所安裝的說明文件則在 share/doc/port /usr/obj/ 在編譯 /usr/src 目錄時所產生的相關架構 object 檔案。 /usr/ports FreeBSD Ports Collection (optional)。 /usr/sbin/ 系統 daemon 及系統工具(直接由使用者執行)。 /usr/share/ 各架構皆共通的檔案。 /usr/src/ BSD 本身的原始碼(或自行新增的)。 /usr/X11R6/ X11R6 相關套件的執行檔、函式庫等(optional)。 /var/ 存放各種用途的 log 檔、臨時或暫時存放、列印或郵件的 spool 檔案。有時候,memory-based 檔案系統也會掛載在 /var。 這些瑣事可透過 varmfs 相關的 &man.rc.conf.5 環境變數來自動完成。(或是在 /etc/fstab 內做設定,相關細節請參閱 &man.mdmfs.8;。) /var/log/ 各項系統記錄的 log 檔案。 /var/mail/ 各使用者的 mailbox 檔案。 /var/spool/ 各種印表機、郵件系統的 spool 目錄。 /var/tmp/ 臨時檔案。 這些檔案在重開機後通常仍會保留,除非 /var 是屬於 memory-based 檔案系統。 /var/yp 記錄 NIS maps。 磁碟組織 FreeBSD 用來尋找檔案的最小單位就是檔案的名稱了。 檔案的名稱有大小寫之分,所以說 readme.txtREADME.TXT 是兩個不同的檔案。 FreeBSD 並不使用副檔名 (.txt) 來判別這是一個程式檔、文件檔或是其他類型的檔案。 檔案存在目錄裡面。 一個目錄中可能沒有任何檔案,也可能有好幾百個檔案。 目錄之中也可以包含其他的目錄; 您可以建立階層式的目錄以便資料的管理。 檔案或目錄的對應是藉由給定的檔案或目錄名稱,然後加上正斜線符號 (/);之後再視需要加上其他的目錄名稱。 如果您有一個目錄 foo ,裡面有一個目錄叫作 bar,這個目錄中又包含了一個叫 readme.txt 的檔案,那麼這個檔案的全名,或者說檔案的路徑就是 foo/bar/readme.txt 目錄及檔案儲存在檔案系統之中。 每個檔案系統都有唯一一個最上層的目錄,叫做根目錄 (root directory)。 然後在這個根目錄下面才能有其他的目錄。 到目前為止大概和其他您用過的的作業系統都差不多。 還是有些不一樣的地方就是了,例如 &ms-dos; 用 \ 當檔案和目錄名稱的分隔符號,而 &macos; 則是用 : 符號。 FreeBSD 的路徑中並沒有使用磁碟機代號或其他的磁碟名稱。 因此,您不可以使用像 c:/foo/bar/readme.txt 這樣子的檔案名稱。 相對的,在 FreeBSD 系統中有一個檔案系統被指定為根檔案系統。 根檔案系統的根目錄由 / 表示。 然後其他的檔案系統再掛載 (mount) 在根檔案系統之下。因此無論您的 FreeBSD 系統上有多少顆硬碟,每一個目錄看起來就像在同一個磁碟上。 假設您有三個檔案系統,分別叫作 ABC。 每個檔案系統都包含兩個目錄,叫做 A1A2 (依此類推得 B1B2C1C2)。 A 為主要的檔案系統;如果您用 ls 指令查看此目錄的內容,您會看到兩個子目錄: A1A2,如下所示: / | +--- A1 | `--- A2 一個檔案系統必須以目錄形式掛載於另一個檔案系統上。 因此,假設您將 B 掛載於 A1 之上,則 B 的根目錄就變成了 A1,而在 B 之下的任何目錄的路徑也隨之改變: / | +--- A1 | | | +--- B1 | | | `--- B2 | `--- A2 B1B2 目錄中的任何檔案必須經由路徑 /A1/B1/A1/B2 才能達到。 所有原來在 /A1 中的檔案會暫時被隱藏起來,直到 B 被「移除 (unmounted)」後才會再顯現出來。 如果 B 掛載在 A2 之上,則會變成: / | +--- A1 | `--- A2 | +--- B1 | `--- B2 上面的路徑分別為 /A2/B1/A2/B2 檔案系統可以掛在其他檔案系統的目錄之上。 延續之前的例子,C 檔案系統可以掛在檔案系統 BB1 目錄之上,如圖所示: / | +--- A1 | `--- A2 | +--- B1 | | | +--- C1 | | | `--- C2 | `--- B2 或者 C 直接掛載於 AA1 目錄之上: / | +--- A1 | | | +--- C1 | | | `--- C2 | `--- A2 | +--- B1 | `--- B2 如果您熟悉 &ms-dos; 的話,這和 join 指令很類似 (雖然不儘相同)。 一般情況下您不需要擔心這些東西。 除非您要安裝新的磁碟,不然通常在您安裝 FreeBSD 時建立好檔案系統並決定好要掛載在何處之後就不會再做任何更動了。 您完全可以使用單一的一個大的根檔案系統 (root file system) 而不建立其他的檔案系統。 這樣有好處也有有壞處。 使用多個檔案系統的好處 不同的檔案系統在掛上的時候可以有不同的 掛載參數。 舉例來說,為求謹慎您可以將根檔案系統設成唯讀, 以避免不小心刪除或修改掉重要的檔案。 將使用者可寫入的檔案系統 (例如 /home) 獨立出來也可以讓他們用 nosuid 的參數掛載,此選項可以讓在這個檔案系統中執行檔的 suid/guid bits 失效,也許可以讓系統更安全。 FreeBSD 會自動根據您檔案系統的使用方式來做最佳的檔案配置方式。 因此,一個有很多小檔案、 常常寫入的檔案系統跟只有幾個較大的檔案的檔案系統配置是不一樣的。 如果您只有單一一個大的檔案系統,這部分就沒用了。 FreeBSD 的檔案系統在停電的時候很穩固。 然而,在某些重要的時候停電仍然會對檔案系統結構造成損害。 分割成許多個檔案系統的話在系統在停電後比較能夠正常啟動, 以便您在需要的時候將備份資料回存回來。 使用單一檔案系統的好處 檔案系統的大小是固定的。 您當初安裝 FreeBSD 的時候應該會給定一個大小,可是後來您可能會想把空間加大。 如果沒有備份的話是很難達成的; 您必須將檔案系統重新建立為您需要的大小,然後將備份回存回來。 FreeBSD 的 &man.growfs.8; 指令可以突破此限制直接變更檔案系統的大小。 檔案系統包含在分割區裡面。 因為 &os; 承襲 &unix 架構,這邊講的分割區和一般提到的分割區 (例如 &ms-dos; 分割區) 不同。 每一個分割區由一個代號(字母)表示,從 ah。 每個分割區只能包含一個檔案系統。 因此除了說常見到用檔案系統同的掛載點來表示檔案系統外, 也可以用包含他的分割區代號來表示。 FreeBSD 也會拿磁碟空間來當 swap space。 Swap space 給 FreeBSD 當作虛擬記憶體用。 這讓您的電腦好像擁有比實際更多的記憶體。 當 FreeBSD 的記憶體用完的時候,它會把一些目前沒用到的資料移到 swap space,然後在用到的時候移回去 (同時移出部份沒用到的)。 某些分割區有慣例的使用方式如下: 分割區 慣例 a 通常包含根檔案系統 (root file system) b 通常是 swap space c 通常和整個 slice 的大小一樣,給一些會用到整個 slice 的工具程式 (例如硬碟壞軌檢查工具) 來使用。 一般來說您應該不會把檔案系統建立在這個分割區。 d 分割區 d 曾經有代表特殊意義,但是已經不再使用。 所以現在 d 就和其他一般的分割區相同了。 每個包含有檔案系統的分割區是存在所謂的 slice 裡面。 FreeBSD 的 slice 就是指平常我們稱為分割區 (partition) 的東西。 同樣地,會這樣子稱呼也是因為 FreeBSD 的 &unix; 色彩。 而 slice 是有編號的,從 1 號編到 4 號。 slices partitions dangerously dedicated slice 號碼跟在裝置名稱後面,先接一個字母 s,然後從 1 號開始編下去。 因此 da0s1 就是指第一個 SCSI 硬碟的第一個 slice。 一個磁碟上只能有四個實體的 slice,但是在實體的 slice 中您可以塞進適當類型的邏輯 slice。 這些延伸的 slice 編號從 5 開始,所以 ad0s5 是第一個 IDE 硬碟上的第一個延伸 slice。 檔案系統在裝置 (device) 裡就是在一個 slice 之中。 Slices、dangerously dedicated 模式的實體磁碟機,以及其他包含分割區(partition) 的磁碟都是以字母 ah 的編號來表示。 編號是接在裝置名稱的後面的,因此 da0a 是磁碟機 da 上的第一個 dangerously dedicated模式之分割區。 而 ad1s3e 則是第二顆 IDE 硬碟上第三個 slice 的第五個分割區。 最後,我們就可以把系統上的每個磁碟都區分出來了。 一個磁碟的名稱會有一個代碼來表示這個磁碟的類型,接著是一個數字, 表示這是哪一個磁碟。 這邊跟 slice 每個磁碟編號從 0 開始不一樣。 常見的代碼可以參考 當要參照一個分割區的時候,FreeBSD 會要您一併輸入包含這個分割區的 slice 及磁碟機名稱;當要參照一個 slice 的時候,也必須輸入包含這個 slice 的磁碟名稱。 怎麼做呢?首先先列出磁碟名稱,然後 s 加上 slice 編號,最後再輸入分割區字母代號。 範例可以參考 . 示範了一個基本的磁碟分布模式,相信對您有些幫助。 要安裝 FreeBSD,您必須先建置磁碟的 slice,接著於 slice 中建立要給 FreeBSD 用的分割區。 最後在這些分割區中建立檔案系統 (或 swap space) 並決定要將這些檔案系統掛載於哪裡。 磁碟機代號 代號 意義 ad ATAPI(IDE) 磁碟機 da SCSI 直接存取磁碟機 acd ATAPI(IDE) 光碟機 cd SCSI 光碟機 fd 軟碟機
磁碟、slice 及分割區命名範例 名稱 意義 ad0s1a 第一個 IDE 硬碟 (ad0) 上第一個 slice (s1)的第一個分割區(a) 。 da1s2e 第二個 SCSI 硬碟 (da1) 上第二個 slice (s2) 的第五個分割區 (e) 。 磁碟的概念模型 此圖顯示 FreeBSD 中接到系統的第一個 IDE 磁碟機內部配置圖。 假設這個磁碟的容量是 4 GB,並且包含了兩個 2 GB 的 slice (&ms-dos; 的分割區)。 第一個 slice 是 DOS 的 C: 磁碟機,第二個則安裝了 FreeBSD。 本範例的 FreeBSD 有三個分割區以及一個 swap 分割區。 這三個分割區每個都是一個檔案系統。 a 分割是根 (root) 檔案系統;分割 e/var;而 f 分割是 /usr 目錄結構。 .-----------------. --. | | | | DOS / Windows | | : : > First slice, ad0s1 : : | | | | :=================: ==: --. | | | Partition a, mounted as / | | | > referred to as ad0s2a | | | | | :-----------------: ==: | | | | Partition b, used as swap | | | > referred to as ad0s2b | | | | | :-----------------: ==: | Partition c, no | | | Partition e, used as /var > file system, all | | > referred to as ad0s2e | of FreeBSD slice, | | | | ad0s2c :-----------------: ==: | | | | | : : | Partition f, used as /usr | : : > referred to as ad0s2f | : : | | | | | | | | --' | `-----------------' --'
掛載與卸載檔案系統 檔案系統就像一顆樹。/ 就像是樹根,而 /dev/usr 以及其他在根目錄下的目錄就像是樹枝,而這些樹枝上面又還有分支,像是 /usr/local 等。 根檔案系統 因為某些原因,我們會將一些目錄分別放在不同的檔案系統上。 如 /var 包含了可能會滿出來的 log/spool/ 等目錄以及各式各樣的暫存檔。 把根檔案系統塞到滿出來顯然不是個好主意,所以我們往往會比較傾向把 /var/ 中拉出來。 另一個常見到把某些目錄放在不同檔案系統上的理由是: 這些檔案在不同的實體或虛擬磁碟機上。 像是網路檔案系統 (Network File System) 或是光碟機。 <filename>fstab</filename> 檔 檔案系統 file systems 由fstab掛載 mounted with fstab /etc/fstab 裡面有設定的檔案系統會在開機 的過程中自動地被掛載 (除非該檔案系統有被加上 參數)。 /etc/fstab 檔案內容的格式如下: device /mount-point fstype options dumpfreq passno device 裝置名稱 (該裝置必須真的存在)。 詳情請參閱 . mount-point 檔案系統要掛載到的目錄 (該目錄必須真的存在)。 fstype 檔案系統類型,這是要傳給 &man.mount.8; 的參數。 FreeBSD 預設的檔案系統是 ufs options 可讀可寫的檔案系統用 ,而唯讀的檔案系統則是用 ,後面視需要還可以加其他選項。 常見的選項如 是用在不要於開機過程中自動的掛載的檔案系統。 其他選項可參閱 &man.mount.8; 說明。 dumpfreq &man.dump.8; 由此項目決定那些檔案系統需要傾印。 如果這格空白則以零為預設值。 passno 這個項目決定檔案系統檢查的順序。 對於要跳過檢查的檔案系統,它們的 passno 值要設為零。 根檔案系統的 passno 值應設為一 (因為需要比所有其他的還要先檢查),而其他的檔案系統的 passno 值應該要設得比一大。 若有多個檔案系統具有相同的 passno 值,則 &man.fsck.8; 會試著平行地(如果可能的話)檢查這些檔案系統。 更多關於 /etc/fstab 檔案格式及選項的資訊請參閱 &man.fstab.5; 說明文件。 <command>mount</command> 指令 檔案系統 file systems 掛載 mounting &man.mount.8; 指令是拿來掛載檔案系統用的。 基本的操作指令格式如下: &prompt.root; mount device mountpoint 在 &man.mount.8; 裡面有提到一大堆的選項,不過最常用的就是這些: 掛載選項 /etc/fstab 裡面所有還沒有被掛載、沒有被標記成 noauto 而且沒有用 排除的檔案系統掛載起來。 執行所有的動作,但是不真的去呼叫掛載的 system call。 這個選項和 搭配拿來推測 &man.mount.8; 將要做什麼動作時很好用。 強迫掛載不乾淨的檔案系統 (危險),或是用來強制取消寫入權限 (把檔案系統的掛載狀態從可存取變成唯讀)。 用唯讀的方式掛載檔案系統。 這個選項和在 選項中指定 (在 &os; 5.2之前的版本是用 ) 參數是一樣的。 fstype 用指定的檔案系統型態 (fstype) 來掛載指定的檔案系統,或是在有 選項時只掛載指定型態的檔案系統。 預設的檔案系統是 ufs 更新檔案系統的掛載選項。 顯示較詳細資訊。 以可存取的模式掛載檔案系統。 選項後面會接著以逗號分隔的參數,例如: noexec 不允許在這個檔案系統上執行二進位程式碼, 這也是一個蠻有用的安全選項。 nosuid 不解析檔案系統上的 setuid 或 setgid 旗標, 這也是一個蠻有用的安全選項。 <command>umount</command> 指令 檔案系統 file systems 卸載 unmounting &man.umount.8; 指令的參數可以是掛載點 (mountpoint),裝置名稱,以及 或是 等選項。 加上 可以強制卸載,加上 則是會顯示詳細資訊。 要注意的是一般來說用 並不是個好主意,強制卸載檔案系統有可能會造成電腦當機, 或者損壞檔案系統內的資料。 是用來卸載所有已掛載的檔案系統,另外還可以用 來指定要卸載的是哪些種類的檔案系統。 要注意的是 並不會試圖卸載根檔案系統。 程序 FreeBSD 是一個多工的作業系統,也就是說在同一時間內可以跑超過一個程式。 每一個正在花時間跑的程式就叫做 程序 (process)。 您下的每個指令都至少會開啟一個新的程序, 而有些系統程序是一直在跑以維持系統正常運作的。 每一個程序都有一個不重覆的數字叫做 process ID ,或稱為 PID ,而且就像檔案一樣,每一個程序也有擁有者及群組。 擁有者及群組的資訊是用來決定什麼檔案或裝置是這個程序可以開啟的 (前面有提到過檔案權限)。 大部份的程序都有父程序。 父程序是開啟這個程序的程序,例如:您對 shell 輸入指令,shell 本身就是一個程序,而您執行的指令也是程序。 每一個您用這種方式跑的程序的父程序都是 shell。 有一個特別的程序叫做 &man.init.8; 是個例外。init 永遠是第一個程序,所以他的 PID 一直都會是 1。 在 FreeBSD 開機的時候 init 會自動地被 kernel 開啟。 要看系統執行中的程序,有兩個相當有用的指令可用: &man.ps.1; 以及 &man.top.1;。ps 指令是用來列出正在執行之程序,而且可以秀它們的 PID、用了多少記憶體、執行的指令名稱及其後之參數是什麼等等。 top 指令則是顯示所有正在執行的程序, 並且數秒鐘更新一次。因此您可以互動式的觀看您的電腦正在做什麼。 在預設的情況下,ps 指令只會顯示您所擁有的的程序。 例如: &prompt.user; ps PID TT STAT TIME COMMAND 298 p0 Ss 0:01.10 tcsh 7078 p0 S 2:40.88 xemacs mdoc.xsl (xemacs-21.1.14) 37393 p0 I 0:03.11 xemacs freebsd.dsl (xemacs-21.1.14) 48630 p0 S 2:50.89 /usr/local/lib/netscape-linux/navigator-linux-4.77.bi 48730 p0 IW 0:00.00 (dns helper) (navigator-linux-) 72210 p0 R+ 0:00.00 ps 390 p1 Is 0:01.14 tcsh 7059 p2 Is+ 1:36.18 /usr/local/bin/mutt -y 6688 p3 IWs 0:00.00 tcsh 10735 p4 IWs 0:00.00 tcsh 20256 p5 IWs 0:00.00 tcsh 262 v0 IWs 0:00.00 -tcsh (tcsh) 270 v0 IW+ 0:00.00 /bin/sh /usr/X11R6/bin/startx -- -bpp 16 280 v0 IW+ 0:00.00 xinit /home/nik/.xinitrc -- -bpp 16 284 v0 IW 0:00.00 /bin/sh /home/nik/.xinitrc 285 v0 S 0:38.45 /usr/X11R6/bin/sawfish 在這個範例裡可以看到 &man.ps.1; 的輸出分成好幾個欄位。 PID 就是前面有提到的 process ID。 PID 的分配是從 1 開始一直到 99999,如果用完的話又會繞回來重頭開始分配 (若該 PID 已經在用了,則 PID 不會重新分配)。 TT 欄位是指這個程式在哪個 tty 上執行,在這裡可以先忽略不管。STAT 是程式的狀態,也可以先不要管。TIME 是這個程式在 CPU 上執行的時間—這通常不是程式總共花的時間, 因為當您開始執行程式後,大部份的程式在 CPU 上執行前會先花上不少時間等待 。 最後,COMMAND 是執行這個程式的命令列。 &man.ps.1; 有幾個不同的選項組合可以用來變更顯示出來的資訊,其中一個最有用的組合是 auxww 可以顯示所有正在跑的程序的指令,不只是您自已的。 則是顯示程序的擁有者名稱以及記憶體使用情況。 可以把 daemon 程序顯示出來, 而 可讓 &man.ps.1; 顯示出每個程序完整的內容, 而不致因過長而被螢幕截掉了。 &man.top.1; 也有類似的輸出。 一般的情況看像是這樣: &prompt.user; top last pid: 72257; load averages: 0.13, 0.09, 0.03 up 0+13:38:33 22:39:10 47 processes: 1 running, 46 sleeping CPU states: 12.6% user, 0.0% nice, 7.8% system, 0.0% interrupt, 79.7% idle Mem: 36M Active, 5256K Inact, 13M Wired, 6312K Cache, 15M Buf, 408K Free Swap: 256M Total, 38M Used, 217M Free, 15% Inuse PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND 72257 nik 28 0 1960K 1044K RUN 0:00 14.86% 1.42% top 7078 nik 2 0 15280K 10960K select 2:54 0.88% 0.88% xemacs-21.1.14 281 nik 2 0 18636K 7112K select 5:36 0.73% 0.73% XF86_SVGA 296 nik 2 0 3240K 1644K select 0:12 0.05% 0.05% xterm 48630 nik 2 0 29816K 9148K select 3:18 0.00% 0.00% navigator-linu 175 root 2 0 924K 252K select 1:41 0.00% 0.00% syslogd 7059 nik 2 0 7260K 4644K poll 1:38 0.00% 0.00% mutt ... 輸出的資訊分成兩個部份。開頭 (前五行) 秀出最近一個程序的 PID、系統平均負載 (系統有多忙錄的測試)、系統的開機時間 (從上次重開算起) 以及現在的時間等。 在開頭裡面的其他數字分別是在講有多少程序正在執行 (在本例中為47)、有多少記憶體及 swap space 被占用了,還有就是系統分別花了多少時間在不同的 CPU 狀態上。 接下來的部份是由好幾個欄位所構成,和 &man.ps.1; 輸出的資訊類似。 就如同前例,您可以看到 PID、使用者名稱、CPU 花費的時間以及正在執行的指令。 &man.top.1; 在預設的情況下還會告訴您程序用掉了多少的記憶體空間。 在這邊會分成兩欄,一個是總用量 (total size),另一個是實際用量 (resident size)—總用量是指這個應用程式需要的記憶體空間, 而實際用量則是指實際上該程式的記憶體使用量。 在這個例子裡面您可以看到 &netscape; 要了幾乎到 30 MB 的 RAM,但是只有用到 9 MB。 &man.top.1; 每隔 2 秒鐘會自動更新顯示內容,可用 選項來改變間隔的時間。 Daemon、信號及終止程序 當在執行文書編輯器時,您可以很容易地使用它,叫它讀取檔案或是什麼的。 可以這樣做是因為編輯器有提供這些功能, 還有就是編輯器依附在一個終端機 (Terminal) 之上。 有些程式並不是設計成一直在接收使用者的輸入的, 所以它們在一開始執行的時候就從終端機斷開了。 例如說, 網頁伺服器整天都在回應網頁方面的要求,它通常不需要您輸入任何東西。 另外,像是把信從一個站傳送到另一個站的程式,也是這種類型的應用程式。 我們把這種程式稱作 daemon。 Daemon (惡魔、守護神) 是希臘神話中的角色:祂們不屬於善良陣營或邪惡陣營,是守護的小精靈。 大致上來說祂們就是在替人類做一些有用的事情, 跟今天的網頁伺服器或是郵件伺服器很像。 這也就是為何 BSD 的吉祥物,長期以來都是一隻穿著帆布鞋拿著三叉耙的快樂小惡魔的原因。 通常來說 deamon 程式的名字後面都會加一個字母 dBIND 是 Berkeley Internet Name Domain 的縮寫 (但實際上執行的程式名稱是 named)、Apache 網頁伺服器的程式名稱是 httpd、印表機服務程式是 lpd,依此類推。 這是習慣用法,並沒有硬性規定,例如 Sendmail 主要的寄信 daemon 是叫做 sendmail 而不是 maild,跟您想像的不一樣。 有些時候會需要跟某個 daemon 程序溝通, 這些溝通是透過所謂的信號(signal)來傳遞給該 daemon 程序(或是其他執行中的程序)。 藉由送出信號,您可以和一個 daemon (或是任何一個正在跑的程序) 溝通。 信號有很多種—有些有特定的意義,有些則是會由應用程式來解讀。 應用程式的說明文件會告訴您該程式是如何解讀信號的。 您只能送信號給您擁有的程序,送 &man.kill.1; 或 &man.kill.2; 的信號給別人的程序是不被允許的。 不過 root 不受此限制,他可以送信號給任何人的程序。 FreeBSD 本身在某些情況也會送信號給應用程式。 假設有個應用程式寫得很爛,然後企圖要存取它不該碰的記憶體的時候,FreeBSD 會送一個 Segmentation Violation 信號 (SIGSEGV) 給這個程序。 又如果有一個應用程式用了 &man.alarm.3; 的 system call 要求系統在過一段時間之後叫他一下,時間到了的時候鬧鐘的信號 (SIGALRM) 就會被送出了,其他的依此類推。 SIGTERM and SIGKILL 這兩個信號可以拿來終止程序。 用 SIGTERM 結束程序是比較有禮貌的方式,該程序會捕捉 (catch) 這個信號而了解到您想要把他關掉。 接著下來它會把它自已開的記錄檔通通關掉, 然後在關掉程序之前結束掉手邊的工作。 在某些情況下程序有可能會裝作沒看見 SIGTERM,假如它正在做一些不能中斷的工作的話。 SIGKILL 就沒有辦法被程序忽略了。 這是一個我管你正在幹嘛,現在就給我停下來的信號。 如果您送了 SIGKILL 信號給某個程序,FreeBSD 將會把它停掉 不完全正確—還是有少數東西不能被中斷。 例如有個程序正在從網路上的別的電腦讀一個檔案, 而那部電腦因為某些理由連不到 (機器被關掉,或是網路爛掉了), 那這個程序我們就說他是一個不能中斷的程序。 通常在經過兩分鐘左右之後這個程序會逾時。 當發生逾時的時候這個程序就會被結束掉了。 這些是其他您有可能會要用到的信號: SIGHUPSIGUSR1,以及 SIGUSR2。 這些是通用的信號,當送出時不同的應用程式會有不同的反應。 假設您更動了您的網頁伺服器的設定檔— 您想要叫網頁伺服器去重新讀取設定值。 您可以關閉後再重新啟動 httpd,但是這麼做會造成網頁伺服器暫停服務一段時間, 這樣子可能不太好。 大部份的 daemon 都寫成會去回應 SIGHUP。 當收到這個信號之後,它們會去重新讀取自已的設定檔。 因此您可以用送 SIGHUP 信號來取代關掉重開。 又因為沒有標準在規範如何回應這些信號,不同的 daemon 可能會有不同的行為,所以有疑問的話請先確認並翻閱 deamon 的說明文件。 信號是由 &man.kill.1; 指令送出的,如範例所示: 送信號給程序 這個範例將會示範如何送一個信號給 &man.inetd.8;。 inetd 的設定檔是 /etc/inetd.conf,而 inetd 會在收到 SIGHUP 的時候重新讀取這個設定檔。 找出您想要送信號的那個程序的 ID。 您會用到 &man.ps.1; 以及 &man.grep.1; 這兩個指令。 &man.grep.1; 是用來在輸出中搜尋, 找出您指定的字串。 這個指令是由一般使用者執行,而 &man.inetd.8; 是由 root 執行,所以在使用 &man.ps.1; 時需要加上 選項。 &prompt.user; ps -ax | grep inetd 198 ?? IWs 0:00.00 inetd -wW 因此可知 &man.inetd.8; 的 PID 為 198。 在某些情況下 grep inetd 這個指令本身也會出現在輸出裡。 這是因為 &man.ps.1; 乃是找所有執行中的程序的方式造成的。 用 &man.kill.1; 來送信號。 又因為 &man.inetd.8; 是由 root 執行的,您必須用 &man.su.1; 切換成 root先。 &prompt.user; su Password: &prompt.root; /bin/kill -s HUP 198 一般情況對大多數 &unix; 指令來講,當 &man.kill.1; 執行成功時並不會輸出任何訊息。 假設您送一個信號給某個不是您所擁有的程序, 那麼您就會吃到這個錯誤訊息: kill: PID: Operation not permitted。 而如果您打錯 PID 的話,那就會把信號送給錯誤的程序。 這樣可能會很糟, 不過如果您夠幸運的話,可能剛好就只是把信號送給一個非使用中的 PID,那您就只會看到 kill: PID: No such process 而已。 為什麼用 <command>/bin/kill</command>? 很多 shell 有提供內建的 kill 指令。 也就是說這種 shell 會直接送信號,而不是執行 /bin/kill。 這樣是蠻方便的沒錯啦,但是不同的 shell 會有不同的語法來指定信號的名稱等。 與其嘗試去把它們通通學會,不如就單純的直接用 /bin/kill ... 吧。 要送其他的信號的話也是非常類似,就視需要把指令中的 TERMKILL 替換掉即可。 隨便抓一個系統中的程序然後把他砍掉並不是個好主意。 特別是 &man.init.8;, process ID 1,一個非常特別的程序。 執行 /bin/kill -s KILL 1 的結果就是系統立刻關機。 因此在您按下 Return 要執行 &man.kill.1;之前, 請一定要記得再次確認您下的參數。 Shells shells 命令列 command line 在 FreeBSD 中,很多日常的工作是在一個叫做 shell 的文字介面中完成的。 Shell 的主要工作就是從輸入中收到命令並執行它們。 許多 shell 也有內建一些有助於日常工作的指令, 像是檔案管理、檔案比對、命令列編輯、指令巨集以及環境變數等。 FreeBSD 有內附了幾個 shell,像是 sh, Bourne Shell,以及 tcsh,改良版的 C-shell。 還有許多其他的 shell 可以從 FreeBSD Ports Collection 中取得,像是 zsh 以及 bash 等。 您用哪個 shell 呢? 其實每個人的喜好都不一樣。 如果您是一個 C 程式設計師,那對於使用像是 tcsh 這種 C-like 的 shell 可能會感到相當愉快。 如果你是從 Linux 跳過來的,或者您是一個 &unix; 新手,那您也許會想要用 bash 來當作文字介面。 每一個 shell 都有自已獨特之處,至於這些特點能不能配合您的工作環境? 那就是您選擇 shell 的重點了。 檔名自動補齊就是常見的 shell 功能。 首先輸入指令或檔案的前幾個字母,這時通常您只需要按下 Tab 鍵,接下來 shell 就會自動把指令或是檔案名稱剩餘的部份補齊。 假設您有兩個檔案分別叫作 foobarfoo.bar。 現在要刪掉 foo.bar,那麼可以輸入: rm fo[Tab].[Tab] Shell 會印出這個: rm foo[嗶].bar [嗶] 是 console 的響鈴,這嗶的一聲是 shell 在告訴我說它沒有辦法完全自動補齊檔名,因為有不只一個檔名符合條件。 foobarfoo.bar 都是 fo 開頭的檔名,不過它至少可以補齊到 foo。 如果您接著輸入 . 然後再按 Tab 一次,那 shell 就能夠替您把剩下的檔名填滿了。 environment variables Shell 的另一項特點是使用了環境變數。 環境變數是以變數與鍵值(variable/key)的對應關係儲存於 shell 的環境空間中,任何由 shell 所產生的程序都可以讀取此空間, 因此這個空間儲存了許多程序的設定組態。在此附上 一份常見環境變數與其含意的列表: environment variables 變數 詳細說明 USER 目前登入的使用者名稱。 PATH 以冒號(:)隔開的目錄列表,用以搜尋執行檔的路徑。 DISPLAY 若存在這個環境變數,則代表 X11 連結顯示器的網路名稱。 SHELL 目前使用的 shell。 TERM 使用者終端機的名稱,能藉由此變數判斷終端機的能力。 TERMCAP Database entry of the terminal escape codes to perform various terminal functions. OSTYPE 作業系統的種類,如:FreeBSD。 MACHTYPE 目前系統所用的 CPU 架構。 EDITOR 使用者偏好的文字編輯器。 PAGER 使用者偏好的文字分頁器(text pager)。 MANPATH 以冒號(:)隔開的目錄列表,用以搜尋 manual pages 的路徑。 Bourne shells 在不同的 shell 底下設定環境變數的方式也有所不同。 舉例來說,在 C-Style 的 shell 底下,像是 tcshcsh,你必須使用 setenv 來設定環境變數。 但在 Bourne shells 底下,像是 shbash,你則必須使用 export 來設定你所使用的環境變數。 再舉個例子來說,若要設定或是修改 EDITOR 這個環境變數,在 cshtcsh 下設定 EDITOR 這個環境變數為 /usr/local/bin/emacs 的指令是: &prompt.user; setenv EDITOR /usr/local/bin/emacs 在 Bourne shells 下則是: &prompt.user; export EDITOR="/usr/local/bin/emacs" 大多數的 shell 都支援使用者在命令列中將 $ 字元放在變數之前,以取得環境變數的值。 舉例來說,echo $TERM 會 顯示出 $TERM 的設定值,這是因為 shell 取得了 - $TERM 的設定值,並將他傳給 echo 顯示出來。 - - Shells treat a lot of special characters, called meta-characters - as special representations of data. The most common one is the - * character, which represents any number of - characters in a filename. These special meta-characters can be used - to do filename globbing. For example, typing in - echo * is almost the same as typing in - ls because the shell takes all the files that - match * and puts them on the command line for - echo to see. - - To prevent the shell from interpreting these special characters, - they can be escaped from the shell by putting a backslash - (\) character in front of them. echo - $TERM prints whatever your terminal is set to. - echo \$TERM prints $TERM as - is. + $TERM 的設定值, + 並將其傳給 echo 顯示出來。 + + Shell 中有某些特別的字元是來表示特殊的資料,我們將其稱作 + meta-characters。 其中最常見的是 + * 字元,他代表了檔名中的任意字元。 + 這些特殊字元可以用在檔名展開(filename globbing)上,舉例來說,輸入 + echo * 會和輸入 + ls 得到幾乎相同的結果,這是因為 shell 會將所有符合 + * 字元的檔案傳到命令列上,再由 + echo 顯示出來。 + + 為了避免 shell 轉譯這些特殊字元,我們可以在這些特殊字元前放一個反斜線 + (\) 字元使他們跳脫(escape) shell 的轉譯。舉例來說, + echo $TERM 會印出你目前設定的終端機格式, + echo \$TERM 則會直接印出 $TERM + 這幾個字。 變更你的 Shell 變更 shell 最簡單的方法就是透過 chsh 命令。 - 執行 chsh 將會呼叫環境變數中 EDITOR 指定的 - 文字編輯器。如果沒有設定,則預設是 vi。依照需求去修改 - Shell: 的值。 + 執行 chsh 將會呼叫環境變數中 EDITOR + 指定的文字編輯器。 如果沒有設定,則預設是 vi。 + 請依照需求去修改 Shell: 的值。 - 你也可以透過 chsh 的參數 ,這可以 - 直接設定你的 shell 而不需要透過任何文字編輯器。例如,假設你想將 shell 變更為 - bash,可以透過下列的方式: + 你也可以透過 chsh 的參數 , + 這可以直接設定你的 shell 而不需要透過任何文字編輯器。 例如, + 假設想把所用的 shell 改為 bash, + 可以透過下列的方式: &prompt.user; chsh -s /usr/local/bin/bash - The shell that you wish to use must be - present in the /etc/shells file. If you - have installed a shell from the ports - collection, then this should have been done for you - already. If you installed the shell by hand, you must do - this. + 你所使用的 shell 必須 列於 + /etc/shells 裡頭。 如果是由 + Ports Collection 來裝 shell, + 那這個步驟已經完成了。 但若是手動安裝了一個 shell, + 那麼就必須為新安裝的 shell 進行設定。 - For example, if you installed bash by hand - and placed it into /usr/local/bin, you would - want to: + 舉例來說,若手動安裝了 bash 並將它置於 + /usr/local/bin 底下,你還得: &prompt.root; echo "/usr/local/bin/bash" >> /etc/shells - Then rerun chsh. + 然後再重新執行 chsh 文字編輯器 text editors editors - A lot of configuration in FreeBSD is done by editing text files. - Because of this, it would be a good idea to become familiar - with a text editor. FreeBSD comes with a few as part of the base - system, and many more are available in the Ports Collection. + 在 FreeBSD 中有許多設定必須透過編輯文字檔完成。 + 因此,若能熟悉文字編輯器是再好不過的。 + FreeBSD 本身(指 base system)就附有幾種文字編輯器, + 此外,你也可以透過 Ports Collection 來安裝其他的文字編輯器。 ee editors ee - The easiest and simplest editor to learn is an editor called - ee, which stands for easy editor. To - start ee, one would type at the command - line ee filename where - filename is the name of the file to be edited. - For example, to edit /etc/rc.conf, type in - ee /etc/rc.conf. Once inside of - ee, all of the - commands for manipulating the editor's functions are listed at the - top of the display. The caret ^ character represents - the Ctrl key on the keyboard, so ^e expands to the key combination - Ctrle. To leave - ee, hit the Esc key, then choose leave - editor. The editor will prompt you to save any changes if the file - has been modified. + 最簡單易學的文字編輯器叫做 ee, + 代表了其全名 easy editor。 要開始使用 ee, + 必須在命令列上輸入 + ee filename, + 這邊的 filename 代表你想要編輯的檔案名稱。 + 舉例來說,要編輯 /etc/rc.conf,就要輸入 + ee /etc/rc.conf。 + 而在 ee 的操作介面下, + 所有編輯器的功能與操作都會顯示在螢幕的正上方。 + 其中的插入符號(^)代表鍵盤上的 Ctrl + 鍵,所以 ^e 就等同於 + Ctrle + 。 若要結束 ee,請按下 Esc + 鍵,接著選擇 leave editor 即可。 + 此時如果該檔案有修改過,編輯器會提醒你是否要存檔。 vi editors vi emacs editors emacs - FreeBSD also comes with more powerful text editors such as - vi as part of the base system, while other editors, like - Emacs and vim, - are part of the FreeBSD Ports Collection (editors/emacs and editors/vim). These editors offer much - more functionality and power at the expense of being a little more - complicated to learn. However if you plan on doing a lot of text - editing, learning a more powerful editor such as - vim or Emacs - will save you much more time in the long run. + + 此外,FreeBSD 也內附了幾個好用的文字編輯器,像是 base system 的 + vi 及 FreeBSD Ports Collection 內的其他編輯器, + 比如 Emacsvim + (editors/emacs 及 + editors/vim)。 + 這些文字編輯器提供更強的功能,但是也比較難學習。 + 然而若要從事大量文字編輯工作, + 那麼花點時間來學習這些好用的編輯器, + 會在日後為您省下更多的時間。 - Devices and Device Nodes + 設備及設備節點 - A device is a term used mostly for hardware-related - activities in a system, including disks, printers, graphics - cards, and keyboards. When FreeBSD boots, the majority - of what FreeBSD displays are devices being detected. - You can look through the boot messages again by viewing - /var/run/dmesg.boot. + 設備(device)主要是指跟硬體比較有關的術語, + 包括磁碟、印表機、顯示卡和鍵盤。 FreeBSD 開機過程當中, + 大多數硬體通常都能偵測到並顯示出來,也可以查閱 + /var/run/dmesg.boot 內有開機的相關訊息。 - For example, acd0 is the - first IDE CDROM drive, while kbd0 - represents the keyboard. + 舉例來說,acd0即為第一台 IDE 光碟機的代號, + 而 kbd0 則代表鍵盤。 - Most of these devices in a &unix; operating system must be - accessed through special files called device nodes, which are - located in the /dev directory. + 在 &unix; 作業系統, + 大部分的設備都是透過叫做 device nodes(設備節點)的特殊檔案來作存取, + 而這些檔案都位於 /dev 目錄。 - Creating Device Nodes - When adding a new device to your system, or compiling - in support for additional devices, new device nodes must - be created. + 建立設備節點 + 若要在系統上建立新節點,或者是要編譯某些新硬體的支援軟體, + 那麼就要先新增設備節點。 <literal>DEVFS</literal> (DEVice File System) - The device file system, or DEVFS, provides access to - kernel's device namespace in the global file system namespace. - Instead of having to create and modify device nodes, - DEVFS maintains this particular file system for you. + 設備檔案系統(或稱為 DEVFS) 是指在整體檔案系統 + namespace 提供 kernel 的設備 namespace。 DEVFS + 乃是維護這些檔案系統,而不能新增或修改這些設備節點。 - See the &man.devfs.5; manual page for more - information. + 細節請參閱 &man.devfs.5; 說明。 - Binary Formats + Binary 的格式 - To understand why &os; uses the &man.elf.5; - format, you must first know a little about the three currently - dominant executable formats for &unix;: + 若要知道為何 &os; 是採用 &man.elf.5; 格式,必先瞭解當前 &unix; + 系統中三種影響最為重大的可執行檔相關背景: - + &man.a.out.5; - The oldest and classic &unix; object - format. It uses a short and compact header with a magic + 最古老、經典 的 &unix; object 檔格式。 + It uses a short and compact header with a magic number at the beginning that is often used to characterize the format (see &man.a.out.5; for more details). It contains three loaded segments: .text, .data, and .bss plus a symbol table and a string table. COFF The SVR3 object format. The header now comprises a section table, so you can have more than just .text, .data, and .bss sections. &man.elf.5; The successor to COFF, featuring multiple sections and 32-bit or 64-bit possible values. One major drawback: ELF was also designed with the assumption that there would be only one ABI per system architecture. That assumption is actually quite incorrect, and not even in the commercial SYSV world (which has at least three ABIs: SVR4, Solaris, SCO) does it hold true. FreeBSD tries to work around this problem somewhat by providing a utility for branding a known ELF executable with information about the ABI it is compliant with. See the manual page for &man.brandelf.1; for more information. FreeBSD comes from the classic camp and used the &man.a.out.5; format, a technology tried and proven through many generations of BSD releases, until the beginning of the 3.X branch. Though it was possible to build and run native ELF binaries (and kernels) on a FreeBSD system for some time before that, FreeBSD initially resisted the push to switch to ELF as the default format. Why? Well, when the Linux camp made their painful transition to ELF, it was not so much to flee the a.out executable format as it was their inflexible jump-table based shared library mechanism, which made the construction of shared libraries very difficult for vendors and developers alike. Since the ELF tools available offered a solution to the shared library problem and were generally seen as the way forward anyway, the migration cost was accepted as necessary and the transition made. FreeBSD's shared library mechanism is based more closely on Sun's &sunos; style shared library mechanism and, as such, is very easy to use. So, why are there so many different formats? Back in the dim, dark past, there was simple hardware. This simple hardware supported a simple, small system. a.out was completely adequate for the job of representing binaries on this simple system (a PDP-11). As people ported &unix; from this simple system, they retained the a.out format because it was sufficient for the early ports of &unix; to architectures like the Motorola 68k, VAXen, etc. Then some bright hardware engineer decided that if he could force software to do some sleazy tricks, then he would be able to shave a few gates off the design and allow his CPU core to run faster. While it was made to work with this new kind of hardware (known these days as RISC), a.out was ill-suited for this hardware, so many formats were developed to get to a better performance from this hardware than the limited, simple a.out format could offer. Things like COFF, ECOFF, and a few obscure others were invented and their limitations explored before things seemed to settle on ELF. In addition, program sizes were getting huge and disks (and physical memory) were still relatively small so the concept of a shared library was born. The VM system also became more sophisticated. While each one of these advancements was done using the a.out format, its usefulness was stretched more and more with each new feature. In addition, people wanted to dynamically load things at run time, or to junk parts of their program after the init code had run to save in core memory and swap space. Languages became more sophisticated and people wanted code called before main automatically. Lots of hacks were done to the a.out format to allow all of these things to happen, and they basically worked for a time. In time, a.out was not up to handling all these problems without an ever increasing overhead in code and complexity. While ELF solved many of these problems, it would be painful to switch from the system that basically worked. So ELF had to wait until it was more painful to remain with a.out than it was to migrate to ELF. However, as time passed, the build tools that FreeBSD derived their build tools from (the assembler and loader especially) evolved in two parallel trees. The FreeBSD tree added shared libraries and fixed some bugs. The GNU folks that originally wrote these programs rewrote them and added simpler support for building cross compilers, plugging in different formats at will, and so on. Since many people wanted to build cross compilers targeting FreeBSD, they were out of luck since the older sources that FreeBSD had for as and ld were not up to the task. The new GNU tools chain (binutils) does support cross compiling, ELF, shared libraries, C++ extensions, etc. In addition, many vendors are releasing ELF binaries, and it is a good thing for FreeBSD to run them. ELF is more expressive than a.out and allows more extensibility in the base system. The ELF tools are better maintained, and offer cross compilation support, which is important to many people. ELF may be a little slower than a.out, but trying to measure it can be difficult. There are also numerous details that are different between the two in how they map pages, handle init code, etc. None of these are very important, but they are differences. In time support for a.out will be moved out of the GENERIC kernel, and eventually removed from the kernel once the need to run legacy a.out programs is past. 更多資訊 - Manual Pages + Manual 線上說明 manual pages - The most comprehensive documentation on FreeBSD is in the form - of manual pages. Nearly every program on the system comes with a - short reference manual explaining the basic operation and various - arguments. These manuals can be viewed with the man command. Use - of the man command is simple: + 在使用 FreeBSD 時,最詳細的使用說明莫過於 man 線上說明。 + 幾乎各程式都會有附上簡短說明,以介紹該程式的基本功能跟相關參數用法。 + 可以透過 man 指令來閱讀這些說明,而 + man 指令的使用相當簡單易懂: &prompt.user; man command - command is the name of the command you - wish to learn about. For example, to learn more about - ls command type: + command 處就是想要知道的指令。 舉個例子, + 若要知道 ls 的詳細用法,就可以打: &prompt.user; man ls - The online manual is divided up into numbered sections: + 而各線上說明因為性質不同,而區分為下列的數字章節: - User commands. + 使用者指令。 - System calls and error numbers. + 系統呼叫(System call) 及錯誤代號。 - Functions in the C libraries. + C 語言函式庫。 - Device drivers. + 各設備的驅動程式。 - File formats. + 檔案格式。 - Games and other diversions. + 小遊戲程式及其他娛樂程式。 - Miscellaneous information. + 雜項工具、其他資訊。 - System maintenance and operation commands. + 系統維護、操作的指令。 - Kernel developers. + Kernel 開發用途。 - In some cases, the same topic may appear in more than one - section of the online manual. For example, there is a - chmod user command and a - chmod() system call. In this case, you can - tell the man command which one you want by specifying the - section: + 有些情況會有同樣主題但不同章節。 舉個例子,系統內會有 + chmod 指令,但也有 chmod() + 系統呼叫。 在這種情況,man + 應該要指定所要查詢的章節: &prompt.user; man 1 chmod - This will display the manual page for the user command - chmod. References to a particular section of - the online manual are traditionally placed in parenthesis in - written documentation, so &man.chmod.1; refers to the - chmod user command and &man.chmod.2; refers to - the system call. + 如此一來就會查 chmod 指令部分。 + 通常在寫文件時會把有參考到某特定章節的 man 號碼也一併寫在括號內。 + 所以 &man.chmod.1; 就是指 chmod 指令,而 + &man.chmod.2; 則是指系統呼叫的部分。 - This is fine if you know the name of the command and simply - wish to know how to use it, but what if you cannot recall the - command name? You can use man to search for keywords in the - command descriptions by using the - switch: + 如果您已經知道命令的名稱,只是不知道要怎樣使用的話,那就比較好辦。 + 但若不知道要用哪個指令時,該怎麼辦呢? 這個時候,就可以利用 + man 的搜尋關鍵字功能, + 以在各說明的介紹部分搜尋相關字眼。,它的選項是 : + &prompt.user; man -k mail - With this command you will be presented with a list of - commands that have the keyword mail in their - descriptions. This is actually functionally equivalent to using - the apropos command. + 如此一來會看到一堆有 mail 關鍵字的說明, + 事實上該功能與 apropos 指令是一樣的。 - So, you are looking at all those fancy commands in - /usr/bin but do not have the faintest idea - what most of them actually do? Simply do: + 而有時你會看到像是 /usr/bin + 有許多看起來頗炫的指令,但不知其用途? 只要簡單輸入: &prompt.user; cd /usr/bin &prompt.user; man -f * - or + 或者是 &prompt.user; cd /usr/bin &prompt.user; whatis * - which does the same thing. + 這兩者的指令效果是一樣的。 - GNU Info Files + GNU Info 檔案 Free Software Foundation - FreeBSD includes many applications and utilities produced by - the Free Software Foundation (FSF). In addition to manual pages, - these programs come with more extensive hypertext documents called - info files which can be viewed with the - info command or, if you installed - emacs, the info mode of - emacs. + FreeBSD 有許多程式跟工具來自於自由軟體基金會(FSF)。 除了 man + 線上說明之外,這些程式提供了另外一種更具有彈性的 hypertext 格式文件, + 叫做 info。 可以用 info + 指令來閱讀,或者若有裝 emacs 亦可透過 + emacs 的 info 模式閱讀。 - To use the &man.info.1; command, simply type: + 要用 &man.info.1; 指令,只需打: &prompt.user; info - For a brief introduction, type h. For a - quick command reference, type ?. + h 會有簡單說明,而若要快速查閱相關操作方式, + 則請按 ?
diff --git a/zh_TW.Big5/books/handbook/install/chapter.sgml b/zh_TW.Big5/books/handbook/install/chapter.sgml index 92f27037b0..a6a8ff71d5 100644 --- a/zh_TW.Big5/books/handbook/install/chapter.sgml +++ b/zh_TW.Big5/books/handbook/install/chapter.sgml @@ -1,4606 +1,4564 @@ Jim Mock Restructured, reorganized, and parts rewritten by Randy Pratt The sysinstall walkthrough, screenshots, and general copy by 安裝 FreeBSD 概述 installation FreeBSD 提供一個簡單好用的文字介面安裝程式,叫做 sysinstall。 這是 FreeBSD 預設使用的安裝程式 。協力廠商若有意願的話,也可以改用自己的安裝程式。 本章將說明如何使用 sysinstall 來安裝 FreeBSD。 讀完這章,您將了解︰ 如何製作 FreeBSD 安裝片 FreeBSD 對硬碟的使用及配置。 如何啟動 sysinstall 程式。 在執行 sysinstall 時會問的相關問題有哪些、這些問題的意思為何、以及該如何回答。 在開始閱讀這章之前,您需要︰ 閱讀要安裝的 FreeBSD 版本所附之硬體支援表, 以確定您的硬體有沒有被支援。 一般來說,此安裝說明是針對 &i386; (相容的 PC 機種) 架構的電腦。 如果有其他架構(比如 Alpha)的安裝說明,我們會一併列出。 雖然本文件會常常更新,但有可能與您安裝版本上所附的說明文件有些許出入。 在此,我們建議您把本說明文章當作一般的安裝參考原則就好。 硬體需求 最低需求 安裝 &os; 的硬體方面最低需求,依各 &os; 版本與硬體架構差別而有所不同。 關於安裝所需的最低需求,可在 &os; 網站的 Release Information 找相關的 Installation Notes 說明。 接下來的章節會有相關說明整理。 根據安裝 &os; 的方式不同,可能會需要軟碟機或光碟機, 或某些情況則是要網路卡。 這些部份會在 有介紹。 &os;/&arch.i386; 及 &os;/&arch.pc98; 架構 &os;/&arch.i386; 及 &os;/&arch.pc98; 兩種版本均須 486 或更好的處理器, 以及至少 24 MB 的 RAM、至少 150 MB 的硬碟空間, 才能進行最小安裝。 對老舊硬體而言,在大部份情況裝更多的 RAM 與更大的硬碟空間,會比使用更快的 CPU 更有用。 &os;/&arch.alpha; 架構 若要裝 &os;/&arch.alpha;,則需確認該機型是否有支援 (請參閱 ) 且必須整顆硬碟皆給 &os; 使用。 目前無法同時與其他作業系統共存。 這硬碟須接到 SRM 韌體有支援的 SCSI controller 上,或者 IDE 硬碟 (該機型的 SRM 有支援可從 IDE 硬碟開機)。 此外,還需該機型的 SRM console firmware。 有些機型可以選擇 AlphaBIOS (or ARC) firmware 或 SRM 來用。 若沒有的話,則需從硬體廠商的網站去下載新的韌體。 從 &os; 7.0 就不再支援 Alpha。 &os; 6.X 系列則是此架構的最後支援 。 &os;/&arch.amd64; 架構 有兩種 CPU 能跑 &os;/&arch.amd64;。 第一種是包括 &amd.athlon;64 、&amd.athlon;64-FX、&amd.opteron; 或更好的 CPU。 第二種則是 &intel; EM64T 架構的 CPU,這些也可以用 &os;/&arch.amd64;。 這些 CPU 包括了 &intel; &core; 2 Duo 、Quad、Extreme 系列以及 &intel; &xeon; 3000、5000、7000 相關系列的 CPU。 若主機板晶片組為 nVidia nForce3 Pro-150,則 必須 調整 BIOS 設定,將 IO APIC 停用才行。 若找不到這選項,那可能就是找 ACPI 停用。 因為 Pro-150 晶片組有個 bug,目前我們尚無找到堪解之道。 &os;/&arch.sparc64; 架構 若要裝 &os;/&arch.sparc64;,則需確認該機型是否有支援 (請參閱 )。 &os;/&arch.sparc64; 必須使用整顆硬碟, 因為無法同時與其他作業系統共存。 有支援的硬體 &os; 每次 release 時都會有附上 &os; Hardware Notes 來說明有支援的硬體列表。 通常這份文件可在光碟或 FTP 的最上層目錄找到,也就是名為 HARDWARE.TXT 的檔案。 此外,在 sysinstall 的 documentation 選項內也可以看到。 每次 &os; release 時該列表會依各不同架構, 而列出相關已知有支援的硬體。 在 &os; 網站的 Release Information 頁可以找到各不同 release 版本與各架構上的硬體支援列表。 安裝前的準備工作 列出您電腦的硬體清單 在安裝 FreeBSD 之前,您應該試著將您電腦中的硬體清單列出來。 FreeBSD 安裝程式會將這些硬體(硬碟、網路卡、光碟機等等) 以型號及製造廠商列出來。 FreeBSD 也會嘗試為這些硬體找出最適當的 IRQ 及 IO port 的設定。 但是因為 PC 的硬體種類實在太過複雜,這個步驟不一定保證絕對成功。 這時,您就可能需要手動更改有問題的設定值哩。 如果您已裝了其它的作業系統,如: &windows; 或 Linux,那麼可先由這些系統所提供的工具, 來查看這些硬體設定值是怎麼設定的。 若真的沒辦法確定某些卡用什麼設定值, 那麼可以檢查看看卡上面所標示的東西,說不定它的設定已有標示在卡上。 常用的 IRQ 號碼為 3、5 以及 7;而 IO 埠的值通常以 16 進位表示, 例如 0x330。 建議您在安裝 FreeBSD 之前,把這些資料列印或抄錄下來做成表格, 也許會較有用喔,例如: 硬體清單(舉例) 硬體名稱 IRQ IO port(s) 備註 第一顆 IDE 硬碟 N/A N/A 40 GB,Seagate 製造,接在第一條 IDE 排線的 master CDROM N/A N/A 接在第一條 IDE 排線的 slave 第二顆硬碟 N/A N/A 20 GB,IBM 製造,接在第二條 IDE 排線的 master 第一個 IDE controller 14 0x1f0 網路卡 N/A N/A &intel; 10/100 數據機 N/A N/A &tm.3com; 56K faxmodem,接在 COM1
硬體清單完成之後,就需針對你所要裝的 &os; 版本之硬體需求, 來檢查是否有支援。
備份您的資料 如果要裝的電腦上面存有重要資料,那麼在安裝 FreeBSD 前, 請確定您已經將這些資料備份了,並且先測試過這些備份檔是否沒有問題。 FreeBSD 安裝程式在要寫入任何資料到您的硬碟前,都會先提醒您確認, 一旦您確定要寫入,那麼之後就再也沒有反悔的機會囉。 決定要將 FreeBSD 安裝到哪裡 如果您想讓 FreeBSD 直接使用整顆硬碟,那麼請直接跳到下一節。 然而,如果您想要 FreeBSD 跟既有的系統並存,那麼, 您必須對硬碟的資料分佈方式有深入的了解,以及其所造成的影響。 &os;/&arch.i386; 架構的硬碟配置模式 PC 上的硬碟可以被細分為許多分散區(chunk)。這些區域叫做 分割區(Partitions)。 由於 &os; 內部也有 partition,名稱可能很容易造成混淆, 因此通常在 &os; 這邊會稱呼這些磁碟分散區為 disk slices 或簡稱 slices。 舉例來說,FreeBSD 的 fdisk 的對象是針對 PC 硬碟的 slice 而非 partition。 因為 PC 本身先天設計,每個硬碟最多可以有 4 個分割區,而這些分割叫做 主要分割區(Primary Partitions)。 為了突破這個限制,以便能使用更多的分割區,就有了新的分割區類型,叫作: 延伸分割區(Extended Partition)。 每個硬碟就只能有一個延伸分割區。 然而,在延伸分割區裡面可以建立許多個特殊分割區,叫作 邏輯分割區(Logical Partitions) 每種分割區都有其 分割區代號(Partition ID) 用以區別每種分割區的資料類型。 而 FreeBSD 分割區代號是 165 一般來講,每種作業系統都會有自己獨特的方式來區別分割區。 舉例: DOS 及其之後的作業系統,比如 &windows; 會分配給每個主要分割區及邏輯分割區 1 個 磁碟代號(drive letter),從 C: 開始。 FreeBSD 必須安裝在主要分割區。 FreeBSD 可以在這個分割區上面存放資料或是您建立的任何檔案。 然而,如果您有很多顆硬碟,也可以在這些(或部份)硬碟建立 FreeBSD 分割區。 安裝 FreeBSD 的時候,必須至少要有 1 個分割區給 FreeBSD 使用, 這個分割區可以是尚未使用的分割區,或是現存的分割區 (但上面的資料不打算繼續使用)。 如果已經用完了磁碟上所有的分割區, 那麼您必須使用其他作業系統所提供的工具 (像是 DOS or &windows; 上的 fdisk) 來騰出一個分割區給 FreeBSD 用。 如果有多餘的分割區,也可以使用它。 但使用前,您可能需要先整理一下這些分割區。 FreeBSD最小安裝需要約 100 MB 的空間,但是這只是『最小安裝』, 幾乎沒剩下多少空間來存放您自己的檔案。 較理想的(不含圖形介面)最小安裝是約 250 MB,或者是 350 MB 左右(包含圖形介面)。 還需要安裝其他的套件軟體,那麼將需要更多的硬碟空間。 您可以使用商業軟體像是 &partitionmagic; 或免費自由工具像是 GParted 來重新調整分割區空間, 來給 FreeBSD 用的空間。FreeBSD 光碟、FTP 上面的 tools 目錄包含兩個免費的工具, 也可以達成這個工作,叫作:FIPSPResizer。 這些工具的說明文件可以在同個目錄內找到。 FIPSPResizer&partitionmagic; 可以重新調整在 &ms-dos; 到 &windows; ME 所使用的 FAT16FAT32 分割區大小。 目前已知可更改 NTFS 分割區的有 &partitionmagic;GParted 這兩種工具程式。 GParted在許多 Linux distributions 的 Live CD 都有提供,像是 SystemRescueCD 目前已知 µsoft; Vista 分割區的重新調整大小會有問題。 在做上述類似動作時,請記得手邊要有 Vista 安裝光碟以免萬一。 此外,強烈建議先做磁碟維護,以及現有資料備份。 不當的使用這些工具,可能會刪除所有硬碟上的資料。 在使用這些工具前,請確定您已有先備份好資料。 使用現有的分割區 假設您只有一個 4 GB 的硬碟,而且已經裝了 &windows; ,然後將這顆硬碟分成兩個磁碟代號:C:D:,每個大小為 2 GB 。 C: 槽上放了 1 GB 的資料, 而 D: 槽上放了 0.5 GB 的資料。 這表示硬碟上有兩個分割區,每個磁碟代號槽都是分割區。 您可以把所有放在 D: 的資料,都移動到 C:,這樣就空出了第二個分割區可以給 FreeBSD 使用。 縮減現有的分割區 假設您只有一個 4 GB 硬碟,而且已經裝了 &windows;。 在安裝 &windows; 時把 4 GB 都給 C: 槽,並且現在已經用了 1.5 GB 空間,而你想將剩下空間的 2 GB 給 FreeBSD 使用。 如此一來,為了裝 FreeBSD,你必須在以下兩種方式二選一: 備份 &windows; 資料,然後重裝 &windows;, 並在安裝 &windows; 時給 2 GB 的分割空間。 使用上述的工具,像是 &partitionmagic;,來重新調整 &windows; 所用的分割區大小。 Alpha 架構的磁碟配置模式 在 Alpha 上,您必須使用一整顆硬碟給 FreeBSD, 沒有辦法在同顆硬碟上跟其他作業系統共存。 依不同型號的 Alpha 機器,您的硬碟可以是 SCSI 或 IDE 硬碟, 只要您的機器可以從這些硬碟開機就可以。 按照 Digital / Compaq 使用手冊的編排風格, 所有 SRM 輸入的部分都用大寫表示。 注意:SRM 大小寫有別。 要得知您磁碟的名稱以及型號,可以在 SRM console 提示下使用 SHOW DEVICE 命令: >>>SHOW DEVICE dka0.0.0.4.0 DKA0 TOSHIBA CD-ROM XM-57 3476 dkc0.0.0.1009.0 DKC0 RZ1BB-BS 0658 dkc100.1.0.1009.0 DKC100 SEAGATE ST34501W 0015 dva0.0.0.0.1 DVA0 ewa0.0.0.3.0 EWA0 00-00-F8-75-6D-01 pkc0.7.0.1009.0 PKC0 SCSI Bus ID 7 5.27 pqa0.0.0.4.0 PQA0 PCI EIDE pqb0.0.1.4.0 PQB0 PCI EIDE 例子中機器為 Digital Personal Workstation 433au, 並且顯示出此機器有連接三個磁碟機。 第一個是 CDROM,叫做 DKA0 ;另外兩個是磁碟機, 分別叫做: DKC0DKC100 磁碟機的名稱中有 DKx 字樣的是 SCSI 硬碟。例如: DKA100 表示是 SCSI 硬碟,其 SCSI ID 為 1, 位在第一個 SCSI 匯流排(A); 而 DKC300 表示是 SCSI 硬碟, 其 SCSI ID 為 3,位於第三個 SCSI 匯流排(C)。 裝置名稱 PKx 則為 SCSI 控制卡。 由上述 SHOW DEVICE 的結果看來, SCSI 光碟機也被視為是 SCSI 硬碟的一種。 若為 IDE 硬碟的話,名稱會有 DQx 字樣, 而 PQx 則表示相對應的 IDE 磁碟控制器。 整理你的網路設定資料 如果想透過網路( FTP 站或 NFS)安裝 FreeBSD, 那麼就必須知道您的網路設定。 在安裝 FreeBSD 的過程中將會提示您輸入這些資訊,以順利完成安裝過程。 使用乙太網路(Ethernet)或 Cable/DSL 數據機上網 若使用乙太網路,或是要透過 Cable/DSL 數據機上網, 那麼您必須準備下面的資訊: IP 位址 預設 Gateway(閘道) 的 IP 位址 Hostname(機器名稱) DNS 伺服器的 IP 位址 Subnet Mask 若不知道這些資訊,您可以詢問系統管理者或是您的 ISP 業者。 他們可能會說這些資訊會由 DHCP 自動指派; 如果是這樣的話,請記住這一點就可以了。 使用數據機上網 若由一般的數據機撥接上網,您仍然可以安裝 FreeBSD, 只是會需要很長的時間。 您必須知道: 撥接到 ISP 的電話號碼。 您的數據機是連到哪個 COM 埠。 您撥接到 ISP 所用的帳號跟密碼。 查閱 FreeBSD 勘誤表(Errata) 雖然我們盡力使得每個 FreeBSD 發行版本都很穩定, 但是過程中仍然不免有時會發生錯誤。 在某些很罕見的情形下,這些錯誤會影響到安裝的過程。 當發現這些錯誤且修正後,會將它們列在 FreeBSD 勘誤表(Errata) 中。 在您安裝 FreeBSD 前,應該先看看勘誤表中有沒有什麼問題會影響到您的安裝。 關於所有發行版本的資訊(包括勘誤表),可以在 FreeBSD 網站發行情報(release information) 找到。 準備好 FreeBSD 安裝檔案 FreeBSD 可以透過下面任何一種安裝來源進行安裝︰ Local Media CDROM 或 DVD 現有的 DOS 分割區 SCSI 或 QIC 磁帶。 軟碟磁片 Network FTP 站、支援 Passvie 模式的 FTP 站(若您機器在 NAT 內) 、甚至 HTTP proxy 都可以。 NFS 伺服器 專用(dedicated)的 parallel 或 serial 連線 若已經有 FreeBSD 的 CD 或 DVD,但機器不支援從光碟開機的話, 那麼請直接進下一節 ()。 若沒有 FreeBSD 安裝片的話,那麼請先看 這裡會介紹如何準備所需要的安裝片, 照該節步驟弄好後,就可以繼續下一步 準備好開機磁片 FreeBSD 安裝流程是要從電腦開機後,進入 FreeBSD 安裝畫面 —— 而不是在其他作業系統上執行程式。 一般來講,電腦都是用裝在硬碟上的作業系統來開機, 也可以用開機磁片來開機; 此外,現在大多數電腦都可以從光碟開機。 如果您有 FreeBSD 的 CDROM 或 DVD(無論是用買現成的或是自己燒錄的), 且您的電腦可支援由光碟開機,(通常在 BIOS 中會有 Boot Order 或類似選項),那麼您就可以跳過此小節。 因為 FreeBSD CDROM 或 DVD 都可以用來開機。 請按照下面步驟,以製作開機片: 取得開機片的映像檔(images) 開機磁片用的映像檔(images)通常會放在光碟片上的 floppies/ 目錄內, 另外也可以從像是下面 FTP 站的 floppies 目錄下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/releases/<arch>/<version>-RELEASE/floppies/ 。請將『arch』、『version』替換為打算安裝的電腦架構、OS 版本。 例如:想裝的是 &os;/&arch.i386; &rel.current;-RELEASE ,那麼可以到 下載。 映像檔(images)的附檔名都是 .flp。而 floppies/ 目錄內包含一些不同用途的映像檔 (images),這取決於您要裝的 FreeBSD 版本、需求、硬體配備為何。 通常要 4 個映像檔,也就是: boot.flpkern1.flpkern2.flpkern3.flp。 若有疑問的話,請翻閱同一目錄下的 README.TXT 文件檔,以瞭解相關最新注意事項。 在使用 FTP 下載時,必須使用 binary 模式 進行傳輸。 有些瀏覽器預設是以 text (或 ASCII) 模式來傳輸資料, 所以這些錯誤傳輸模式下載的映像檔所做成的磁片,會無法使用。 準備開機磁片 每個映像檔都需要一張磁片,並且請避免使用到壞的磁片。 最簡單的檢測方式就是自己先把這些磁片再重新格式化(format) 而不要相信所謂的已格式化的磁片,&windows; 內的 format 在格式化時,並不會告訴你是否有壞軌, 而只會直接將它們標示壞軌而不使用壞軌部分而已。 此外,建議採用全新的磁片來製作安裝片比較保險。 若在安裝 FreeBSD 的過程中發生當機、 畫面凍結或是其他怪異的現象,首先要懷疑的就是開機磁片是否壞掉。 請用其他的磁片製作映像檔再試試看。 將映像檔(images)寫入到磁片內 .flp 檔並非一般檔案, 不能直接把它複製到磁片上。 事實上它是包含整張磁片所有內容的映像檔(image)。 也就是說,不能純粹複製檔案到磁片上, 而必須使用特別的工具程式,來將映像檔直接寫到磁片上。 DOS 若要用 &ms-dos;/&windows; 來作安裝片的話,那麼可以用 fdimage 工具程式來將映像檔,寫到磁片上。 若您用的是 FreeBSD 光碟的話(假設光碟機代號為 E: ,那麼請執行類似下面的指令: E:\> tools\fdimage floppies\boot.flp A: 請針對每個需要用到的 .flp 映像檔, 重複上述的指令(記得更改相關檔名),每次的映像檔完成後, 都需要換另外一片來裝新的映像檔; 請記得: 在作好的磁片上註明是使用哪個映像檔作的。 若 .flp 映像檔放在不同地方, 請自行修改上述指令。若沒有 FreeBSD 光碟的話, 可以到 FTP 上面的 tools 目錄 下載 fdimage 使用。 如果要用 &unix; 系統(比如其他台 FreeBSD 機器) 來製作開機片的話,可以用 &man.dd.1; 指令來把映像檔直接寫入到磁片上。 在 FreeBSD上的話,可以打類似下面的指令: &prompt.root; dd if=boot.flp of=/dev/fd0 在 FreeBSD 中,/dev/fd0 就是指第一台軟碟機(即一般 &ms-dos;/&windows; 上的 A: 磁碟機); 而 /dev/fd1B: 磁碟機,其餘的依此類推。 不過其他的 &unix; 系統可能會用不同的名稱,這時就要查閱該系統的說明文件了。 現在起,我們可以開始安裝 FreeBSD 囉!
開始安裝 預設的情況下,安裝過程並不會改變您磁碟機中的任何資料, 除非您看到下面的訊息: Last Chance: Are you SURE you want continue the installation? If you're running this on a disk with data you wish to save then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before proceeding! We can take no responsibility for lost disk contents! 在看到這最後的警告訊息前, 您都可以隨時離開安裝程式而不會變更您的硬碟。 如果您發現有任何設定錯誤, 這時您可以直接將電源關掉而不會造成任何傷害。 開機啟動流程篇 &i386; 平台的開機流程 在一開始,電腦電源開關是關閉的。 打開電腦電源開關。剛開始的時候, 它應該會顯示進入系統設定選單或 BIOS 要按哪個鍵, 常見的有: F2, F10, Del Alt S 。(按鍵請依據實際情況決定) 不論是要按哪個鍵, 請按它進入 BIOS 設定畫面。 有時您的電腦可能會顯示一個圖形畫面, 通常做法是按 Esc 鍵將離開這個圖形畫面, 以使您能夠看到必要的設定訊息。 找出可以設定『開機順序(Boot Order)』的選項, 通常該選項會列出一些設備讓您選擇,例如︰ Floppy, CDROM, First Hard Disk 等等。 如果要用軟碟安裝,請確定 floppy disk 要列為開機順序的第一個; 若要用光碟安裝,記得 CDROM 要列為開機順序的第一個。 為了避免不必要的疑惑,請參考機器、主機板說明手冊。 儲存設定並離開,系統應該會重新啟動。 若要用磁片安裝,請把在 一節中製作好的 boot.flp 那張安裝磁片放到第一台軟碟機中。 如果是從光碟安裝,那麼開機後請將 FreeBSD 光碟放入光碟機中。 如果,開機後如往常一樣而沒有從軟碟或光碟開機,請檢查︰ 是不是磁片或光碟太晚放入而錯失開機時間。 如果是,請將它們放入,然後重新開機。 BIOS 設定不對或忘了儲存設定,請重新檢查 BIOS 的設定。 您的電腦 BIOS 不支援從光碟開機。 此時,FreeBSD 就開始啟動了。 如果是從光碟開機,會見到類似下面的畫面(版本部分省略): Booting from CD-Rom... CD Loader 1.2 Building the boot loader arguments Looking up /BOOT/LOADER... Found Relocating the loader and the BTX Starting the BTX loader BTX loader 1.00 BTX version is 1.01 Console: internal video/keyboard BIOS CD is cd0 BIOS drive C: is disk0 BIOS drive D: is disk1 BIOS 639kB/261120kB available memory FreeBSD/i386 bootstrap loader, Revision 1.1 Loading /boot/defaults/loader.conf /boot/kernel/kernel text=0x64daa0 data=0xa4e80+0xa9e40 syms=[0x4+0x6cac0+0x4+0x88e9d] \ 如果您從軟碟開機,會看到類似下面的畫面(版本部分省略): Booting from Floppy... Uncompressing ... done BTX loader 1.00 BTX version is 1.01 Console: internal video/keyboard BIOS drive A: is disk0 BIOS drive C: is disk1 BIOS 639kB/261120kB available memory FreeBSD/i386 bootstrap loader, Revision 1.1 Loading /boot/defaults/loader.conf /kernel text=0x277391 data=0x3268c+0x332a8 | Insert disk labelled "Kernel floppy 1" and press any key... 請根據提示將 boot.flp 磁片取出, 並放入 kern1.flp 這張磁片, 然後按 Enter 鍵。 總之,您只需從第一張磁片啟動,然後根據提示,再放入相關磁片即可。 無論從軟碟或光碟開機,接下來會進入 &os; boot loader 選單畫面:
&os; Boot Loader 選單
您可以等待 10 秒,或是按 Enter 鍵。
Alpha 平台的開機流程 Alpha 在一開始,電腦電源開關是關閉的。 打開電腦電源開關,然後等開機畫面出現。 若要用磁片安裝,請把在 一節中製作好的 boot.flp 那張安裝磁片放到第一台軟碟機中。 然後,打下列指令來從磁片開機 (請把下列軟碟機代號改為你電腦的軟碟機代號): >>>BOOT DVA0 -FLAGS '' -FILE '' 若要用光碟安裝,請把做好的安裝片放入光碟機, 然後打下列指令來從光碟開機 (請把下列光碟機代號改為你電腦的光碟機代號): >>>BOOT DKA0 -FLAGS '' -FILE '' 接著 FreeBSD 開機片就會開始了。若是由軟碟開機的話, 這時會看到以下訊息: Insert disk labelled "Kernel floppy 1" and press any key... 請照指示,拿走 boot.flp 片,改放 kern1.flp 片, 然後按 Enter 無論從軟碟或光碟開機,您都會看到下面這段訊息: Hit [Enter] to boot immediately, or any other key for command prompt. Booting [kernel] in 9 seconds... _ 您可以等待 10 秒,或是按 Enter 鍵。 接下來就會進入kernel configuration 選單。 &sparc64; 平台的開機流程 大多數的 &sparc64; 機器預設會自動從硬碟開機。 因此要裝 &os; 的話,則需要進入 PROM(OpenFirmware) 設定由網路或光碟開機才可。 請先重開機,然後等待直到開機訊息出現。 這部分可能會隨機器型號不同 ,而有所差異,但大概會出現像下列這樣: 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. 若您機器此時會先由硬碟開機,那麼需要按 L1AStopA 或者是透過 serial console (用法請參閱 &man.tip.1; 或 &man.cu.1; 內有關 ~# 的說明) 送出 BREAK 指令來進入 PROM prompt。 大概會像下面: ok ok {0} 這是適用於只有單一 CPU 的機器。 這是適用於 SMP 機器,數字部分是指目前在使用中的 CPU 編號。 此時請把安裝光碟放入光碟機內,然後在 PROM prompt 打 boot cdrom 即可。
那要怎麼去翻閱偵測硬體的結果呢? 先前在螢幕上所顯示的最後幾百行字,會存在暫存區(buffer) 以便您翻閱。 若要翻閱暫存區,請按 Scroll Lock 鍵, 這會開啟捲動畫面功能。 然後就可以使用方向鍵,或是 PageUpPageDown 鍵來上下翻閱。 再按一次 Scroll Lock 鍵,就會停止畫面捲動。 現在就請試試看,翻閱一下偵測硬體的畫面吧, 你應該會看到類似 的畫面, 真正畫面會依你的電腦設備而有所不同。
偵測硬體的例子 avail memory = 253050880 (247120K bytes) Preloaded elf kernel "kernel" at 0xc0817000. Preloaded mfs_root "/mfsroot" at 0xc0817084. md0: Preloaded image </mfsroot> 4423680 bytes at 0xc03ddcd4 md1: Malloc disk Using $PIR table, 4 entries at 0xc00fde60 npx0: <math processor> on motherboard npx0: INT 16 interface pcib0: <Host to PCI bridge> on motherboard pci0: <PCI bus> on pcib0 pcib1:<VIA 82C598MVP (Apollo MVP3) PCI-PCI (AGP) bridge> at device 1.0 on pci0 pci1: <PCI bus> on pcib1 pci1: <Matrox MGA G200 AGP graphics accelerator> at 0.0 irq 11 isab0: <VIA 82C586 PCI-ISA bridge> at device 7.0 on pci0 isa0: <iSA bus> on isab0 atapci0: <VIA 82C586 ATA33 controller> port 0xe000-0xe00f at device 7.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 uhci0 <VIA 83C572 USB controller> port 0xe400-0xe41f irq 10 at device 7.2 on pci 0 usb0: <VIA 83572 USB controller> on uhci0 usb0: USB revision 1.0 uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr1 uhub0: 2 ports with 2 removable, self powered pci0: <unknown card> (vendor=0x1106, dev=0x3040) at 7.3 dc0: <ADMtek AN985 10/100BaseTX> port 0xe800-0xe8ff mem 0xdb000000-0xeb0003ff ir q 11 at device 8.0 on pci0 dc0: Ethernet address: 00:04:5a:74:6b:b5 miibus0: <MII bus> on dc0 ukphy0: <Generic IEEE 802.3u media interface> on miibus0 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto ed0: <NE2000 PCI Ethernet (RealTek 8029)> port 0xec00-0xec1f irq 9 at device 10. 0 on pci0 ed0 address 52:54:05:de:73:1b, type NE2000 (16 bit) isa0: too many dependant configs (8) isa0: unexpected small tag 14 orm0: <Option ROM> at iomem 0xc0000-0xc7fff on isa0 fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq2 on isa0 fdc0: FIFO enabled, 8 bytes threshold fd0: <1440-KB 3.5" drive> on fdc0 drive 0 atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0 atkbd0: <AT Keyboard> flags 0x1 irq1 on atkbdc0 kbd0 at atkbd0 psm0: <PS/2 Mouse> irq 12 on atkbdc0 psm0: model Generic PS/@ mouse, device ID 0 vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 sc0: <System console> at flags 0x100 on isa0 sc0: VGA <16 virtual consoles, flags=0x300> sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0 sio0: type 16550A sio1 at port 0x2f8-0x2ff irq 3 on isa0 sio1: type 16550A ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0 pppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode ppc0: FIFO with 16/16/15 bytes threshold plip0: <PLIP network interface> on ppbus0 ad0: 8063MB <IBM-DHEA-38451> [16383/16/63] at ata0-master UDMA33 acd0: CD-RW <LITE-ON LTR-1210B> at ata1-slave PIO4 Mounting root from ufs:/dev/md0c /stand/sysinstall running as init on vty0
請仔細檢查每項檢測結果,以確定 FreeBSD 有正確偵測到每項硬體。 若沒偵測到硬體的話,那畫面就不會列出來了。 自訂 kernel 可以讓您加上原本預設的 GENERIC kernel 所不支援的硬體,像是音效卡之類。 而 &os; 6.2 起的版本,在偵測硬體後會看到 ,請用方向鍵選擇你的國別、地區或群組。 然後按 Enter 鍵就會幫你設定相關國別、鍵盤對應。 此外,要離開、重啟 sysinstall 程式,也很簡單。
選擇國別
離開 Sysinstall 程式
在主畫面選擇 Exit Install, 接下來應該會出現以下訊息: User Confirmation Requested Are you sure you wish to exit? The system will reboot (be sure to remove any floppies/CDs/DVDs from the drives). [ Yes ] No 若按下 &gui.yes; 之後,卻忘了把光碟退出來的話, 那麼等下重開機後又會再次啟動安裝程式了。 若你是用磁片開機的話,那麼重開機之前,請記得先退出 boot.flp 片吧。
介紹 Sysinstall sysinstall 是 FreeBSD 計劃所提供的安裝程式。 它是以文字模式操作方式為主,分為幾層選單、畫面,以讓您進行安裝。 sysinstall 選單主要由方向鍵、 EnterTabSpace 以及其他按鍵來進行操作, 在 sysinstall 主畫面的 Usage 內有這些鍵盤操作上的說明。 要查閱這些說明,請將游標移到 Usage,然後選 [Select] ,這時你畫面應該會長像 ,接著請按 Enter 鍵。 接下來,會出現安裝的使用說明,閱讀完畢請按 Enter 以跳回主畫面。
選擇 Sysinstall 主畫面的『Usage(快速說明)』
選擇『 Documentation(說明文件)』選單 在主畫面用方向鍵選擇 Doc,然後按 Enter 鍵。
選擇『Documentation(說明文件)』選單
這時會出現說明文件的選單。
Sysinstall 的說明文件(Documentation)選單
閱讀這些說明文件很重要。 要閱讀文件的話,請用方向鍵選取要閱讀的文件然後按 Enter 鍵。讀完後,再按一次 Enter 鍵就會回到說明文件畫面了。 若要回到主畫面,用方向鍵選擇 Exit 然後按下 Enter 鍵即可。
選擇『鍵盤對應』選單 如果要改變鍵盤按鍵的對應模式,請在主選單選取 Keymap 然後按 Enter 鍵即可。 一般情況下是不用去改, 除非你用的鍵盤不是一般標準或非美式鍵盤。
Sysinstall 主選單
您可以使用上下鍵移動到您想使用的鍵盤對應方式,然後按下 Space 鍵以選取它;再按一下 Space 鍵可以取消選取。當您完成後,請選擇 &gui.ok; 然後按 Enter 鍵即可。 在這個畫面顯示的只是其中一小部分; 若只要用預設鍵盤對應方式就好的話,可以用 Tab 來選 &gui.cancel; 這樣就會返回主畫面。
Sysinstall 鍵盤對應選單
安裝選項的設定畫面 請選 Options 然後按 Enter 鍵。
Sysinstall 主選單
Sysinstall 選項設定
通常,使用者大多用預設值就可以了,而不用修改它們。 而 Release Name 的地方則依你所安裝的版本而有所不同。 而目前所選的的項目,會在畫面下方以藍底白字顯示說明。 注意:其中右邊最後的選項是 Use Defaults(使用預設值) ,您可以藉由此選項將所有的設定還原為預設值。 另外,可以按 F1 鍵來閱讀各選項的說明。 而按 Q 鍵則是可以回到主畫面。
開始進行標準安裝 Standard(標準)安裝適用於那些初探 &unix; 或 FreeBSD 的使用者。用方向鍵選擇 Standard 然後按 Enter 鍵即可開始進入標準安裝。
開始進行標準安裝
硬碟空間的分配 您的第一個任務就是要決定分配給 FreeBSD 用的磁碟空間、label, 以便 sysinstall 幫你做相關準備動作。 因此,你必須先對 FreeBSD 是如何確認磁碟的流程有個概念。 BIOS 磁碟機編號 在安裝、設定 FreeBSD 之前,有很重要的一點必須注意, 尤其當您有許多顆硬碟的時候。 DOS Microsoft Windows 在 PC 架構,當您跑像 &ms-dos; 或 µsoft.windows; 這種跟 BIOS 設定相關的作業系統, BIOS 那邊可以調整正常的磁碟機順序,然後這些作業系統會跟著 BIOS 做改變。 這讓使用者不一定非得要由所謂的 primary master 硬碟開機。 有人發現最簡單、便宜的備份系統方式,就是再去買一顆一模一樣的硬碟, 然後定期使用 GhostXCOPY 以將資料從第一顆硬碟複製到第二顆硬碟上面去。 所以,當第一顆硬碟掛了(可能是病毒或壞軌造成的), 就可以輕鬆透過調整 BIOS 中的開機順序, 而直接用第二顆硬碟開機。 這跟將機殼拆開,把第二顆硬碟跟第一顆對調(要調 jumper)有同樣的效果, 差別就是:不用拆機殼。 SCSI BIOS 此外,若裝有比較貴的 SCSI 卡系統,通常本身也有 BIOS 的功能來讓 SCSI 設備(最多可到 7 個)達到類似改變順序的功能。 習慣上述方式的使用者很可能會感到驚訝,因為在 FreeBSD 中並非如此, FreeBSD 不會參考 BIOS 設定值,而且也不能偵測 logical BIOS drive mapping 設定。 這會讓人感覺很疑惑,明明就是一樣的硬碟, 而且資料也完全從另一顆複製過來,結果卻沒辦法像以前那樣用。 使用 FreeBSD 的時候,請將 BIOS 中的硬碟開機順序調回原本正常的順序, 並且以後不要再改這設定。如果您需要切換硬碟順序的話,那請用硬體方式, 直接打開機殼,調 jumper 及排線即可。 一段小故事:Bill 及 Fred 的安裝歷險 比爾(Bill)打算幫佛列德(Fred)把舊的 Wintel 機器灌 FreeBSD。 他在一顆 SCSI 硬碟(ID 是 0)裝上 FreeBSD。 於是佛列德開始用他新的 FreeBSD 系統;但是過了幾天,他發現這顆 SCSI 老硬碟發生許多小問題。 之後,他就跟比爾說起這件事。 此事經過幾天後,比爾決定是該解決問題的時候了, 所以他從後面房間的硬碟 收藏區 內拿出一個一模一樣的硬碟,並且經過初步 surface 掃瞄測試後, 顯示這顆硬碟還可堪用,因此,比爾將它的 ID 調成 4, 然後安裝到佛列德的機器, 並且將資料從磁碟 0 複製到磁碟 4。 現在新硬碟裝好了,而且看起來好像一切正常; 所以,比爾認為現在應該可以開始用它了。 於是到 SCSI BIOS 中設定 SCSI ID 4 為開機碟, 用磁碟 4 重新開機後,FreeBSD 一切跑得很順利。 佛列德繼續用了幾天後,比爾跟佛列德決定要來玩點新的: 試著升級 FreeBSD 看看。 比爾將 ID 0 的硬碟移除(因為有問題)並且又從 收藏區 中拿了一顆一樣的硬碟來。 然後他用佛列德的開機磁片透過 FTP 方式將在這顆硬碟上裝了新版的 FreeBSD,安裝過程都很順利。 佛列德用了這新版本幾天後,覺得它很適合用在工程部門... 是時候將以前放在舊系統的工作資料複製過來了。 因此,佛列德將 ID 4 的 SCSI 硬碟 (裡面有放從舊系統中複製過來的最新資料)先 mount 起來, 結果竟然發現在 ID 4 的硬碟上,他以前的所有資料都不見了! 奇怪,資料到底是跑到哪裡去了呢? 原來,當初比爾將 ID 0 硬碟的資料複製到 ID 4 硬碟的時候, ID 4 就變成 新的複製品(new clone)。 而當他調 SCSI BIOS 設定 ID 4 為開機碟,想讓系統從 ID 4 開機, 這步驟其實只是他自己搞混了, 因為大部分的作業系統可以藉由調 BIOS 設定以改變開機順序, 但是 FreeBSD 卻會把開機順序還原成正常的模式, 因此,佛列德的 FreeBSD 還是從最初的那顆 ID 0 硬碟開機的。 事實上,所有的資料都還在故事最初的那顆硬碟上, 而不是在他想像中的 ID 4 硬碟。 我們很高興在發現這件事時,那些資料都還在, 我們把資料從最初的那顆 ID 0 硬碟取出來並交還給佛列德 (而且比爾也從此瞭解了 0 的重要....)。 雖然我們這邊的例子是用 SCSI 硬碟, 但是相同的觀念也可以套用在 IDE 硬碟上。 以 FDisk 來建立分割磁區(Slices) 在這時候您所做的變更都還不會真正寫入硬碟中。 如果你發現弄錯了,想要重來一遍的話, 可以用選單來離開 sysinstall, 或是按 U 鍵來 Undo(回復) 所有設定。 如果你弄亂了而且不知道怎麼離開,你可以直接將電腦電源關掉再重來。 sysinstall 主畫面選擇使用標準安裝後, 應該會看到下面的訊息: Message In the next menu, you will need to set up a DOS-style ("fdisk") partitioning scheme for your hard disk. If you simply wish to devote all disk space to FreeBSD (overwriting anything else that might be on the disk(s) selected) then use the (A)ll command to select the default partitioning scheme followed by a (Q)uit. If you wish to allocate only free space to FreeBSD, move to a partition marked "unused" and use the (C)reate command. [ OK ] [ Press enter or space ] 這時請依畫面說明,按 Enter 鍵。 然後會看到一個列表,上面會列出所有在偵測硬體時所找到的硬碟。 範例顯示的是有找到兩個 IDE 磁碟機的情形,這兩個磁碟機分別為: ad0ad2
選擇 FDisk 要分割的硬碟
你可能會好奇,為何 ad1 沒列在這裡。 為什麼會不見了呢? 試想,如果您有兩顆 IDE 硬碟,一個是 primary master,一個是 secondary master,這樣會發生什麼事呢? 如果 FreeBSD 依照找到的順序來為他們命名, 比如首先是 ad0 再來是 ad1 那麼就不會出現困擾。 但是,現在問題來了。如果您現在想在 primary slave 加裝第三顆硬碟, 那麼這顆硬碟的名稱就會是 ad1,之前原本的 ad1 就會變成 ad2。 這樣會造成什麼問題呢? 因為硬體設備的名稱(像是 ad1s1a)是用來尋找檔案系統的, 因此您可能會突然發現,有些檔案系統從此無法正常顯示, 必須修改 FreeBSD 設定(/etc/fstab)才可以正確顯示。 為了解決這個問題,在設定 kernel 時可以採用 IDE 硬碟所在的位置來命名,而非根據找到的順序。 使用這種方式的話, 在 secondary master 的 IDE 硬碟就永遠會是 ad2, 即使系統中並沒有 ad0ad1 也不受影響。 由於此為 FreeBSD kernel 預設設定,也就是為何上述畫面只顯示 ad0ad2 之故。 畫面上這台機器的兩顆硬碟是分別裝在 primary 以及 secondary 排線上的 master,這兩顆都沒有裝在 slave 上。 請選好想安裝 FreeBSD 的硬碟,然後按下 &gui.ok;。 接著就會開始 FDisk,然後會看到類似 的畫面。 FDisk 的顯示畫面分為三個部分。 第一部份是畫面最上方的前兩行,這裡會顯示目前所選的硬碟資訊, 包括它在 FreeBSD 的名稱、硬碟 geometry、硬碟總容量。 第二部分會顯示目前所選的硬碟上有哪些 slice 以及各 slice 的起末位置、 所佔容量、FreeBSD 名稱、描述說明、子類別(sub-type)。 例子中顯示出有 2 個小的並且尚未使用的 slice,這是受到 PC 的硬碟本身架構影響之故。 此外, 還有一個大的 FAT slice(通常是 &ms-dos; / &windows; 中的 C:),以及一個延伸磁碟分割區 (在 &ms-dos; / &windows; 內的其他磁碟代號)。 第三部分則顯示 FDisk 可用的指令。
(舉例)未編輯前的 Fdisk 分割區(Partition)
接下來要做的事,跟您要怎麼分割硬碟有關。 若要讓 FreeBSD 使用整顆硬碟(稍後的安裝會再要您確認以 sysinstall 來繼續安裝, 就會清除該硬碟內上的資料),那麼就可以按 A 鍵( Use Entire Disk),以刪除所有既存的 slice, 取而代之的是一個小的並標示為 unused(同樣的,這也是 PC 硬碟架構所造成)的 slice,以及一個大的 FreeBSD slice。 之後, 請用方向鍵把光棒移至該 FreeBSD slice,然後按 S 鍵以便將此 slice 標為開機 slice。 此時的畫面應該類似 。 請注意: 在 Flags 欄位的 A 值表示該 slice 屬於 active,也會由此 slice 來開機。 若要刪除現有 slice 以挪出空間給 FreeBSD 使用,可以把光棒移到要刪除的 slice 後按 D 鍵,然後再按 C 鍵, 此時會出現對話框,請輸入要新增的 slice 大小為何,輸入合適大小之後按 Enter 鍵即可。 該預設值為可分配空間的最大值, 可以是最大的或尚未分配的整顆硬碟大小。 若已建立完畢給 FreeBSD 的空間(透過類似 &partitionmagic; 之類的工具),那麼可以按 C 鍵以新增 slice。同樣也會有對話框出現,來問想要新增的 slice 大小為何。
Fdisk 採用整顆硬碟作分割區(Partition)
完畢後請按 Q 鍵。 這些更改會暫存給 sysinstall 使用,但還不會真正寫入到硬碟 。
安裝 Boot Manager 現在可以選擇是否要裝 boot manager。 一般而言, 遇到下列情況才會需要裝 boot manager: 有一個以上的硬碟,而 FreeBSD 並非裝在第一個硬碟上。 同一顆硬碟上除了有裝 FreeBSD 之外,還有裝其他作業系統, 所以需要在開機時選擇要進入哪個作業系統。 若只裝 FreeBSD,並且是裝在第一顆硬碟,那麼選 Standard 即可。 若已經有使用其他的 boot manager 可開機進入 FreeBSD 那麼請選 None 即可。 請依自身需求與情況做抉擇,然後按 Enter 鍵。
Sysinstall 的 Boot Manager 選單
F1 會有不同作業系統共存時, 有可能遇到的相關問題說明。
在其他硬碟上建立分割磁區(Slices) 若有一個以上的硬碟,那麼在選完 boot manager 之後會再回到選擇硬碟的畫面。 若要把 FreeBSD 裝在多個硬碟上, 那麼可以在此選擇其他硬碟,並重複使用 FDisk 來建立 slice 。 若第一顆硬碟不是裝 FreeBSD 的話,那麼每一顆就要都裝 FreeBSD boot manager 才可以。
離開『選擇硬碟』畫面
Tab 鍵可以在最後選擇的硬碟以及 &gui.ok;、 &gui.cancel; 之間進行切換。 先按一次 Tab 會先移到 &gui.ok;,然後再按 Enter 鍵以繼續安裝。
以 <application>Disklabel</application> 來建立分割區(Partitions) 現在必須在剛建立好的 slice 規劃一些分割區。 請注意: 每個分割區的代號是從 ah, 此外 bcd 通常是特殊用途,不該隨意變動。 有些程式可以透過特殊的分割方式而達到更好的效果, 尤其是分割區是分散在不同硬碟上的時候。 但是,現在是您第一次裝 FreeBSD, 所以請不要去煩惱該如何分割硬碟才好。 最重要的是,裝好 FreeBSD 然後學習如何善用之。 當對 FreeBSD 有一定程度的熟悉之後,可以隨時重裝 FreeBSD,並改變分割的方式。 下面例子有四個分割區 — 其中一個是 swap 空間,i 其他三個是檔案系統。 第一顆硬碟的分割區(Partition)配置 分割區 檔案系統 大小 介紹 a / 128 MB 此為根目錄檔案系統(root filesystem)。 其他的檔案系統都會掛載在根目錄之下。 128 MB 對於此檔案系統來說是相當合理的大小, 因為通常這裡並不會放太多資料,而在 FreeBSD 裝完後會用到約 40 MB 的根目錄空間。 剩下的空間是放臨時資料用的, 此外也應該要預留一些空間,因為日後的 FreeBSD 版本可能會需要更多的 /(根目錄) 空間 。 b N/A RAM 的 2~3 倍 系統的 swap 空間是放在 b 分割區。 如何選擇適合的 swap 空間大小可是一門學問。 一般來說, swap 空間應該是記憶體(RAM)大小的 2 或 3 倍。 此外,swap 至少需要 64 MB,因此若 RAM 小於 32 MB 的話,請把 swap 大小設為 64 MB。 若有一個以上的硬碟,則可以在每個硬碟都配置 swap 空間。 FreeBSD 會善用每個硬碟上的 swap 空間,如此一來便能有效提高 swap 的性能。 若您屬這類情況,請先算出總共需要的 swap 總大小 (比如:128 MB),然後除以全部的硬碟數量(比如:兩顆硬碟), 這樣算出來的結果就是每個硬碟上所需配置的 swap 大小, 在這個例子中,則每個硬碟所需之 swap 空間為 64 MB 。 e /var 256 MB /var 目錄會放的檔案有很多種,像是 log 檔案以及其他的系統管理檔案。 這些檔案大部分都是 FreeBSD 每日運作所會讀、寫。 把這些檔案另外放到專門的檔案系統(即 /var) 則可以最佳化這些檔案的存取, 而不致於影響其他目錄的存取。 f /usr 剩餘的硬碟空間 所有其他檔案通常會存在 /usr 及其子目錄內。
若要把 FreeBSD 裝在多個硬碟上,那麼必須在您所配置的其他 slice 上新增分割區。 最簡單的方式,就是在每個硬碟上建立分割區,一個給 swap 空間,另一個則是檔案系統。 其他硬碟的分割區(Partition)配置 分割區 檔案系統 大小 介紹 b N/A 請參閱右側的介紹 前面有提過,swap 空間是可以跨各硬碟。 即使沒有使用 a 分割區,但習慣上還是會把 swap 空間設為 b 分割區。 e /diskn 剩餘的硬碟空間 剩下的空間是一個大的分割區,最簡單的做法是將之規劃為 a 分割區,而不是 e 分割區。 然而,習慣上 a 分割區是保留給 根目錄(/)所使用的。 當然, 您不一定要遵循此習慣,但 sysinstall 本身會,所以照它既有的方式會讓你安裝更加清爽、潔淨。 你可以把這些檔案系統掛載在任何地方,本範例是建議把它們掛載於 /diskn 目錄, 其中的 n 的數字, 則依各硬碟的順序而有所變化。 但若您高興, 也可以把它們掛載於其他地方。
完成分割區配置之後,就可以用 sysinstall 來建立之。 您會看到如下訊息: Message Now, you need to create BSD partitions inside of the fdisk partition(s) just created. If you have a reasonable amount of disk space (200MB or more) and don't have any special requirements, simply use the (A)uto command to allocate space automatically. If you have more specific needs or just don't care for the layout chosen by (A)uto, press F1 for more information on manual layout. [ OK ] [ Press enter or space ] 請按 Enter 鍵以進入 FreeBSD 分割區編輯器,叫做 Disklabel 顯示第一次執行 Disklabel 的畫面, 這畫面可區分為三個區塊。 前幾行顯示的是正在編輯的硬碟,以及目前正在建立的 slice 位於哪個 分割區上。(在此處,Disklabel 是使用 Partition name(分割區名稱),而非 slice 名稱)。 此畫面也會顯示目前 slice 還有多少空間可供使用, 換句話說就是尚未指定分割區的多餘空間。 在畫面中間,則顯示已建立的分割區、每個分割區的檔案系統名稱、 所佔大小,以及一些參數。 在畫面下方,則顯示 Disklabel 可用的按鍵。
Sysinstall 的 Disklabel 編輯器
Disklabel 可自動分配分割區, 並賦予預設值大小,按 A 即可自動完成。 您會看到類似 的畫面。 不過, 由於所用的硬碟大小不一,所以自動分配所設定的大小不一定合用,不要緊, 您不一定得使用預設大小才可以。 預設會給 /tmp 目錄作為獨立分割區, 而非附屬於 / 之下。 如此一來, 可避免 / 會被一堆臨時檔案塞爆。
Sysinstall 的 Disklabel 編輯器 — 使用自動分配
- If you choose to not use the default partitions and wish to - replace them with your - own, use the arrow keys to select the first partition, and press - D to delete it. Repeat this to delete all the - suggested partitions. - - To create the first partition (a, mounted as - / — root), make sure the proper disk slice at the top of - the screen is selected and press C. A dialog box - will appear prompting you for the size of the new partition (as shown - in ). You can enter the size as - the number of disk blocks you want to use, or as a - number followed by either M for megabytes, - G for gigabytes, or C for - cylinders. - - Beginning with FreeBSD 5.X, users can: select - UFS2 (which is default on &os; 5.1 and - above) using the Custom Newfs - (Z) option, create labels with - Auto Defaults and modify them with the Custom Newfs option or - add during the regular creation period. - Do not forget to add for SoftUpdates if you use the Custom Newfs - option! + 如果您不想用自動分配分割區而希望自行設定, + 請用方向鍵選擇第一個分割區,並按下 D 刪除之。 + 重複此動作直到刪除所有分割區。 + + 建立第一個分割區(a,掛載為 + / — 根目錄), + 請在畫面最上方選擇正確的磁碟分割磁區(slice)並按下 + C。 接下來將出現對話框, + 會要求輸入新的分割區大小(如 所示) + 。 這邊可以直接輸入以 block 為單位, + 或者是以 M(MB)為單位、 + 或以 G(GB)為單位, + 或者以 C(磁柱,cylinders) 為單位。 + + 自 FreeBSD 5.X 起,則可使用 + Custom Newfs 選項來用 UFS2 + (從 &os; 5.1 起,此即為預設值)。 若是使用 + Auto Defaults 自動預設的情況下,則可以再用 + Custom Newfs 選項,或者在建立檔案系統時指定 + 參數亦可。 若用 Custom Newfs + 選項的話,則別忘了要加上 來啟用 SoftUpdates + 功能!
- Free Space for Root Partition + 根目錄的空間分配
- The default size shown will create a partition that takes up the - rest of the slice. If you are using the partition sizes described - in the earlier example, then delete the existing figure using - Backspace, and then type in - 128M, as shown in - . Then press - &gui.ok;. + 此處預設顯示的大小,會是整個 slice 的所有空間。 + 若要採用先前例子所介紹的劃分大小,則按 Backspace + 鍵來消除這些數字,並輸入例子中的 128M,如 + 所示。 + 接著按下 &gui.ok;。
- Edit Root Partition Size + 修改根目錄的空間分配
- Having chosen the partition's size you will then be asked whether - this partition will contain a filesystem or swap space. The dialog - box is shown in . This first - partition will contain a filesystem, so check that - FS is selected and press - Enter. + 在輸入之後會問所要建立的是檔案系統(file system)或者是 swap 空間, + 如 所示。 + 第一個選項為檔案系統,所以選擇 FS + 後按下Enter
- Choose the Root Partition Type + 選擇分割區的類型
- Finally, because you are creating a filesystem, you must tell - Disklabel where the filesystem is to be - mounted. The dialog box is shown in - . The root filesystem's mount - point is /, so type /, and - then press Enter. + 最後,因為要新增的是檔案系統,所以必須告訴 + Disklabel 要將其掛載至何處。 如 所示。 根目錄檔案系統 + 的掛載點為 /,所以請輸入 / + ,然後按下 Enter
- Choose the Root Mount Point + 選擇根目錄的掛載點
- The display will then update to show you the newly created - partition. You should repeat this procedure for the other - partitions. When you create the swap partition, you will not be - prompted for the filesystem mount point, as swap partitions are never - mounted. When you create the final partition, - /usr, you can leave the suggested size as is, to - use the rest of the slice. + 剛所建立的分割區會顯示在畫面上,可以用上述類似動作來建立其他分割區。 + 然而在建立 swap 分割區時,系統並不會問要掛載於哪邊,因為 swap + 空間是不必額外掛載的。 此外在建立最後分割區 /usr + 時,可以直接採用預設大小,也就是該 slice 剩餘的所有空間。 - Your final FreeBSD DiskLabel Editor screen will appear similar to - , although your values chosen may - be different. Press Q to finish. + 最後 FreeBSD 上的 DiskLabel 編輯器畫面會類似 ,實際數字則依安裝選擇而有所不同。 + 請按下 Q 即可完成分割區規劃。
- Sysinstall Disklabel Editor + Sysinstall Disklabel 編輯器
選擇想要安裝的 選擇要安裝的套件集(Distribution Set) - Deciding which distribution set to install will depend largely - on the intended use of the system and the amount of disk space - available. The predefined options range from installing the - smallest possible configuration to everything. Those who are - new to &unix; and/or FreeBSD should almost certainly select one - of these canned options. Customizing a distribution set is - typically for the more experienced user. - - Press F1 for more information on the - distribution set options and what they contain. When finished - reviewing the help, pressing Enter will return - to the Select Distributions Menu. - - If a graphical user interface is desired then a distribution - set that is preceded by an X should be - chosen. The configuration of the X server and selection of a default - desktop must be done after the installation of &os;. More - information regarding the configuration of a X server can be - found in . - - &xorg; is the default version of X11 - that is installed. - - If compiling a custom kernel is anticipated, select an option - which includes the source code. For more information on why a - custom kernel should be built or how to build a custom kernel, see - . - - Obviously, the most versatile system is one that includes - everything. If there is adequate disk space, select - All as shown in - by using the arrow keys and - press Enter. If there is a concern about disk - space consider using an option that is more suitable for the - situation. - Do not fret over the perfect choice, as other distributions can be - added after installation. + 要裝哪些套件,主要取決於該系統的用途為何及磁碟空間而定。 + 預置的套件,從最小安裝到完整安裝都有。 若是 &unix; 或 FreeBSD + 新手,通常直接選其中之一即可。 + 而自訂套件比較適合有經驗的人來用。 + + 若要瞭解各套件的選項細節資訊,請按 F1 鍵。 + 看完之後按 Enter 即會回到剛才的套件選擇畫面。 + + 若需要 GUI 介面,那必需加選 X + 開頭的相關套件。 至於 X server 的設定及要用哪一類的桌面管理,必須在 + &os; 裝好之後才能進行。 X server 設定細節部分請參閱 + + 預設安裝的 X11 版本為 &xorg; + + 若需要自訂 kernel,那麼需加選有含 source code 的選項。 + 至於為何需自訂 kernel 及相關細節,請參閱 + + + 很明顯地,全部都裝就不用困擾需要裝什麼了。 若硬碟夠大,請以方向鍵選 + 圖下的 All + 選項,並按下 Enter 即可。 + 若硬碟空間不夠,請依自身需求選擇安裝。 當然在安裝完畢後, + 還是可以依需求再加裝其他套件。
- 選擇套件(Distributions) + 選擇要裝的套件集(Distributions)
安裝 Ports Collection - After selecting the desired distribution, an opportunity to - install the FreeBSD Ports Collection is presented. The ports - collection is an easy and convenient way to install software. - The Ports Collection does not contain the source code necessary - to compile the software. Instead, it 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 to see if you have - adequate space. Select this option only if you have - adequate hard disk space. As of FreeBSD &rel.current;, the FreeBSD - Ports Collection takes up about &ports.size; of disk space. - You can safely assume a larger value for more recent versions - of FreeBSD. + 在裝完套件集之後,接著會問是否要裝 FreeBSD Ports 套件。 Ports + 套件可以讓您輕鬆安裝各種常見的軟體,它本身並不含那些軟體的原始碼, + 而是一個包含如何自動下載、編譯、安裝 third-party 軟體的檔案集合。 + 會介紹如何使用 ports。 + + 安裝程式並不會檢查是否有足夠空間來放 ports tree, + 所以請先確認有足夠空間。 目前 FreeBSD &rel.current; 的 FreeBSD + Ports Collection 大約需要 &ports.size; 的空間。 因此, + 可以推估更新版的 FreeBSD 會需要更多的空間來裝。 User Confirmation Requested Would you like to install the FreeBSD ports collection? This will give you ready access to over &os.numports; ported software packages, at a cost of around &ports.size; of disk space when "clean" and possibly much more than that if a lot of the distribution tarballs are loaded (unless you have the extra CDs from a FreeBSD CD/DVD distribution available and can mount it on /cdrom, in which case this is far less of a problem). The Ports Collection is a very valuable resource and well worth having on your /usr partition, so it is advisable to say Yes to this option. For more information on the Ports Collection & the latest ports, visit: http://www.FreeBSD.org/ports [ Yes ] No - Select &gui.yes; with the arrow keys to - install the Ports Collection or &gui.no; to - skip this option. Press Enter to continue. - The Choose Distributions menu will redisplay. + 用方向鍵選 &gui.yes; 就會裝 Ports Collection,否則就選 + &gui.no; 以略過。 選好後按 Enter 繼續, + 然後會再次回到選擇套件集的畫面。
- Confirm Distributions + 確認要安裝的套件集
- If satisfied with the options, select - Exit with the arrow keys, ensure that - &gui.ok; is highlighted, and pressing - Enter to continue. + 若要勾選的項目都確認沒問題的話,就以方向鍵選 + Exit 退出並確認 &gui.ok; 有選到,然後按I + Enter 繼續。
選擇安裝來源 - 若要從 CDROM 或 DVD 安裝,用方向鍵將游標移到 Install from a FreeBSD CD/DVD,並確定 + 若要從 CDROM 或 DVD 安裝,用方向鍵將游標移到 + Install from a FreeBSD CD/DVD,並確定 選 &gui.ok; 後按下 Enter 就會開始裝了。 - 若是要用其他的方式安裝的話,請選擇適當的安裝來源,然後遵照螢幕指示進行安裝即可。 + 若是要用其他的方式安裝的話,請選擇適當的安裝來源, + 然後遵照螢幕指示進行安裝即可。 - F1 可以顯示針對此部分(安裝來源)的線上說明。按一下 Enter - 就會回到『選擇安裝來源』的畫面了。 + F1 可以顯示針對此部分(安裝來源)的線上說明。 + 按一下 Enter 就會回到『選擇安裝來源』的畫面了。
選擇安裝來源
FTP 安裝模式 installation network FTP - 使用 FTP 安裝的話,有分三種模式︰主動式(active)FTP、被動式(passive)FTP 或是透過 HTTP proxy server。 + 使用 FTP 安裝的話,有分三種模式︰主動式(active)FTP、 + 被動式(passive)FTP 或是透過 HTTP proxy server。 - FTP Active: Install from an FTP - server + 主動式 FTP:從 FTP server 安裝 - This option will make all FTP transfers - use Active - mode. This will not work through firewalls, but will - often work with older FTP servers that do not support - passive mode. If your connection hangs with passive - mode (the default), try active! + 該選項會透過 Active 模式作 FTP 傳輸動作。 + 這會無法穿過防火牆,但可用在那些較古早、不支援被動模式的 FTP + 站。 若 FTP 連線會卡住(預設為被動模式), + 那請改換主動模式看看! - FTP Passive: Install from an FTP server through a - firewall + 被動式 FTP:透過防火牆,從 FTP server + 安裝 FTP passive mode - This option instructs sysinstall to use - Passive mode for all FTP operations. - This allows the user to pass through firewalls - that do not allow incoming connections on random TCP ports. - + 該選項會讓 sysinstall 全程使用 + Passive(被動式) 來進行 FTP 連線, + 就可以穿過只允許使用固定 TCP port 連入的防火牆。 - FTP via a HTTP proxy: Install from an FTP server - through a http proxy + 透過 HTTP proxy 的 FTP:透過 http proxy 來從 FTP + 站安裝 FTP via a HTTP proxy - This option instructs sysinstall to use the HTTP - protocol (like a web browser) to connect to a proxy - for all FTP operations. The proxy will translate - the requests and send them to the FTP server. - This allows the user to pass through firewalls - that do not allow FTP at all, but offer a HTTP - proxy. - In this case, you have to specify the proxy in - addition to the FTP server. + 該選項會讓 sysinstall 的 FTP 連線, + 先透過 HTTP 協定(就像網頁瀏覽器一樣)連到 proxy server,而 proxy + server 會解譯送過來的的請求,然後轉送給 FTP server。 + 這可以穿透只允許 HTTP 連線但不允許 FTP 連線的防火牆。 + 但記得要用之時,必須指定 proxy server 的位址。 - For a proxy FTP server, you should usually give the name of the - server you really want as a part of the username, after an - @ sign. The proxy server then fakes - the real server. For example, assuming you want to install from - ftp.FreeBSD.org, using the proxy FTP - server foo.example.com, listening on port - 1234. + 對 proxy FTP server 而言,通常要在登入用的帳號名稱後面, + 加上 @ 符號再加上要登入的 server 名稱。 然後, + proxy server 就會 fakes(偽裝) 為真的 server 樣子。 + 舉個例子,若要到 ftp.FreeBSD.org 來裝, + 但中間透過 proxy FTP server 也就是 + foo.example.com 並且使用 port 1234。 - In this case, you go to the options menu, set the FTP username - to ftp@ftp.FreeBSD.org, and the password to your - email address. As your installation media, you specify FTP (or - passive FTP, if the proxy supports it), and the URL - ftp://foo.example.com:1234/pub/FreeBSD. - - Since /pub/FreeBSD from - ftp.FreeBSD.org is proxied under - foo.example.com, you are able to install - from that machine (which will fetch the files - from ftp.FreeBSD.org as your - installation requests them). + 在此情況下,可以到 options 選單,將 FTP username 設為 + ftp@ftp.FreeBSD.org,密碼則設為自己的 email 信箱。 + 安裝來源部分,則使用 FTP (或 proxy 有支援的話,就用 passive FTP), + 而 URL 則用 + ftp://foo.example.com:1234/pub/FreeBSD + + 因為 ftp.FreeBSD.org 的 + /pub/FreeBSD 會被 porxy 到 + foo.example.com,所以就可以從 + foo.example.com 這台 + 機器(這台會從 ftp.FreeBSD.org 抓檔回來給您) + 安裝。
開始進行安裝 - 到此為止,可以開始進行安裝了,這也是您避免更動到硬碟的最後機會。 + 到此為止,可以開始進行安裝了, + 這也是您避免更動到硬碟的最後機會。 User Confirmation Requested Last Chance! Are you SURE you want to continue the installation? If you're running this on a disk with data you wish to save then WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before proceeding! We can take no responsibility for lost disk contents! [ Yes ] No 選擇 &gui.yes; 並按下 Enter以確認真的要開始安裝 安裝所需時間會依據所選擇安裝的套件集(distribution) 、安裝來源以及電腦速度而有所不同。 在安裝的過程中,會有一些訊息顯示目前的安裝進度。 當您看到下面的訊息表示已經安裝完成了︰ Message Congratulations! You now have FreeBSD installed on your system. We will now move on to the final configuration questions. For any option you do not wish to configure, simply select No. If you wish to re-enter this utility after the system is up, you may do so by typing: /usr/sbin/sysinstall. [ OK ] [ Press enter or space ] 請按 Enter 鍵來進行相關的後續設定。 如果剛選的是 &gui.no; 並按下 Enter 鍵,那麼會中斷安裝(就不會動到你的原有系統)。 接著,會出現以下訊息: Message Installation complete with some errors. You may wish to scroll through the debugging messages on VTY1 with the scroll-lock feature. You can also choose "No" at the next prompt and go back into the installation menus to retry whichever operations have failed. [ OK ] 這段訊息乃是因為都沒裝任何東西之故,請按 Enter 以跳回主畫面。 後續安裝 安裝系統成功之後,可以在新裝好的 FreeBSD 重開機之前,或者是事後再透過 sysinstall (&os; 5.2 之前版本則是 /stand/sysinstall) 然後選擇 Configure 選項以進行後續設定。 設定網路 如果您之前有設定用 PPP 連線透過 FTP 安裝,那麼這個畫面將不會出現; 正如上面剛所說的,您可以稍後再做更改。 有關 LAN 或把 FreeBSD 設定為 gateway 或 router 請參閱使用手冊中有關 網路進階運用 的章節。 User Confirmation Requested Would you like to configure any Ethernet or SLIP/PPP network devices? [ Yes ] No 如果要設定網路卡,請選擇 &gui.yes; 然後按 Enter。 否則請選 &gui.no; 以繼續。
選擇網路卡
用方向鍵選擇您要設定的網路卡,然後按 Enter User Confirmation Requested Do you want to try IPv6 configuration of the interface? Yes [ No ] - In this private local area network, the current Internet - type protocol (IPv4) was sufficient and &gui.no; - was selected with the arrow keys and Enter - pressed. + 在私人區域網路的情況,由於目前的 Internet 協定 + (IPv4)還算夠用, + 所以請選 &gui.no; 不設定 IPv6,然後按 + Enter - If you are connected to an existing IPv6 network - with an RA server, then choose - &gui.yes; and press Enter. - It will take several seconds to scan for RA servers. + 若是透過 RA server 連到既有的 + IPv6 環境,那麼就選 &gui.yes; 並按 + Enter,之後系統會花幾秒鐘去搜尋 RA server。 User Confirmation Requested Do you want to try DHCP configuration of the interface? Yes [ No ] - If DHCP (Dynamic Host Configuration Protocol) is not required - select &gui.no; with the arrow keys and press - Enter. + 接下來,若不需要 DHCP (Dynamic Host Configuration Protocol)請選 + &gui.no; 並按Enter - Selecting &gui.yes; will execute - dhclient, and if successful, will fill - in the network configuration information automatically. Refer to - for more information. + 選擇 &gui.yes; 的話,則會執行 + dhclient,若成功要到 IP, + 則其會自動填上相關的環境設定,細節請參閱 - The following Network Configuration screen shows the - configuration of the Ethernet device for a system that will act - as the gateway for a Local Area Network. + 下面的網路設定圖顯示如何在區域網路(LAN)中, + 將該機器設定為 gateway 的方式:
- Set Network Configuration for ed0 + 設定 ed0 這張網路卡的網路設定
- Use Tab to select the information fields and - fill in appropriate information: + 可用 Tab 鍵在各欄位間作切換, + 並填上適合的資料: - Host + Host(機器名稱) - The fully-qualified hostname, such as k6-2.example.com in - this case. + 完整的機器名稱,例如本例中的 + k6-2.example.com - Domain + Domain(網域) - The name of the domain that your machine is - in, such as example.com for this case. + 機器所屬的網域名稱,例如本例中的 + example.com IPv4 Gateway - IP address of host forwarding packets to non-local - destinations. You must fill this in if the machine is a node - on the network. Leave this field blank - if the machine is the gateway to the Internet for the - network. The IPv4 Gateway is also known as the default - gateway or default route. + 這裡請輸入 Gateway 的 IP 位址,其可負責將封包轉遞到遠端網路。 + 只有在該 gateway 屬於該網路其中節點之一時,才要輸入。 + 若這機器本身要做為該區域網路的 gateway 的話, + 請保持本欄為空白。 此外, + 通常 IPv4 Gateway 也會被認為是 default gateway 或 + default route。 - Name server + Name server(Name server 或 DNS server) - IP address of your local DNS server. There is no local - DNS server on this private local area network so the IP - address of the provider's DNS server - (208.163.10.2) was used. + 該網路所用的 DNS server 之 IP。 本例假設該機器所在的網路沒有 + DNS,故填上的是該 ISP 所提供的 DNS server + (208.163.10.2)。 IPv4 address The IP address to be used for this interface was 192.168.0.1 Netmask The address block being used for this local area network is a Class C block (192.168.0.0 - 192.168.0.255). The default netmask is for a Class C network (255.255.255.0). Extra options to ifconfig Any interface-specific options to ifconfig you would like to add. There were none in this case. Use Tab to select &gui.ok; when finished and press Enter. User Confirmation Requested Would you like to Bring Up the ed0 interface right now? [ Yes ] No Choosing &gui.yes; and pressing Enter will bring the machine up on the network and be ready for use. However, this does not accomplish much during installation, since the machine still needs to be rebooted.
Configure Gateway User Confirmation Requested Do you want this machine to function as a network gateway? [ Yes ] No If the machine will be acting as the gateway for a local area network and forwarding packets between other machines then select &gui.yes; and press Enter. If the machine is a node on a network then select &gui.no; and press Enter to continue. Configure Internet Services User Confirmation Requested Do you want to configure inetd and the network services that it provides? Yes [ No ] If &gui.no; is selected, various services such telnetd will not be enabled. This means that remote users will not be able to telnet into this machine. Local users will still be able to access remote machines with telnet. These services can be enabled after installation by editing /etc/inetd.conf with your favorite text editor. See for more information. Select &gui.yes; if you wish to configure these services during install. An additional confirmation will display: User Confirmation Requested The Internet Super Server (inetd) allows a number of simple Internet services to be enabled, including finger, ftp and telnetd. Enabling these services may increase risk of security problems by increasing the exposure of your system. With this in mind, do you wish to enable inetd? [ Yes ] No Select &gui.yes; to continue. User Confirmation Requested inetd(8) relies on its configuration file, /etc/inetd.conf, to determine which of its Internet services will be available. The default FreeBSD inetd.conf(5) leaves all services disabled by default, so they must be specifically enabled in the configuration file before they will function, even once inetd(8) is enabled. Note that services for IPv6 must be separately enabled from IPv4 services. Select [Yes] now to invoke an editor on /etc/inetd.conf, or [No] to use the current settings. [ Yes ] No Selecting &gui.yes; will allow adding services by deleting the # at the beginning of a line.
Editing <filename>inetd.conf</filename>
After adding the desired services, pressing Esc will display a menu which will allow exiting and saving the changes.
啟用 SSH 登入 SSH sshd User Confirmation Requested Would you like to enable SSH login? Yes [ No ] 選擇 &gui.yes; 就會啟用 &man.sshd.8;,也就是 OpenSSH 的 daemon 程式。 這會允許該機器可從遠端安全登入。 關於 OpenSSH 請參閱 部分的說明。 Anonymous FTP FTP anonymous User Confirmation Requested Do you want to have anonymous FTP access to this machine? Yes [ No ] Deny Anonymous FTP Selecting the default &gui.no; and pressing Enter will still allow users who have accounts with passwords to use FTP to access the machine. Allow Anonymous FTP Anyone can access your machine if you elect to allow anonymous FTP connections. The security implications should be considered before enabling this option. For more information about security see . To allow anonymous FTP, use the arrow keys to select &gui.yes; and press Enter. The following screen (or similar) will display:
Default Anonymous FTP Configuration
Pressing F1 will display the help: This screen allows you to configure the anonymous FTP user. The following configuration values are editable: UID: The user ID you wish to assign to the anonymous FTP user. All files uploaded will be owned by this ID. Group: Which group you wish the anonymous FTP user to be in. Comment: String describing this user in /etc/passwd FTP Root Directory: Where files available for anonymous FTP will be kept. Upload subdirectory: Where files uploaded by anonymous FTP users will go. The ftp root directory will be put in /var by default. If you do not have enough room there for the anticipated FTP needs, the /usr directory could be used by setting the FTP Root Directory to /usr/ftp. When you are satisfied with the values, press Enter to continue. User Confirmation Requested Create a welcome message file for anonymous FTP users? [ Yes ] No If you select &gui.yes; and press Enter, an editor will automatically start allowing you to edit the message.
Edit the FTP Welcome Message
This is a text editor called ee. Use the instructions to change the message or change the message later using a text editor of your choice. Note the file name/location at the bottom of the editor screen. Press Esc and a pop-up menu will default to a) leave editor. Press Enter to exit and continue. Press Enter again to save changes if you made any.
Configure Network File System Network File System (NFS) allows sharing of files across a network. A machine can be configured as a server, a client, or both. Refer to for a more information. NFS Server User Confirmation Requested Do you want to configure this machine as an NFS server? Yes [ No ] If there is no need for a Network File System server, select &gui.no; and press Enter. If &gui.yes; is chosen, a message will pop-up indicating that the exports file must be created. Message Operating as an NFS server means that you must first configure an /etc/exports file to indicate which hosts are allowed certain kinds of access to your local filesystems. Press [Enter] now to invoke an editor on /etc/exports [ OK ] Press Enter to continue. A text editor will start allowing the exports file to be created and edited.
Editing <filename>exports</filename>
Use the instructions to add the actual exported filesystems now or later using a text editor of your choice. Note the file name/location at the bottom of the editor screen. Press Esc and a pop-up menu will default to a) leave editor. Press Enter to exit and continue.
NFS Client The NFS client allows your machine to access NFS servers. User Confirmation Requested Do you want to configure this machine as an NFS client? Yes [ No ] With the arrow keys, select &gui.yes; or &gui.no; as appropriate and press Enter.
System Console Settings There are several options available to customize the system console. User Confirmation Requested Would you like to customize your system console settings? [ Yes ] No To view and configure the options, select &gui.yes; and press Enter.
System Console Configuration Options
A commonly used option is the screen saver. Use the arrow keys to select Saver and then press Enter.
Screen Saver Options
Select the desired screen saver using the arrow keys and then press Enter. The System Console Configuration menu will redisplay. The default time interval is 300 seconds. To change the time interval, select Saver again. At the Screen Saver Options menu, select Timeout using the arrow keys and press Enter. A pop-up menu will appear:
Screen Saver Timeout
The value can be changed, then select &gui.ok; and press Enter to return to the System Console Configuration menu.
System Console Configuration Exit
Selecting Exit and pressing Enter will continue with the post-installation configurations.
Setting the Time Zone Setting the time zone for your machine will allow it to automatically correct for any regional time changes and perform other time zone related functions properly. The example shown is for a machine located in the Eastern time zone of the United States. Your selections will vary according to your geographical location. User Confirmation Requested Would you like to set this machine's time zone now? [ Yes ] No Select &gui.yes; and press Enter to set the time zone. User Confirmation Requested Is this machine's CMOS clock set to UTC? If it is set to local time or you don't know, please choose NO here! Yes [ No ] Select &gui.yes; or &gui.no; according to how the machine's clock is configured and press Enter.
Select Your Region
The appropriate region is selected using the arrow keys and then pressing Enter.
Select Your Country
Select the appropriate country using the arrow keys and press Enter.
Select Your Time Zone
The appropriate time zone is selected using the arrow keys and pressing Enter. Confirmation Does the abbreviation 'EDT' look reasonable? [ Yes ] No Confirm the abbreviation for the time zone is correct. If it looks okay, press Enter to continue with the post-installation configuration.
Linux Compatibility User Confirmation Requested Would you like to enable Linux binary compatibility? [ Yes ] No Selecting &gui.yes; and pressing Enter will allow running Linux software on FreeBSD. The install will add the appropriate packages for Linux compatibility. If installing by FTP, the machine will need to be connected to the Internet. Sometimes a remote ftp site will not have all the distributions like the Linux binary compatibility. This can be installed later if necessary. Mouse Settings This option will allow you to cut and paste text in the console and user programs with a 3-button mouse. If using a 2-button mouse, refer to manual page, &man.moused.8;, after installation for details on emulating the 3-button style. This example depicts a non-USB mouse configuration (such as a PS/2 or COM port mouse): User Confirmation Requested Does this system have a PS/2, serial, or bus mouse? [ Yes ] No Select &gui.yes; for a PS/2, serial, or bus mouse, or &gui.no; for a USB mouse and press Enter.
Select Mouse Protocol Type
Use the arrow keys to select Type and press Enter.
Set Mouse Protocol
The mouse used in this example is a PS/2 type, so the default Auto was appropriate. To change protocol, use the arrow keys to select another option. Ensure that &gui.ok; is highlighted and press Enter to exit this menu.
Configure Mouse Port
Use the arrow keys to select Port and press Enter.
Setting the Mouse Port
This system had a PS/2 mouse, so the default PS/2 was appropriate. To change the port, use the arrow keys and then press Enter.
Enable the Mouse Daemon
Last, use the arrow keys to select Enable, and press Enter to enable and test the mouse daemon.
Test the Mouse Daemon
Move the mouse around the screen and verify the cursor shown responds properly. If it does, select &gui.yes; and press Enter. If not, the mouse has not been configured correctly — select &gui.no; and try using different configuration options. Select Exit with the arrow keys and press Enter to return to continue with the post-installation configuration.
Install Packages Packages are pre-compiled binaries and are a convenient way to install software. Installation of one package is shown for purposes of illustration. Additional packages can also be added at this time if desired. After installation sysinstall can be used to add additional packages. User Confirmation Requested The FreeBSD package collection is a collection of hundreds of ready-to-run applications, from text editors to games to WEB servers and more. Would you like to browse the collection now? [ Yes ] No Selecting &gui.yes; and pressing Enter will be followed by the Package Selection screens:
Select Package Category
Only packages on the current installation media are available for installation at any given time. All packages available will be displayed if All is selected or you can select a particular category. Highlight your selection with the arrow keys and press Enter. A menu will display showing all the packages available for the selection made:
Select Packages
The bash shell is shown selected. Select as many as desired by highlighting the package and pressing the Space key. A short description of each package will appear in the lower left corner of the screen. Pressing the Tab key will toggle between the last selected package, &gui.ok;, and &gui.cancel;. When you have finished marking the packages for installation, press Tab once to toggle to the &gui.ok; and press Enter to return to the Package Selection menu. The left and right arrow keys will also toggle between &gui.ok; and &gui.cancel;. This method can also be used to select &gui.ok; and press Enter to return to the Package Selection menu.
Install Packages
Use the Tab and arrow keys to select [ Install ] and press Enter. You will then need to confirm that you want to install the packages:
Confirm Package Installation
Selecting &gui.ok; and pressing Enter will start the package installation. Installing messages will appear until completed. Make note if there are any error messages. The final configuration continues after packages are installed. If you end up not selecting any packages, and wish to return to the final configuration, select Install anyways.
Add Users/Groups You should add at least one user during the installation so that you can use the system without being logged in as root. The root partition is generally small and running applications as root can quickly fill it. A bigger danger is noted below: User Confirmation Requested Would you like to add any initial user accounts to the system? Adding at least one account for yourself at this stage is suggested since working as the "root" user is dangerous (it is easy to do things which adversely affect the entire system). [ Yes ] No Select &gui.yes; and press Enter to continue with adding a user.
Select User
Select User with the arrow keys and press Enter.
Add User Information
The following descriptions will appear in the lower part of the screen as the items are selected with Tab to assist with entering the required information: Login ID The login name of the new user (mandatory). UID The numerical ID for this user (leave blank for automatic choice). Group The login group name for this user (leave blank for automatic choice). Password The password for this user (enter this field with care!). Full name The user's full name (comment). Member groups The groups this user belongs to (i.e. gets access rights for). Home directory The user's home directory (leave blank for default). Login shell The user's login shell (leave blank for default, e.g. /bin/sh). The login shell was changed from /bin/sh to /usr/local/bin/bash to use the bash shell that was previously installed as a package. Do not try to use a shell that does not exist or you will not be able to login. The most common shell used in the BSD-world is the C shell, which can be indicated as /bin/tcsh. The user was also added to the wheel group to be able to become a superuser with root privileges. When you are satisfied, press &gui.ok; and the User and Group Management menu will redisplay:
Exit User and Group Management
Groups can also be added at this time if specific needs are known. Otherwise, this may be accessed through using sysinstall (/stand/sysinstall in &os; versions older than 5.2) after installation is completed. When you are finished adding users, select Exit with the arrow keys and press Enter to continue the installation.
Set the <username>root</username> Password Message Now you must set the system manager's password. This is the password you'll use to log in as "root". [ OK ] [ Press enter or space ] Press Enter to set the root password. The password will need to be typed in twice correctly. Needless to say, make sure you have a way of finding the password if you forget. Notice that the password you type in is not echoed, nor are asterisks displayed. New password : Retype new password : The installation will continue after the password is successfully entered. Exiting Install If you need to configure additional network devices or any other configuration, you can do it at this point or after installation with sysinstall (/stand/sysinstall in &os; versions older than 5.2). User Confirmation Requested Visit the general configuration menu for a chance to set any last options? Yes [ No ] Select &gui.no; with the arrow keys and press Enter to return to the Main Installation Menu.
Exit Install
Select [X Exit Install] with the arrow keys and press Enter. You will be asked to confirm exiting the installation: User Confirmation Requested Are you sure you wish to exit? The system will reboot (be sure to remove any floppies/CDs/DVDs from the drives). [ Yes ] No Select &gui.yes; and remove the floppy if booting from the floppy. The CDROM drive is locked until the machine starts to reboot. The CDROM drive is then unlocked and the disk can be removed from drive (quickly). The system will reboot so watch for any error messages that may appear, see details.
Tom Rhodes Contributed by Configure Additional Network Services Configuring network services can be a daunting task for new users if they lack previous knowledge in this area. Networking, including the Internet, is critical to all modern operating systems including &os;; as a result, it is very useful to have some understanding &os;'s extensive networking capabilities. Doing this during the installation will ensure users have some understanding of the various services available to them. Network services are programs that accept input from anywhere on the network. Every effort is made to make sure these programs will not do anything harmful. Unfortunately, programmers are not perfect and through time there have been cases where bugs in network services have been exploited by attackers to do bad things. It is important that you only enable the network services you know that you need. If in doubt it is best if you do not enable a network service until you find out that you do need it. You can always enable it later by re-running sysinstall or by using the features provided by the /etc/rc.conf file. Selecting the Networking option will display a menu similar to the one below:
Network Configuration Upper-level
The first option, Interfaces, was previously covered during the , thus this option can safely be ignored. Selecting the AMD option adds support for the BSD automatic mount utility. This is usually used in conjunction with the NFS protocol (see below) for automatically mounting remote file systems. No special configuration is required here. Next in line is the AMD Flags option. When selected, a menu will pop up for you to enter specific AMD flags. The menu already contains a set of default options: -a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map The option sets the default mount location which is specified here as /.amd_mnt. The option specifies the default log file; however, when syslogd is used all log activity will be sent to the system log daemon. The /host directory is used to mount an exported file system from a remote host, while /net directory is used to mount an exported file system from an IP address. The /etc/amd.map file defines the default options for AMD exports. FTP anonymous The Anon FTP option permits anonymous FTP connections. Select this option to make this machine an anonymous FTP server. Be aware of the security risks involved with this option. Another menu will be displayed to explain the security risks and configuration in depth. The Gateway configuration menu will set the machine up to be a gateway as explained previously. This can be used to unset the Gateway option if you accidentally selected it during the installation process. The Inetd option can be used to configure or completely disable the &man.inetd.8; daemon as discussed above. The Mail option is used to configure the system's default MTA or Mail Transfer Agent. Selecting this option will bring up the following menu:
Select a default MTA
Here you are offered a choice as to which MTA to install and set as the default. An MTA is nothing more than a mail server which delivers email to users on the system or the Internet. Selecting Sendmail will install the popular sendmail server which is the &os; default. The Sendmail local option will set sendmail to be the default MTA, but disable its ability to receive incoming email from the Internet. The other options here, Postfix and Exim act similar to Sendmail. They both deliver email; however, some users prefer these alternatives to the sendmail MTA. After selecting an MTA, or choosing not to select an MTA, the network configuration menu will appear with the next option being NFS client. The NFS client option will configure the system to communicate with a server via NFS. An NFS server makes file systems available to other machines on the network via the NFS protocol. If this is a stand-alone machine, this option can remain unselected. The system may require more configuration later; see for more information about client and server configuration. Below that option is the NFS server option, permitting you to set the system up as an NFS server. This adds the required information to start up the RPC remote procedure call services. RPC is used to coordinate connections between hosts and programs. Next in line is the Ntpdate option, which deals with time synchronization. When selected, a menu like the one below shows up:
Ntpdate Configuration
From this menu, select the server which is the closest to your location. Selecting a close one will make the time synchronization more accurate as a server further from your location may have more connection latency. The next option is the PCNFSD selection. This option will install the net/pcnfsd package from the Ports Collection. This is a useful utility which provides NFS authentication services for systems which are unable to provide their own, such as Microsoft's &ms-dos; operating system. Now you must scroll down a bit to see the other options:
Network Configuration Lower-level
The &man.rpcbind.8;, &man.rpc.statd.8;, and &man.rpc.lockd.8; utilities are all used for Remote Procedure Calls (RPC). The rpcbind utility manages communication between NFS servers and clients, and is required for NFS servers to operate correctly. The rpc.statd daemon interacts with the rpc.statd daemon on other hosts to provide status monitoring. The reported status is usually held in the /var/db/statd.status file. The next option listed here is the rpc.lockd option, which, when selected, will provide file locking services. This is usually used with rpc.statd to monitor what hosts are requesting locks and how frequently they request them. While these last two options are marvelous for debugging, they are not required for NFS servers and clients to operate correctly. As you progress down the list the next item here is Routed, which is the routing daemon. The &man.routed.8; utility manages network routing tables, discovers multicast routers, and supplies a copy of the routing tables to any physically connected host on the network upon request. This is mainly used for machines which act as a gateway for the local network. When selected, a menu will be presented requesting the default location of the utility. The default location is already defined for you and can be selected with the Enter key. You will then be presented with yet another menu, this time asking for the flags you wish to pass on to routed. The default is and it should already appear on the screen. Next in line is the Rwhod option which, when selected, will start the &man.rwhod.8; daemon during system initialization. The rwhod utility broadcasts system messages across the network periodically, or collects them when in consumer mode. More information can be found in the &man.ruptime.1; and &man.rwho.1; manual pages. The next to the last option in the list is for the &man.sshd.8; daemon. This is the secure shell server for OpenSSH and it is highly recommended over the standard telnet and FTP servers. The sshd server is used to create a secure connection from one host to another by using encrypted connections. Finally there is the TCP Extensions option. This enables the TCP Extensions defined in RFC 1323 and RFC 1644. While on many hosts this can speed up connections, it can also cause some connections to be dropped. It is not recommended for servers, but may be beneficial for stand alone machines. Now that you have configured the network services, you can scroll up to the very top item which is X Exit and continue on to the next configuration item or simply exit sysinstall in selecting X Exit twice then [X Exit Install].
&os; 開機流程 &os;/&arch.i386; 的開機流程 If everything went well, you will see messages scroll off the screen and you will arrive at a login prompt. You can view the content of the messages by pressing Scroll-Lock and using PgUp and PgDn. Pressing Scroll-Lock again will return to the prompt. The entire message may not display (buffer limitation) but it can be viewed from the command line after logging in by typing dmesg at the prompt. Login using the username/password you set during installation (rpratt, in this example). Avoid logging in as root except when necessary. Typical boot messages (version information omitted): Copyright (c) 1992-2002 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. Timecounter "i8254" frequency 1193182 Hz CPU: AMD-K6(tm) 3D processor (300.68-MHz 586-class CPU) Origin = "AuthenticAMD" Id = 0x580 Stepping = 0 Features=0x8001bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,MMX> AMD Features=0x80000800<SYSCALL,3DNow!> real memory = 268435456 (262144K bytes) config> di sn0 config> di lnc0 config> di le0 config> di ie0 config> di fe0 config> di cs0 config> di bt0 config> di aic0 config> di aha0 config> di adv0 config> q avail memory = 256311296 (250304K bytes) Preloaded elf kernel "kernel" at 0xc0491000. Preloaded userconfig_script "/boot/kernel.conf" at 0xc049109c. md0: Malloc disk Using $PIR table, 4 entries at 0xc00fde60 npx0: <math processor> on motherboard npx0: INT 16 interface pcib0: <Host to PCI bridge> on motherboard pci0: <PCI bus> on pcib0 pcib1: <VIA 82C598MVP (Apollo MVP3) PCI-PCI (AGP) bridge> at device 1.0 on pci0 pci1: <PCI bus> on pcib1 pci1: <Matrox MGA G200 AGP graphics accelerator> at 0.0 irq 11 isab0: <VIA 82C586 PCI-ISA bridge> at device 7.0 on pci0 isa0: <ISA bus> on isab0 atapci0: <VIA 82C586 ATA33 controller> port 0xe000-0xe00f at device 7.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 uhci0: <VIA 83C572 USB controller> port 0xe400-0xe41f irq 10 at device 7.2 on pci0 usb0: <VIA 83C572 USB controller> on uhci0 usb0: USB revision 1.0 uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered chip1: <VIA 82C586B ACPI interface> at device 7.3 on pci0 ed0: <NE2000 PCI Ethernet (RealTek 8029)> port 0xe800-0xe81f irq 9 at device 10.0 on pci0 ed0: address 52:54:05:de:73:1b, type NE2000 (16 bit) isa0: too many dependant configs (8) isa0: unexpected small tag 14 fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0 fdc0: FIFO enabled, 8 bytes threshold fd0: <1440-KB 3.5" drive> on fdc0 drive 0 atkbdc0: <keyboard controller (i8042)> at port 0x60-0x64 on isa0 atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0 kbd0 at atkbd0 psm0: <PS/2 Mouse> irq 12 on atkbdc0 psm0: model Generic PS/2 mouse, device ID 0 vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0 sc0: <System console> at flags 0x1 on isa0 sc0: VGA <16 virtual consoles, flags=0x300> sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0 sio0: type 16550A sio1 at port 0x2f8-0x2ff irq 3 on isa0 sio1: type 16550A ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0 ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode ppc0: FIFO with 16/16/15 bytes threshold ppbus0: IEEE1284 device found /NIBBLE Probing for PnP devices on ppbus0: plip0: <PLIP network interface> on ppbus0 lpt0: <Printer> on ppbus0 lpt0: Interrupt-driven port ppi0: <Parallel I/O> on ppbus0 ad0: 8063MB <IBM-DHEA-38451> [16383/16/63] at ata0-master using UDMA33 ad2: 8063MB <IBM-DHEA-38451> [16383/16/63] at ata1-master using UDMA33 acd0: CDROM <DELTA OTC-H101/ST3 F/W by OIPD> at ata0-slave using PIO4 Mounting root from ufs:/dev/ad0s1a swapon: adding /dev/ad0s1b as swap device Automatic boot in progress... /dev/ad0s1a: FILESYSTEM CLEAN; SKIPPING CHECKS /dev/ad0s1a: clean, 48752 free (552 frags, 6025 blocks, 0.9% fragmentation) /dev/ad0s1f: FILESYSTEM CLEAN; SKIPPING CHECKS /dev/ad0s1f: clean, 128997 free (21 frags, 16122 blocks, 0.0% fragmentation) /dev/ad0s1g: FILESYSTEM CLEAN; SKIPPING CHECKS /dev/ad0s1g: clean, 3036299 free (43175 frags, 374073 blocks, 1.3% fragmentation) /dev/ad0s1e: filesystem CLEAN; SKIPPING CHECKS /dev/ad0s1e: clean, 128193 free (17 frags, 16022 blocks, 0.0% fragmentation) Doing initial network setup: hostname. ed0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255 inet6 fe80::5054::5ff::fede:731b%ed0 prefixlen 64 tentative scopeid 0x1 ether 52:54:05:de:73:1b lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x8 inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff000000 Additional routing options: IP gateway=YES TCP keepalive=YES routing daemons:. additional daemons: syslogd. Doing additional network setup:. Starting final network daemons: creating ssh RSA host key 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: cd:76:89:16:69:0e:d0:6e:f8:66:d0:07:26:3c:7e:2d root@k6-2.example.com creating ssh DSA host key 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: f9:a1:a9:47:c4:ad:f9:8d:52:b8:b8:ff:8c:ad:2d:e6 root@k6-2.example.com. setting ELF ldconfig path: /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 standard daemons: inetd cron sshd usbd sendmail. Initial rc.i386 initialization:. rc.i386 configuring syscons: blank_time screensaver moused. Additional ABI support: linux. Local package initialization:. Additional TCP options:. FreeBSD/i386 (k6-2.example.com) (ttyv0) login: rpratt Password: Generating the RSA and DSA keys may take some time on slower machines. This happens only on the initial boot-up of a new installation. Subsequent boots will be faster. If the X server has been configured and a Default Desktop chosen, it can be started by typing startx at the command line. &os;/&arch.alpha; 開機流程 Alpha Once the install procedure has finished, you will be able to start FreeBSD by typing something like this to the SRM prompt: >>>BOOT DKC0 This instructs the firmware to boot the specified disk. To make FreeBSD boot automatically in the future, use these commands: >>> SET BOOT_OSFLAGS A >>> SET BOOT_FILE '' >>> SET BOOTDEF_DEV DKC0 >>> SET AUTO_ACTION BOOT The boot messages will be similar (but not identical) to those produced by FreeBSD booting on the &i386;. FreeBSD Shutdown It is important to properly shutdown the operating system. Do not just turn off power. First, become a superuser by typing su at the command line and entering the root password. This will work only if the user is a member of the wheel group. Otherwise, login as root and use shutdown -h now. The operating system has halted. Please press any key to reboot. It is safe to turn off the power after the shutdown command has been issued and the message Please press any key to reboot appears. If any key is pressed instead of turning off the power switch, the system will reboot. You could also use the Ctrl Alt Del key combination to reboot the system, however this is not recommended during normal operation.
安裝的疑難雜症解決 installation troubleshooting The following section covers basic installation troubleshooting, such as common problems people have reported. There are also a few questions and answers for people wishing to dual-boot FreeBSD with &ms-dos; or &windows;. What to Do If Something Goes Wrong Due to various limitations of the PC architecture, it is impossible for probing to be 100% reliable, however, there are a few things you can do if it fails. Check the Hardware Notes document for your version of &os; to make sure your hardware is supported. 若硬體有在支援清單內,但使用 GENERIC kernel 仍有問題,那麼就可能需要 自訂 kernel,以加入有支援的硬體。 The kernel on the boot disks is configured assuming that most hardware devices are in their factory default configuration in terms of IRQs, IO addresses, and DMA channels. If your hardware has been reconfigured, you will most likely need to edit the kernel configuration and recompile to tell &os; where to find things. It is also possible that a probe for a device not present will cause a later probe for another device that is present to fail. In that case, the probes for the conflicting driver(s) should be disabled. Some installation problems can be avoided or alleviated by updating the firmware on various hardware components, most notably the motherboard. The motherboard firmware may also be referred to as BIOS and most of the motherboard or computer manufactures have a website where the upgrades and upgrade information may be located. Most manufacturers strongly advise against upgrading the motherboard BIOS unless there is a good reason for doing so, which could possibly be a critical update of sorts. The upgrade process can go wrong, causing permanent damage to the BIOS chip. Using &ms-dos; and &windows; File Systems At this time, &os; does not support file systems compressed with the Double Space™ application. Therefore the file system will need to be uncompressed before &os; can access the data. This can be done by running the Compression Agent located in the Start> Programs > System Tools menu. &os; can support &ms-dos; based file systems(FAT16 and FAT32). This requires you use the &man.mount.msdosfs.8; command with the required parameters. The utility most common usage is: &prompt.root; mount -t msdosfs /dev/ad0s1 /mnt In this example, the &ms-dos; file system is located on the first partition of the primary hard disk. Your situation may be different, check the output from the dmesg, and mount commands. They should produce enough information to give an idea of the partition layout. Extended &ms-dos; file systems are usually mapped after the &os; partitions. In other words, the slice number may be higher than the ones &os; is using. For instance, the first &ms-dos; partition may be /dev/ad0s1, the &os; partition may be /dev/ad0s2, with the extended &ms-dos; partition being located on /dev/ad0s3. To some, this can be confusing at first. NTFS partitions can also be mounted in a similar manner using the &man.mount.ntfs.8; command. Troubleshooting Questions and Answers My system hangs while probing hardware during boot, or it behaves strangely during install, or the floppy drive isn't probed. &os; 5.0 and above makes extensive use of the system ACPI service on the i386, amd64 and ia64 platforms to aid in system configuration if it's detected during boot. Unfortunately, some bugs still exist in both the ACPI driver and within system motherboards and BIOS. The use of 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 . I go to boot from the hard disk for the first time after installing &os;, the kernel loads and probes my hardware, but stops with messages like: changing root device to ad1s1a panic: cannot mount root What is wrong? What can I do? What is this bios_drive:interface(unit,partition)kernel_name thing that is displayed with the boot help? There is a longstanding problem in the case where the boot disk is not the first disk in the system. The BIOS uses a different numbering scheme to &os;, and working out which numbers correspond to which is difficult to get right. In the case where the boot disk is not the first disk in the system, &os; can need some help finding it. There are two common situations here, and in both of these cases, you need to tell &os; where the root filesystem is. You do this by specifying the BIOS disk number, the disk type and the &os; disk number for that type. The first situation is where you have two IDE disks, each configured as the master on their respective IDE busses, and wish to boot &os; from the second disk. The BIOS sees these as disk 0 and disk 1, while &os; sees them as ad0 and ad2. &os; is on BIOS disk 1, of type ad and the &os; disk number is 2, so you would say: 1:ad(2,a)kernel Note that if you have a slave on the primary bus, the above is not necessary (and is effectively wrong). The second situation involves booting from a SCSI disk when you have one or more IDE disks in the system. In this case, the &os; disk number is lower than the BIOS disk number. If you have two IDE disks as well as the SCSI disk, the SCSI disk is BIOS disk 2, type da and &os; disk number 0, so you would say: 2:da(0,a)kernel To tell &os; that you want to boot from BIOS disk 2, which is the first SCSI disk in the system. If you only had one IDE disk, you would use '1:' instead. Once you have determined the correct values to use, you can put the command exactly as you would have typed it in the /boot.config file using a standard text editor. Unless instructed otherwise, &os; will use the contents of this file as the default response to the boot: prompt. I go to boot from the hard disk for the first time after installing &os;, but the Boot Manager prompt just prints F? at the boot menu each time but the boot won't go any further. The hard disk geometry was set incorrectly in the Partition editor when you installed &os;. Go back into the partition editor and specify the actual geometry of your hard disk. You must reinstall &os; again from the beginning with the correct geometry. If you are failing entirely in figuring out the correct geometry for your machine, here's a tip: Install a small DOS partition at the beginning of the disk and install &os; after that. The install program will see the DOS partition and try to infer the correct geometry from it, which usually works. The following tip is no longer recommended, but is left here for reference:
If you are setting up a truly dedicated &os; server or workstation where you don't care for (future) compatibility with DOS, Linux or another operating system, you've also got the option to use the entire disk (`A' in the partition editor), selecting the non-standard option where &os; occupies the entire disk from the very first to the very last sector. This will leave all geometry considerations aside, but is somewhat limiting unless you're never going to run anything other than &os; on a disk.
The system finds my &man.ed.4; network card, but I keep getting device timeout errors. Your card is probably on a different IRQ from what is specified in the /boot/device.hints file. The ed driver does not use the `soft' configuration by default (values entered using EZSETUP in DOS), but it will use the software configuration if you specify -1 in the hints for the interface. Either move the jumper on the card to a hard configuration setting (altering the kernel settings if necessary), or specify the IRQ as -1 by setting the hint hint.ed.0.irq="-1" This will tell the kernel to use the soft configuration. Another possibility is that your card is at IRQ 9, which is shared by IRQ 2 and frequently a cause of problems (especially when you have a VGA card using IRQ 2!). You should not use IRQ 2 or 9 if at all possible.
Valentino Vaschetto Contributed by 進階安裝指南 This section describes how to install FreeBSD in exceptional cases. Installing FreeBSD on a System without a Monitor or Keyboard installation headless (serial console) serial console This type of installation is called a headless install, because the machine that you are trying to install FreeBSD on either does not have a monitor attached to it, or does not even have a VGA output. How is this possible you ask? Using a serial console. A serial console is basically using another machine to act as the main display and keyboard for a system. To do this, just follow the steps to create installation floppies, explained in . To modify these floppies to boot into a serial console, follow these steps: Enabling the Boot Floppies to Boot into a Serial Console mount If you were to boot into the floppies that you just made, FreeBSD would boot into its normal install mode. We want FreeBSD to boot into a serial console for our install. To do this, you have to mount the boot.flp floppy onto your FreeBSD system using the &man.mount.8; command. &prompt.root; mount /dev/fd0 /mnt Now that you have the floppy mounted, you must change into the /mnt directory: &prompt.root; cd /mnt Here is where you must set the floppy to boot into a serial console. You have to make a file called boot.config containing /boot/loader -h. All this does is pass a flag to the bootloader to boot into a serial console. &prompt.root; echo "/boot/loader -h" > boot.config Now that you have your floppy configured correctly, you must unmount the floppy using the &man.umount.8; command: &prompt.root; cd / &prompt.root; umount /mnt Now you can remove the floppy from the floppy drive. Connecting Your Null-modem Cable null-modem cable You now need to connect a null-modem cable between the two machines. Just connect the cable to the serial ports of the 2 machines. A normal serial cable will not work here, you need a null-modem cable because it has some of the wires inside crossed over. Booting Up for the Install It is now time to go ahead and start the install. Put the boot.flp floppy in the floppy drive of the machine you are doing the headless install on, and power on the machine. Connecting to Your Headless Machine cu Now you have to connect to that machine with &man.cu.1;: &prompt.root; cu -l /dev/cuad0 在 &os; 5.X,請改用 /dev/cuaa0 而非 /dev/cuad0 That's it! You should now be able to control the headless machine through your cu session. It will ask you to put in the kern1.flp, and then it will come up with a selection of what kind of terminal to use. Select the FreeBSD color console and proceed with your install! 製作安裝片 為避免重覆說明,在文中所提到的「FreeBSD 光碟」, 在這裡指的是您所購買或自行燒錄的 FreeBSD CDROM 或 DVD。 There may be some situations in which you need to create your own FreeBSD installation media and/or source. This might be physical media, such as a tape, or a source that sysinstall can use to retrieve the files, such as a local FTP site, or an &ms-dos; partition. For example: You have many machines connected to your local network, and one FreeBSD disc. You want to create a local FTP site using the contents of the FreeBSD disc, and then have your machines use this local FTP site instead of needing to connect to the Internet. You have a FreeBSD disc, and FreeBSD does not recognize your CD/DVD drive, but &ms-dos;/&windows; does. You want to copy the FreeBSD installation files to a DOS partition on the same computer, and then install FreeBSD using those files. The computer you want to install on does not have a CD/DVD drive or a network card, but you can connect a Laplink-style serial or parallel cable to a computer that does. You want to create a tape that can be used to install FreeBSD. Creating an Installation CDROM As part of each release, the FreeBSD project makes available at least two CDROM images (ISO images) per supported architecture. These images can be written (burned) to CDs if you have a CD writer, and then used to install FreeBSD. If you have a CD writer, and bandwidth is cheap, then this is the easiest way to install FreeBSD. Download the Correct ISO Images The ISO images for each release can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/ISO-IMAGES-arch/version or the closest mirror. Substitute arch and version as appropriate. That directory will normally contain the following images: FreeBSD 5.<replaceable>X</replaceable> and 6.<replaceable>X</replaceable> ISO Image Names and Meanings 檔名 內容 版本-RELEASE-架構-bootonly.iso Everything you need to boot into a FreeBSD kernel and start the installation interface. The installable files have to be pulled over FTP or some other supported source. 版本-RELEASE-架構-disc1.iso Everything you need to install &os; and a live filesystem, which is used in conjunction with the Repair facility in sysinstall. 版本-RELEASE-架構-disc2.iso &os; 文件(&os; 6.2 之前的),以及許多 third-party packages。 版本-RELEASE-架構-docs.iso &os; 文件(&os; 6.2 及之後)。
You must download one of either the bootonly ISO image (if available), or the image of disc one. Do not download both of them, since the disc one image contains everything that the bootonly ISO image contains. Use the bootonly ISO if Internet access is cheap for you. It will let you install &os;, and you can then install third-party packages by downloading them using the ports/packages system (see ) as necessary. Use the image of disc one if you want to install a &os; release and want a reasonable selection of third-party packages on the disc as well. The additional disc images are useful, but not essential, especially if you have high-speed access to the Internet.
Write the CDs You must then write the CD images to disc. If you will be doing this on another FreeBSD system then see for more information (in particular, and ). If you will be doing this on another platform then you will need to use whatever utilities exist to control your CD writer on that platform. The images provided are in the standard ISO format, which many CD writing applications support.
If you are interested in building a customized release of FreeBSD, please see the Release Engineering Article.
Creating a Local FTP Site with a FreeBSD Disc installation network FTP FreeBSD discs are laid out in the same way as the FTP site. This makes it very easy for you to create a local FTP site that can be used by other machines on your network when installing FreeBSD. On the FreeBSD computer that will host the FTP site, ensure that the CDROM is in the drive, and mounted on /cdrom. &prompt.root; mount /cdrom Create an account for anonymous FTP in /etc/passwd. Do this by editing /etc/passwd using &man.vipw.8; and adding this line: ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent Ensure that the FTP service is enabled in /etc/inetd.conf. Anyone with network connectivity to your machine can now chose a media type of FTP and type in ftp://your machine after picking Other in the FTP sites menu during the install. If the boot media (floppy disks, usually) for your FTP clients is not precisely the same version as that provided by the local FTP site, then sysinstall will not let you complete the installation. If the versions are not similar and you want to override this, you must go into the Options menu and change distribution name to any. This approach is OK for a machine that is on your local network, and that is protected by your firewall. Offering up FTP services to other machines over the Internet (and not your local network) exposes your computer to the attention of crackers and other undesirables. We strongly recommend that you follow good security practices if you do this. 建立安裝用的磁片 installation floppies 若您必須從磁片安裝(雖然我們建議這樣做), 不論是因為硬體不支援或是您堅持要用這麼刻苦的方式, 您都必須先準備一些磁片以供安裝。 磁片至少得是 1.44 MB At a minimum, you will need as many 1.44 MB floppies as it takes to hold all the files in the base (base distribution) directory. If you are preparing the floppies from DOS, then they must be formatted using the &ms-dos; FORMAT command. If you are using &windows;, use Explorer to format the disks (right-click on the A: drive, and select Format). Do not trust factory pre-formatted floppies. Format them again yourself, just to be sure. Many problems reported by our users in the past have resulted from the use of improperly formatted media, which is why we are making a point of it now. If you are creating the floppies on another FreeBSD machine, a format is still not a bad idea, though you do not need to put a DOS filesystem on each floppy. You can use the disklabel and newfs commands to put a UFS filesystem on them instead, as the following sequence of commands (for a 3.5" 1.44 MB floppy) illustrates: &prompt.root; fdformat -f 1440 fd0.1440 &prompt.root; bsdlabel -w fd0.1440 floppy3 &prompt.root; newfs -t 2 -u 18 -l 1 -i 65536 /dev/fd0 Then you can mount and write to them like any other filesystem. After you have formatted the floppies, you will need to copy the files to them. The distribution files are split into chunks conveniently sized so that five of them will fit on a conventional 1.44 MB floppy. Go through all your floppies, packing as many files as will fit on each one, until you have all of the distributions you want packed up in this fashion. Each distribution should go into a subdirectory on the floppy, e.g.: a:\base\base.aa, a:\base\base.ab, and so on. The base.inf file also needs to go on the first floppy of the base set since it is read by the installation program in order to figure out how many additional pieces to look for when fetching and concatenating the distribution. Once you come to the Media screen during the install process, select Floppy and you will be prompted for the rest. 從 &ms-dos; 分割區安裝 installation from MS-DOS 若準備要從 &ms-dos; 分割區進行安裝, 請把所有安裝檔都複製到該分割區根目錄內的 freebsd 目錄。 比如:c:\freebsd。 此目錄結構必須與光碟或 FTP 內的目錄結構一致, 因此若是要從光碟複製檔案,建議使用 DOS 的 xcopy 指令。 例如,要複製 &os; 最小安裝所需的檔案: C:\> md c:\freebsd C:\> xcopy e:\bin c:\freebsd\bin\ /s C:\> xcopy e:\manpages c:\freebsd\manpages\ /s 假設 C: 槽有多餘空間,可以放 &os; 安裝檔;E:則是光碟機代號。 若沒有光碟機,可以到 ftp.FreeBSD.org 去下載安裝檔。 每個安裝套件都有其相對應的目錄;比如 base 是放在 &rel.current;/base/ 目錄內。 請將您要安裝的套件(當然空間要夠)放到 &ms-dos; 分割區的 c:\freebsd 裡 — 因為這個 BIN 安裝套件僅供最精簡安裝而已。 製作安裝用的磁帶 installation from QIC/SCSI Tape 從磁帶上安裝也許是最簡單的方式,比用 FTP 或光碟安裝還快。 安裝程式假設所有檔案都會壓縮放在磁帶上。 在取得所有要裝的安裝檔之後 ,可以用下列指令把它們壓縮放在磁帶上: &prompt.root; cd /freebsd/distdir &prompt.root; tar cvf /dev/rwt0 dist1 ... dist2 當要安裝時,必須先確認磁帶還有足夠空間, 以便讓安裝過程暫存空間(可以自行選擇要放在哪個目錄), 可以容納磁帶安裝時的全部檔案。 由於磁帶本身並不能隨機存取,因此用磁帶安裝會需要很大的暫存空間。 在使用安裝磁片開機 之前, 磁帶一定要先放入磁帶機內,否則在偵測硬體時可能會無法偵測到磁帶機。 Before Installing over a Network installation network serial (SLIP or PPP) installation network parallel (PLIP) installation network Ethernet 有三種網路安裝方式: Ethernet (標準 Ethernet 晶片)、Serial port(SLIP 或 PPP)、 Parallel port (PLIP (laplink cable))。 透過網路安裝的最快方式,就是使用 Ethernet 網路卡! &os; 支援大多數常見的 Ethernet 網路卡; 所有支援的網路卡(及其所需的設定)都有在各版本的 &os; 內的 Hardware Note 說明文件內列出。 若您所用的是有支援的 PCMCIA 網路卡, 請務必在開機之前,先把該網路卡插上。 因為 &os; 的安裝過程,目前並不支援 PCMCIA 卡的熱插拔。 此外,還需要知道該用的 IP 位址以及相對應的 netmask 為何, 以及機器名稱。 若所用的是 PPP 連線,而且沒有固定 IP,別擔心, 因為您的 ISP 會自動分配 IP 給您。 關於這些網路的細部設定, 可以洽詢您網路環境的系統管理者。 若要能以機器名稱就能連到相對應的機器,而非直接使用 IP位址去連, 那麼您還需要 DNS 以及 gateway 的位址(若用的是 PPP 連線, gateway 位址就是 ISP 所分配給你的 IP 位址)。 若想透過 HTTP proxy 來使用 FTP 安裝,那麼必須知道 proxy 的網址為何。 若您對上述所需資訊不甚了解,那麼請在安裝之前, 先詢問系統管理者或 ISP。 SLIP 的支援相當原始,並且主要受限於電腦之間的實體線路(hard-wired) ,比如筆記型電腦與其他電腦之間的 serial 線。 之所以得以電腦間以直接線路連結,乃是由於 SLIP 安裝目前並不支援撥接功能。 PPP 才有提供撥接功能, 所以請儘可能優先採用 PPP 而非 SLIP。 若要透過數據機(modem)來安裝,那 PPP 幾乎是您唯一選擇。 請先準備好 ISP 所提供的相關資料,因為在安裝之初就會用到。 若使用 PAP 或 CHAP 來連到 ISP(換句話說,若在 &windows; 可以不透過 script 就可以連線到 ISP),那麼您僅需在 ppp 提示符號下輸入 dial 指令即可撥號。 否則,您必須知道如何以該數據機所採用的 AT 指令集來連到 ISP,因為 PPP 撥號程式僅提供非常陽春的 終端模擬器(terminal emulator)而起。 請參閱 Handbook 中 user-ppp 章節以及 FAQ 中的相關項目。 若有操作上的疑問,可以打 set log local ... 指令,以便在螢幕上顯示相關記錄。 若可直接以 hard-wired 方式連到另外的 &os;(2.0-R 及之後) 機器, 那麼可以考慮透過 laplink 平行電纜來安裝。 平行埠的傳輸速率比序列埠高很多(最高可達每秒 50 kbytes/sec), 所以安裝速度會更快一些。 Before Installing via NFS installation network NFS NFS 安裝方式相當簡便,只需將 FreeBSD 安裝檔案都放到某台 NFS server 上,然後再指定使用這台 NFS 作為安裝來源即可。 若該 server 只允許 privileged port(通常這是 Sun 工作站的預設值),那麼在安裝之前,必須先到 Options 選單去指定 NFS Secure 設定值。 若網路卡的連線品質不佳,那可能需要調整一下 NFS Slow 設定。 為了讓 NFS 安裝能順利完成,NFS 主機必須要可以支援子目錄的掛載 (mount),例如:&os; &rel.current; 安裝目錄是在: ziggy:/usr/archive/stuff/FreeBSD,那麼 ziggy 必須允許直接掛載在 /usr/archive/stuff/FreeBSD,而非僅 /usr 或是 /usr/archive/stuff 在 &os; 的 /etc/exports 檔,上述功能是由 選項所設定。 其他的 NFS server 可能會有不同的設定方式。 若看到 permission denied 錯誤訊息, 則表示可能由於沒有啟用這選項所造成的。