2.13. 製作安裝片

注意:

為避免重覆說明,在文中所提到的「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:

2.13.1. 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.

  1. 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:

    表格 2.4. FreeBSD 5.X and 6.X ISO Image Names and Meanings
    檔名內容
    版本-RELEASE-架構-bootonly.isoEverything 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.isoEverything you need to install FreeBSD and a live filesystem, which is used in conjunction with the Repair facility in sysinstall.
    版本-RELEASE-架構-disc2.isoFreeBSD 文件(FreeBSD 6.2 之前的),以及許多 third-party packages。
    版本-RELEASE-架構-docs.isoFreeBSD 文件(FreeBSD 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 FreeBSD, and you can then install third-party packages by downloading them using the ports/packages system (see 章 4, 軟體套件管理篇:Packages 及 Ports 機制) as necessary.

    Use the image of disc one if you want to install a FreeBSD 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.

  2. Write the CDs

    You must then write the CD images to disc. If you will be doing this on another FreeBSD system then see 節 18.6, “Creating and Using Optical Media (CDs)” for more information (in particular, 節 18.6.3, “burncd” and 節 18.6.4, “cdrecord”).

    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.

2.13.2. Creating a Local FTP Site with a FreeBSD Disc

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.

  1. On the FreeBSD computer that will host the FTP site, ensure that the CDROM is in the drive, and mounted on /cdrom.

    # mount /cdrom
  2. Create an account for anonymous FTP in /etc/passwd. Do this by editing /etc/passwd using vipw(8) and adding this line:

    ftp:*:99:99::0:0:FTP:/cdrom:/nonexistent
  3. 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.

2.13.3. 建立安裝用的磁片

若您必須從磁片安裝(雖然我們建議這樣做), 不論是因為硬體不支援或是您堅持要用這麼刻苦的方式, 您都必須先準備一些磁片以供安裝。

磁片至少得是 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:

# fdformat -f 1440 fd0.1440
# bsdlabel -w fd0.1440 floppy3
# 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.

2.13.4. 從 MS-DOS® 分割區安裝

若準備要從 MS-DOS® 分割區進行安裝, 請把所有安裝檔都複製到該分割區根目錄內的 freebsd 目錄。 比如:c:\freebsd。 此目錄結構必須與光碟或 FTP 內的目錄結構一致, 因此若是要從光碟複製檔案,建議使用 DOS 的 xcopy 指令。 例如,要複製 FreeBSD 最小安裝所需的檔案:

C:\> md c:\freebsd
C:\> xcopy e:\bin c:\freebsd\bin\ /s
C:\> xcopy e:\manpages c:\freebsd\manpages\ /s

假設 C: 槽有多餘空間,可以放 FreeBSD 安裝檔;E:則是光碟機代號。

若沒有光碟機,可以到 ftp.FreeBSD.org 去下載安裝檔。 每個安裝套件都有其相對應的目錄;比如 base 是放在 10.0/base/ 目錄內。

請將您要安裝的套件(當然空間要夠)放到 MS-DOS® 分割區的 c:\freebsd 裡 —— 因為這個 BIN 安裝套件僅供最精簡安裝而已。

2.13.5. 製作安裝用的磁帶

從磁帶上安裝也許是最簡單的方式,比用 FTP 或光碟安裝還快。 安裝程式假設所有檔案都會壓縮放在磁帶上。 在取得所有要裝的安裝檔之後 ,可以用下列指令把它們壓縮放在磁帶上:

# cd /freebsd/distdir
# tar cvf /dev/rwt0 dist1 ... dist2

當要安裝時,必須先確認磁帶還有足夠空間, 以便讓安裝過程暫存空間(可以自行選擇要放在哪個目錄), 可以容納磁帶安裝時的全部檔案。 由於磁帶本身並不能隨機存取,因此用磁帶安裝會需要很大的暫存空間。

注意:

在使用安裝磁片開機 之前, 磁帶一定要先放入磁帶機內,否則在偵測硬體時可能會無法偵測到磁帶機。

2.13.6. Before Installing over a Network

有三種網路安裝方式: Ethernet (標準 Ethernet 晶片)、Serial port(SLIP 或 PPP)、 Parallel port (PLIP (laplink cable))。

透過網路安裝的最快方式,就是使用 Ethernet 網路卡! FreeBSD 支援大多數常見的 Ethernet 網路卡; 所有支援的網路卡(及其所需的設定)都有在各版本的 FreeBSD 內的 Hardware Note 說明文件內列出。 若您所用的是有支援的 PCMCIA 網路卡, 請務必在開機之前,先把該網路卡插上。 因為 FreeBSD 的安裝過程,目前並不支援 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 方式連到另外的 FreeBSD(2.0-R 及之後) 機器, 那麼可以考慮透過 laplink 平行電纜來安裝。 平行埠的傳輸速率比序列埠高很多(最高可達每秒 50 kbytes/sec), 所以安裝速度會更快一些。

2.13.6.1. Before Installing via NFS

NFS 安裝方式相當簡便,只需將 FreeBSD 安裝檔案都放到某台 NFS server 上,然後再指定使用這台 NFS 作為安裝來源即可。

若該 server 只允許 privileged port(通常這是 Sun 工作站的預設值),那麼在安裝之前,必須先到 Options 選單去指定 NFS Secure 設定值。

若網路卡的連線品質不佳,那可能需要調整一下 NFS Slow 設定。

為了讓 NFS 安裝能順利完成,NFS 主機必須要可以支援子目錄的掛載 (mount),例如:FreeBSD 10.0 安裝目錄是在: ziggy:/usr/archive/stuff/FreeBSD,那麼 ziggy 必須允許直接掛載在 /usr/archive/stuff/FreeBSD,而非僅 /usr 或是 /usr/archive/stuff

在 FreeBSD 的 /etc/exports 檔,上述功能是由 -alldirs 選項所設定。 其他的 NFS server 可能會有不同的設定方式。 若看到 permission denied 錯誤訊息, 則表示可能由於沒有啟用這選項所造成的。

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.