2.3. 安裝前的工作

一旦確定系統符合安裝 FreeBSD 的最低硬體需求,就可以下載安裝檔案並準備安裝的媒體。 做這些之前,先檢查以下核對清單的項目是否準備好了:

  1. 備份重要資料

    安裝任何作業系統前, 總是 要先備份所有重要資料。 不要儲存備份在即將安裝的系統上。改為將資料儲存在可移除磁碟,像是 USB 隨身碟,網路上的另一個系統或是線上備份服務上。 開始安裝前,要測試備份,確定它含有所有需要的檔案。 一旦安裝程式格式化系統的磁碟,所有儲存在上面的資料都會遺失。

  2. 決定 FreeBSD 安裝在哪裡

    如果 FreeBSD 是唯一要安裝的作業系統,這個步驟可以略過。 但是假如 FreeBSD 將和其他作業系統分享磁碟空間的話,要決定 FreeBSD 要安裝在哪個磁碟或是哪個分割區。

    在 i386 和 amd64 平台,磁碟可以使用兩種分割區配置之一來分割成多個分割區。 傳統的主開機紀錄 (MBR) 有一個分割區表定義最多到 主分割區。 因為歷史性的理由, FreeBSD稱這些主分割區為 slices。 其中一個主分割區可以分成一個 延伸分割區 ,他包含多個 邏輯分割區GUID 分割區表 (GPT) 是較新和較簡單的分割磁碟的方法 一般GPT 實作允許每個磁碟最多達128個分割區,減少使用邏輯分割區的需要。

    警告:

    一些比較舊的作業系統,像是 Windows® XP , 和 GPT 分割區配置並不相容。 如果 FreeBSD 將和這樣的作業系統共享一個磁碟,那就需要用 MBR 分割。

    FreeBSD 開機啟動程式需要主分割區或是 GPT 分割區。 如果所有的主分割區或 GPT 分割區都已使用, 必須釋放其中一個分割區讓 FreeBSD 使用。 如果要建立一個分割區而不刪除原有的資料, 可以使用磁碟分割工具來縮小現有的分割區, 並使用多出的空間來建立新分割區。

    各種自由的和商業化的磁碟分割工具列於 http://en.wikipedia.org/wiki/List_of_disk_partitioning_softwareGParted Live (http://gparted.sourceforge.net/livecd.php) 是包含分割編輯工具GParted的自由的 live CDGParted 也包含在許多 Linux live CD 套件裡。

    警告:

    當正確地使用,磁碟分割工具可以安全地建立空間讓新的分割區使用。 因為有可能會誤選已經存在的分割區,所以在修改磁碟分割區前, 一定要備份重要資料,並確認備份的完整性。

    包含不同作業系統的磁碟分割區可以讓一台電腦安裝多重作業系統。 另一種作法是使用虛擬機器 (章 21, Virtualization(虛擬機器)) ,可以讓多重作業系統同時間執行而不需要改變任何磁碟分割區。

  3. 收集網路資訊

    有些 FreeBSD 安裝方法為了下載安裝檔案需要網路連線。 在系統安裝之後,安裝程式將會讓您設定系統的網路介面。

    如果網路有 DHCP 伺服器,可以自動設定網路。 如果沒有 DHCP , 需要從區域網路管理者或是網際網路服務商取得以下系統的網路資訊:

    需要的網路資訊
    1. IP 位址

    2. 子網路遮罩

    3. 預設閘道器 IP 位址

    4. 網路的網域名稱

    5. 網路 DNS 伺服器 IP 位址

  4. 檢查 FreeBSD 勘誤表

    儘管 FreeBSD Project 努力確保每個 FreeBSD 發行版能夠儘可能地穩定,錯誤偶爾還是會悄悄出現。 有極小的機會錯誤會影響安裝過程。 當這些問題被發現並修正後,會被紀錄在 FreeBSD 網站的 FreeBSD 勘誤表 (http://www.freebsd.org/releases/11.0R/errata.html)。 安裝前要檢查勘誤表,確保沒有會影響到安裝的問題。

    所有發行版的資訊和勘誤表可以在 FreeBSD 網站的發行資訊找到 (http://www.freebsd.org/releases/index.html)。

2.3.1. 準備安裝的媒體

The FreeBSD installer is not an application that can be run from within another operating system. Instead, download a FreeBSD installation file, burn it to the media associated with its file type and size (CD, DVD, or USB), and boot the system to install from the inserted media.

FreeBSD installation files are available at www.freebsd.org/where.html#download. Each installation file's name includes the release version of FreeBSD, the architecture, and the type of file. For example, to install FreeBSD 10.0 on an amd64 system from a DVD, download FreeBSD-10.0-RELEASE-amd64-dvd1.iso, burn this file to a DVD, and boot the system with the DVD inserted.

Several file types are available, though not all file types are available for all architectures. The possible file types are:

  • -bootonly.iso: This is the smallest installation file as it only contains the installer. A working Internet connection is required during installation as the installer will download the files it needs to complete the FreeBSD installation. This file should be burned to a CD using a CD burning application.

  • -disc1.iso: This file contains all of the files needed to install FreeBSD, its source, and the Ports Collection. It should be burned to a CD using a CD burning application.

  • -dvd1.iso: This file contains all of the files needed to install FreeBSD, its source, and the Ports Collection. It also contains a set of popular binary packages for installing a window manager and some applications so that a complete system can be installed from media without requiring a connection to the Internet. This file should be burned to a DVD using a DVD burning application.

  • -memstick.img: This file contains all of the files needed to install FreeBSD, its source, and the Ports Collection. It should be burned to a USB stick using the instructions below.

Also download CHECKSUM.SHA256 from the same directory as the image file and use it to check the image file's integrity by calculating a checksum. FreeBSD provides sha256(1) for this, while other operating systems have similar programs. Compare the calculated checksum with the one shown in CHECKSUM.SHA256. The checksums must match exactly. If the checksums do not match, the file is corrupt and should be downloaded again.

2.3.1.1. 將印象檔寫入USB

The *.img file is an image of the complete contents of a memory stick. It cannot be copied to the target device as a file. Several applications are available for writing the *.img to a USB stick. This section describes two of these utilities.

重要:

Before proceeding, back up any important data on the USB stick. This procedure will erase the existing data on the stick.

過程 2.1. 使用 dd 指令來寫入印象檔

警告:

This example uses /dev/da0 as the target device where the image will be written. Be very careful that the correct device is used as this command will destroy the existing data on the specified target device.

  • The dd(1) command-line utility is available on BSD, Linux®, and Mac OS® systems. To burn the image using dd, insert the USB stick and determine its device name. Then, specify the name of the downloaded installation file and the device name for the USB stick. This example burns the amd64 installation image to the first USB device on an existing FreeBSD system.

    # dd if=FreeBSD-10.0-RELEASE-amd64-memstick.img of=/dev/da0 bs=64k

    If this command fails, verify that the USB stick is not mounted and that the device name is for the disk, not a partition. Some operating systems might require this command to be run with sudo(8). Systems like Linux® might buffer writes. To force all writes to complete, use sync(8).

過程 2.2. 使用Windows® 來寫入映象檔

警告:

要確保提供正確的磁碟機代號,因為磁碟上的資料會被覆蓋和摧毀。

  1. 取得Image Writer for Windows®

    Image Writer for Windows® 是一個免費的應用程式,可以正確地將映像檔寫入隨身碟。 從 https://launchpad.net/win32-image-writer/ 下載,並解壓縮到一個資料夾。

  2. 用 Image Writer 寫入映象檔

    雙擊 Win32DiskImager icon 啟動程式。 確認 Device 顯示的磁碟機代號是隨身碟的磁碟機代號。 按下資料夾 icon 選擇要寫入隨身碟的映像檔。 按下 [ Save ] 按鈕確定映像檔名。 確認所有東西都正確,隨身碟的資料夾並沒有在其他視窗開啟。 所有東西準備好後,按下 [ Write ] 將映像檔寫入隨身碟。

您現在可以開始安裝 FreeBSD 。

本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/

若有 FreeBSD 方面疑問,請先閱讀 FreeBSD 相關文件,如不能解決的話,再洽詢 <questions@FreeBSD.org>。

關於本文件的問題,請洽詢 <doc@FreeBSD.org>。