上一页
获取OpenBSD
OpenBSD FAQ 第四章:OpenBSD3.5安装指南
下一页
建立你自己的内核


4.1 - OpenBSD安装程序概述
OpenBSD有一个健壮的、可修改的(adapable)的基于文本的安装程序,并且可以从一张软盘进行安装。大部分平台有着类似的安装程序,但是具体来说它们又各自有着差别。无论如何,我们都建议你阅读与您的平台相符的INSTALL文档,该文档位于CD-ROM或者FTP站点的相关平台目录下(例如,i386/INSTALL.i386,mac68k/INSTALL.mac68k 或者 sparc/INSTALL.sparc).

在大多数平台下,OpenBSD的安装程序使用一个特殊的内核并带有许多有用工具和安装脚本,这些都被嵌入进了一个预载入的RAM盘中。当内核启动后,操作系统将从许多压缩过的tar文件(.tgz)中解压出来。启动该安装内核有几种不同的方法:

  ◇软盘:提供了在其他类Unix 操作系统或者DOS/Windows上创建和安装 floppy的软盘映像。典型的文件名是floppy35.fs,但是有些平台有多个可用的软盘映像.
  ◇CD-ROM:在一些 平台上还提供CD-ROM image(cd35.iso)用于制作可启动CD-ROM.它仅含安装内核-----安装文件仍然需要通过FTP或者其他途径获得。你当然还可以制作你自己的包含安装文件和你想要的其他工具的CD-ROM.
  ◇bsd.rd:RAM disk内核,用于启动一个已存的OpenBSD分区或者通过网络启动。
  ◇网络:一些平台支持从网络启动。
  ◇写入一个文件系统映像到磁盘:将一个文件系统映像写入某分区,然后可用该分区启动。
  ◇可启动磁带:一些平台支持从磁带启动。这些磁需要按照INSTALL.platform的说明来制作。

并非每个平台都支持所有的启动项:
  ◇alpha: Floppy, CD-ROM, writing a floppy image to hard disk.
  ◇ hp300: CD-ROM, network.
  ◇ hppa: Network.
  ◇ i386: Floppy, CD.
  ◇ mac68k: Installed (and booted) using MacOS utilities. See INSTALL.mac68k for details.
  ◇ macppc: CD-ROM, network.
  ◇ mvme68k: Network, bootable tape.
  ◇ sparc: Floppy, CD-ROM, network, writing image to existing swap partition, bootable tape.
  ◇ sparc64: Floppy (U1/U2 only), CD-ROM, network, writing image to existing partition.
  ◇ vax: Floppy, network.

所有 的平台,(除了mac68k)也可以用bsd.rd进行reinstall或者upgrade.

一旦安装内核已启动,有几个选项用来指定从何处获得安装文件组。同样,并非所有的平台都支持所有的选项。
  ◇CD-ROM:当然!我们更喜欢你使用官方的CD-ROM套件,但如果有特殊需要,你也可以制作自己的CD-ROM.
  ◇FTP:每个OpenBSD FTP镜像站或者本地FTP服务器上都有文件组。
  ◇HTTP:每个OpenBSD HTTP镜像站或者本地HTTP服务器上都有文件组。
  ◇本地磁盘分区:大多数情况下,你可以从本地磁盘的其他分区获得安装文件组。例如,在i386平台上,你可以从FAT分区或者ISO9660,Rock Ridge或者Joliet格式的CD-ROM进行安装。在一些情况下,你需要在使用前手工mount上文件系统。
  ◇NFS:一些平台支持mount NFS来获得文件组。
  ◇磁带:也可以从支持的磁带上读取文件组。
4.2安装前预确定的信息:
在安装OpenBSD前,你至少应该知道以下项:
◇机器名(machine name)
◇已安装的硬件和可用的硬件
  +通过该平台的兼容性列表查看硬件的兼容性。
  +假如是ISA,你还要知道硬件设置,按照OpenBSD 的要求确认它们。
◇使用何中种安装方式(CD-ROM,FTP等)
◇系统如何升级和打补丁?
  +假如在本地进行你需要足够的空间给源码树和building用。
  +否则,你需要在别的机子上建立一个patched release.
◇如何分配磁盘空间:
  +已存数据是否需备份到别处?
  +OpenBSD 是否和其他系统共存?假如是,如何进行双启动?你是否需要安装启动管理器(boot manager)?
  +是否让OpenBSD 使用整个硬盘?或者你是否想留下一个已存分区?(或者分出一个为将来使用)
  +你想如何对磁盘的OpenBSD部分进行再分?
◇网络设置,假如不使用DHCP:
  +Domain name
  +DNS地址
  +每个NIC的IP 地址和子网掩码
  +网关地址
◇你是否运行X 窗口系统?

4.3制作可启动的OpenBSD安装介质:

我们将以i386和 sparc平台的可用安装映像为例

i386平台有5种不同的安装盘映像文件可选:
floppy35.fs(桌面PC),支持许多PCI和ISA NIC,IDE和简单的SCSI 适配器以及一些PCMCIA支持。大部分用户将使用此映像文件。
floppyB35.fs(服务器)支持许多RAID控制器和一些非同一般的SCSI适配器。然而许多标准的SCSI适配器和许多EISA和ISA NIC的支持已经被移除。
floppyC35.fs(Laptop)支持许多laptop上的CardBus和PCMCIA 设备。
cdrom35.fs:它是以上三个映像文件的综合,可用于制作2.88M 的可启动软盘,或者作为CD的可启动映像。
cd35.iso是一个用CD-ROM制作软件制作可启动CD所用的ISO9660 映像。这是cdrom35.fs文件的"ready-to-record"格式。

当然,也许你需要一张既支持SCSI适配器又支持网络适配器的安装盘。幸运的是,这样的情况很少,一般不会有什么问题 。

sparc平台有3中可选的安装磁盘映像:
floppy35.fs: 支持带软驱的系统.
cd35.iso :用于制作启动SPARC系统的可启动Cd-ROM的 ISO映像文件
miniroot35.fs: 可以写入一个交换分区并启动。

4.3.1在Unix下制作启动软盘:
为了格式化软盘,要用fdformat(1)命令进行格式化和坏扇区检查。
#fdformat /dev/rfd0c
Format 1440K floppy `/dev/rfd0c'? (y/n): y
Processing VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV done.

假如你的输出如上,那么此盘无问题。如果你没看到所有的V,则此盘有问题,你可能需要换张新盘。

注意:一些类Unix系统可能使用不同的命令来格式化软盘。请参阅其相关文档来获得准确的操作。

一旦有了干净的、已格式化的软盘。就可以将安装映像写入该软盘。这要使用dd(1)工具,如下:
# dd if=floppy35.fs of=/dev/rfd0c bs=32k
之后,用cmp((1)命令确定已复制文件和原文件相同。假如相同,会有额外的提示。
#cmp /dev/rfd0c floppy35.fs
4.3.2在Windown或DOS 下制作floppy:
本节主要介绍如何在windows或DOS下将安装映像写入软盘。下面用到的工具你可以在任何FTP镜像的tools目录下,或者OpenBSD CD 套件的CD1的3.5/tools下找到。

在MS-DOS或者下准备软盘,首先用自带的格式化工具格式化软盘。

你可以用rawrite,faimage或者ntrw将映像文件写入软盘。rawrite不能在Windows NT,2000和XP下工作。

注意:FDIMAGE.EXE和RAWRITE.EXE都是MS-DOS应用程序,因此受到 MS-DOS的“8.3”文件名称 规则限制。因为floppyB35.fs和floppyC35.fs有长文件名,在使用FDIMAGE.EXE或者RAWRITE .EXE制作可启动软盘前需要知道你的系统如何按8.3格式保存那些文件。 使用rawrite举例:
C:\> rawrite
RaWrite 1.2 - Write disk file to raw floppy diskette

Enter source file name: floppy35.fs
Enter destination drive: a
Please insert a formatted diskette into drive A: and press -ENTER- :
Enter

fdimage使用举例:
C:\> fdimage -q floppy35.fs a:


ntrw使用举例:
C:\> ntrw floppy35.fs a:
3.5", 1.44MB, 512 bytes/sector
bufsize is 9216
1474560 bytes written

4.3.3制作CD-ROM:
你可以用cd35.iso文件制作CD-ROM(在i386平台,你也可以用cdrom35.fs 作为用于从CD-ROM启动i386系统的可启动软盘映像文件)。详细的介绍取决于用户所选择的刻录软件。

OpenBSD 下的一些刻录软件如下:
*mkhybrid(8)
*cdrecord,OpenBSD ports下面的cdrtools collection的一部分。


4.4-启动 OpenBSD安装介质


启动i386
在i386平台上启动安装映像对很多人来说并非什么新鲜事。假如你使用的是一张软盘,只要将软盘插入软驱并且启动计算机即可。安装映像就会被载入,你需要在BIOS里面打开软盘启动支持。假如你想从光盘启动,你就需要进入系统BIOS设置从光盘启动。一些比较老的BIOS没有此选项,你就必须使用软盘来启动安装映像。不用担心,你从软盘启动后一样可以从光盘进行安装。

你也可以从一个已存在的OpenBSD分区上启动bsd.rd来进行安装,或者在通过网络使用PXE启动进程。

启动 sparc/sparc64

注意:在 sparc64平台上,只有SBus机器(Ultra 1,Ultra 2)支持从软盘启动。

将带有OpenBSD安装映像的软盘插入软驱。然后用如下命令从软盘启动:
ok boot floppy

要从光盘启动,将CD-ROM插入光驱。假如你的Sun只有一个光驱,接下来就可以转移到启动提示符下,在那你就可以"boot cdrom":
ok boot cdrom
当然,这只有在新的命令模式下有效。如果你处于老的命令模式提示符下,可以输入"n"进入新的命令模式。(假如你用的是老的pre-sun4c,就没有新命令模式,这样,你就需要试验试验)。如果你有多个光驱,你需要从某个启动,可以在新命令模式下运行"probe-scsi":

ok probe-scsi
Target 0
Unit 0 Disk QUANTUM LIGHTNING 365S
Target 1
Unit 0 Removable Disk QUANTUM EMPIRE_1080S
Target 3
Unit 0 Removable Disk Joe's CD-ROM

指明你要从哪个CD-ROM启动。注意target号。
ok boot /sbus/esp/sd@X,0
4.5-安装OpenBSD
4.5.1-开始安装

  一旦你懂了如何启动,就可以开始安装了。在boot进程运行时,内核和所有的用于安装OpenBSD的程序都将被载入内存。启动时常出现的问题是损坏的软盘或者磁盘队列错误。启动软盘被塞的满满的,任何一个小坏块也可能导致问题的出现。

 在OpenBSD安装过程中,无论何时,你都可以用Ctrl-C中断当前的安装,并且可以在Shell提示符下运行"install"来重起安装进程,而无须重起你的计算机!
 如果启动成功,你可以看到许多文本信息滚动而过。这些信息,在许多体系上是蓝底白字,即dmesg,内核告诉你找到的设备,并且在何处。不要着急记住这些信息,它有一份拷贝保存在/var/run/dmesg.boot。在一些体系上 ,SHIFT+PGUP可以让你察看滚动的文本。 你将会看到如下信息:

rootdev=0x1100 rrootdev=0x2f00 rawdev=0x2f02
erase ^?, werase ^W, kill ^U, intr ^C, status ^T
(I)nstall, (U)pgrade or (S)hell? i

在大多数情况下,会显示如下3个选项:
Install:将OpenBSD载入系统,在此可能覆盖掉你的所有数据。注意在此也可以
本例,我们选择Install,但是Upgrade也类似。

Welcome to the OpenBSD/i386 3.5 install program.

This program will help you install OpenBSD in a simple and rational way. At
any prompt except password prompts you can run a shell command by typing
'!foo', or escape to a shell by typing '!'. Default answers are shown in []'s
and are selected by pressing RETURN. At any time you can exit this program by
pressing Control-C and then RETURN, but quitting during an install can leave
your system in an inconsistent state.


Specify terminal type: [vt220]ENTER
Do you wish to select a keyboard encoding table? [n] ENTER


大多数情况下,默认的终端类型就可以。但是如果你使用串行控制台进行安装,你就不能用默认的了,必须做适当的回答。

如果你不需要选择一个键盘编码表,你将默认使用US键盘布局。

IS YOUR DATA BACKED UP? As with anything that modifies disk contents, this
program can cause SIGNIFICANT data loss.

It is often helpful to have the installation notes handy. For complex disk
configurations, relevant disk hardware manuals and a calculator are useful.

Proceed with install? [n] y

在这,如果你使用默认项,安装进程将被中断,并返回到shell提示符下。

4.5.2设定磁盘分区
 在OpenBSD中设置磁盘会因平台的不同而有些差异。i386和 macppc中,磁盘设置只有两步。首先,用fdisk定义硬盘的OpenBSD 块(Slice),接着,用disklable(8)将OpenBSD 块(Slice)再细分成OpenBSD 分区。
 一些用户往往会被这里的一些专业术语混淆。可能会发现我们用“分区”来表示几种不同的意思。这是正确的!在许多 OpenBSD平台上有着两个分区层。第一个,我们可以认为是操作系统分区,这就是多系统在同一台计算机上如何标记它们各自的磁盘空间。第二个就是OpenBSD分区如何再细分成不同的文件系统。第一层作为一个磁盘分区在DOS或者Windows下可见,并且不同的操作系统可以共存在同一台IBM AT 机器上(IBM AT decended machines).第二层仅在OpenBSD下或者那些直接读取OpenBSD文件系统的操作系统下可见。

Cool! Let's get to it...

You will now initialize the disk(s) that OpenBSD will use. To enable all
available security features you should configure the disk(s) to allow the
creation of separate filesystems for /, /tmp, /var, /usr, and /home.

Available disks are: wd0.
Which one is the root disk? (or done) [wd0] Enter

根磁盘就是启动系统的那个磁盘,一般交换分区也位于该盘。通常,默认就可以。如果不是这样,你就需要知道如何强迫计算机从一个非标准的磁盘启动。IDE硬盘为wd0,wd1等,SCSI和RAID设备显示为sd0,sd1等。OpenBSD能找到的所有磁盘将显示在这里,如果你的硬盘没有显示在这里,那么可能是不支持或者是硬件配置错误。
Do you want to use *all* of wd0 for OpenBSD? [no] Enter

如果你输入"yes",整个硬盘将会分配给OpenBSD.这将会将标准MBR和分区表写入磁盘,分区只有一个,大小为整个硬盘,OpenBSD分区类型,并且也是启动分区。这一般只用于大多数的将OpenBSD用商用的情况。然而,有些系统却不允许你这么做。许多Compaq系统,laptop和一些Dell及其他系统使用一个"maintenance"或者"Suspend to Disk"分区,不能对它进行修改。假如你的系统有其他的类型的其他分区,并且你不想删除它,请不要选择"yes".

我们的例子假设对已存在Windows 2000分区的磁盘划分OpenBSD分区,所以我们使用默认的"no",它将会带我们进入fdisk程序。你可以在此获得关于fdisk(8)的更多信息。

特别注意:使用一个大的(在i686上大于8G,在更老的机子或者其他平台上可能更小)硬盘前请一定阅读此节。

You will now create a single MBR partition to contain your OpenBSD data. This
partition must have an id of 'A6'; must *NOT* overlap other partitions; and
must be marked as the only active partition.
The 'manual' command describes all the fdisk commands in detail.
Disk: wd0 geometry: 2586/240/63 [39100320 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
------------------------------------------------------------------------
*0: 06 0 1 1 - 202 239 63  [ 63: 3069297 ] DOS > 32MB
  1: 00 0 0 0 - 0  0  0  [ 0: 0 ] unused
  2: 00 0 0 0 - 0  0  0  [ 0: 0 ] unused
  3: 00 0 0 0 - 0  0  0  [ 0: 0 ] unused
Enter 'help' for information
fdisk: 1> help
help      Command help list
manual     Show entire OpenBSD man page for fdisk
reinit     Re-initialize loaded MBR (to defaults)
setpid     Set the identifier of a given table entry
disk      Edit current drive stats
edit      Edit given table entry
flag      Flag given table entry as bootable
update     Update machine code in loaded MBR
select     Select extended partition table entry MBR
print      Print loaded MBR partition table
write      Write loaded MBR to disk
exit      Exit edit of current MBR, without saving changes
quit      Quit edit of current MBR, saving current changes
abort      Abort program without saving current changes
fdisk: 1>

有几个命令需要详细的说明:
*r或者reinit:清除已存的分区表,建立一个大的OpenBSD分区,并标记它为active。等同于在"use *all* of ..."时回答"yes"
*p或print.按扇区显示出当前的分区表。 "p m"将以兆字节(MB)格式显示分区表."p g"以吉字节(gigabytes)显示分区表。
*e或edit:编辑或者改变分区表项。
*f或flag:标记某分区为活动(active)分区,系统从该分区启动。
*exit或quit:注意一些人过去完全把他们的意思搞反了。

需要重申的是,这里出现任何错误都将导致严重的数据丢失。假如你要在有重要数据的计算机上做这些,最好能在一个无关紧要的盘上进行练习,另外要注意先备份。

这里我们有1.5G分区是Windows2000(使用FAT文件系统)。看到上面显示的信息,我们可以发现windows分区占据了硬盘上0到202柱面,我们将剩下的分区分配给OpenBSD,从203柱面开始。你也可以计算出OpenBSD的起始扇区为3069360.(已知分区的起始扇区63加上它的大小3069297).

你可以以柱面/头(Headers)/扇区格式来编辑分区布局或者调整raw扇区。哪个更容易些取决于你要做什么。此例对以已知分区进行处理,用CHS格式可能会容易些。
fdisk: 1> e 1
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
------------------------------------------------------------------------
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
Partition id ('0' to disable) [0 - FF]: [0] (? for help) a6
Do you wish to edit in CHS mode? [n] y
BIOS Starting cylinder [0 - 2585]: [0] 203
BIOS Starting head [0 - 239]: [0] Enter
BIOS Starting sector [1 - 63]: [0] 1
BIOS Ending cylinder [0 - 2585]: [0] 2585
BIOS Ending head [0 - 239]: [0] 239
BIOS Ending sector [1 - 63]: [0] 63
fdisk:*1> p
Disk: wd0 geometry: 2586/240/63 [39100320 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
------------------------------------------------------------------------
*0: 06 0 1 1 - 202 239 63 [ 63: 3069297 ] DOS > 32MB
1: A6 203 0 1 - 2585 239 63 [ 3069360: 36030960 ] OpenBSD
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
fdisk:*1> p m
Disk: wd0 geometry: 2586/240/63 [19092 Megabytes]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
------------------------------------------------------------------------
*0: 06 0 1 1 - 202 239 63 [ 63: 1499M] DOS > 32MB
1: A6 203 0 1 - 2585 239 63 [ 3069360: 17593M] OpenBSD
2: 00 0 0 0 - 0 0 0 [ 0: 0M] unused
3: 00 0 0 0 - 0 0 0 [ 0: 0M] unused
fdisk:*1>

注意,提示符如果变为一个带*号的,说明你的修改没有被保存。从上面的p m输出可以看出,我们没有改变windows分区,我们成功的将剩余分区分配给了OpenBSD,并且分区无交迭。

我们还没做的是标记某分区为活动分区active,这样计算机才能在下次重启时启动OpenBSD。

fdisk:*1> f 1
Partition 1 marked active.
fdisk:*1> p
Disk: wd0 geometry: 2586/240/63 [39100320 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
------------------------------------------------------------------------
0: 06 0 1 1 - 202 239 63 [ 63: 3069297 ] DOS > 32MB
*1: A6 203 0 1 - 2585 239 63 [ 3069360: 36030960 ] OpenBSD
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
fdisk:*1>
至此,我们就可以保存我们的修改了。
fdisk:*1> w
Writing MBR at offset 0.
wd0: no disk label
fdisk: 1> q



创建磁盘卷标(disklabel)

下一步就是使用disklable(8)将OpenBSD Slice细分成不同文件系统的分区.使用diskable(8)的详细信息请看FAQ14,disklable.
Here is the partition information you chose:
Disk: wd0 geometry: 2586/240/63 [39100320 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
------------------------------------------------------------------------
*0: 06 0 1 1 - 202 239 63 [ 63: 3069297 ] DOS > 32MB
1: A6 203 0 1 - 2585 239 63 [ 3069360: 36030960 ] OpenBSD
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
You will now create an OpenBSD disklabel inside the OpenBSD MBR
partition. The disklabel defines how OpenBSD splits up the MBR partition
into OpenBSD partitions in which filesystems and swap space are created.
The offsets used in the disklabel are ABSOLUTE, i.e. relative to the
start of the disk, NOT the start of the OpenBSD MBR partition.
disklabel: no disk label
WARNING: Disk wd0 has no label. You will be creating a new one.
# using MBR partition 1: type A6 off 3069360 (0x2ed5b0) size 36030960 (0x225c9f0)
Treating sectors 3069360-39100320 as the OpenBSD portion of the disk.
You can use the 'b' command to change this.
Initial label editor (enter '?' for help at any prompt)
> ?
Available commands:
p [unit] - print label.
M - show entire OpenBSD man page for disklabel.
e - edit drive parameters.
a [part] - add new partition.
b - set OpenBSD disk boundaries.
c [part] - change partition size.
d [part] - delete partition.
D - set label to default.
g [d|b] - Use [d]isk or [b]ios geometry.
m [part] - modify existing partition.
n [part] - set the mount point for a partition.
r - recalculate free space.
u - undo last change.
s [path] - save label to file.
w - write label to disk.
q - quit and save changes.
x - exit without saving changes.
X - toggle expert mode.
z - zero out partition table.
? [cmnd] - this message or command specific help.
Numeric parameters may use suffixes to indicate units:
'b' for bytes, 'c' for cylinders, 'k' for kilobytes, 'm' for megabytes,
'g' for gigabytes or no suffix for sectors (usually 512 bytes).
Non-sector units will be rounded to the nearest cylinder.
Entering '?' at most prompts will give you (simple) context sensitive help.
>


你会发现C区好像被我们忽略了。那个分区代表整个硬盘,不要改动它!你会发现i区我们没有定义,此分区是已存的windows2000分区。分区无须指定任何特殊的字母,a(root),b(swap),c(entire disk)除外。

如果你仔细的看来disklable的输出,你会发现你的硬盘RPM率很可能是错误的。这是历史性的,驱动器的速度不会被系统使用。无须担心。
配置挂载点和格式化文件系统

现在进入挂载点的最后配置。如果你已经用disklable配置好了挂载点,这里你只需确定一下你的选择。但是,你也可在此指定它们。

The root filesystem will be mounted on wd0a.
wd0b will be used for swap space.
Mount point for wd0d (size=122976k), none or done? [/tmp] Enter
Mount point for wd0e (size=82152k), none or done? [/var] Enter
Mount point for wd0g (size=2097144k), none or done? [/usr] Enter
Mount point for wd0h (size=4194288k), none or done? [/home] Enter
Mount point for wd0d (size=122976k), none or done? [/tmp] done
Done - no available disks found.
You have configured the following partitions and mount points:
wd0a /
wd0d /tmp
wd0e /var
wd0g /usr
wd0h /home
The next step creates a filesystem on each partition, ERASING existing data.
Are you really sure that you're ready to proceed? [n] y
/dev/rwd0a: 307440 sectors in 305 cylinders of 16 tracks, 63 sectors
150.1MB in 20 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/rwd0d: 245952 sectors in 244 cylinders of 16 tracks, 63 sectors
120.1MB in 16 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/rwd0e: 164304 sectors in 163 cylinders of 16 tracks, 63 sectors
80.2MB in 11 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/rwd0g: 4194288 sectors in 4161 cylinders of 16 tracks, 63 sectors
2048.0MB in 261 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/rwd0h: 8388576 sectors in 8322 cylinders of 16 tracks, 63 sectors
4096.0MB in 521 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/wd0a on /mnt type ffs (rw, asynchronous, local, ctime=Thu Oct 10 21:
50:36 2 002)
/dev/wd0h on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid,
ctime=Thu Oct 10 21:50:36 2002)
/dev/wd0d on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid,
ctime=Thu Oct 10 21:50:36 2002)
/dev/wd0g on /mnt/usr type ffs (rw, asynchronous, local, nodev, ctime=Th
u Oct 10 21:50:36 2002)
/dev/wd0e on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid,
ctime=Th u Oct 10 21:50:36 2002)

你也许会问installer为什么还要问挂载点。这个允许你从(用disklable时建立的)任何错误的或者冗余的挂载点中恢复过来。比如,安装程序会自动删除在disklable创建时输入的任何重复的挂载点。disklable允许你输入重复的挂载点,因此退出disklable后就应该再次确认它们。被删除的挂载点将使得分区没有挂载点,所以为了使用你需要指定新的挂载点。

注意"Are you really sure that you are ready to proceed?"默认为no,所以你需要特意告诉它继续且格式化你的 分区。如果选择no,你会进入一个shell,在那可以输入install或者重起计算机来重新启动安装程序。

在此,所有的分区将被格式化。可能要花一些时间,这取决你的分区大小和硬盘速度。
4.5.3设置主机名(hostname)
 现在你必须设置主机名。 这里的设置和DNS域名一样被保存在文件 /etc/myname中,该文件用于在一般启动使设置好系统的主机名。如果你不设置主机名的话, 将会使用默认值"my.domain".
 设置好主机名是很重要的,因为系统在安装后首次启动时生成加密密钥的时候要使用主机名,这个通常取决于网络是否已经进行了配置。
Enter system hostname (short form, e.g. 'foo'): puffy

4.5.4-网络配置
现在就开始配置网络了。如果你要使用FTP或者NFS进行安装的话,就必须配置好网络,确定好你的相应信息,并回车。下面是安装程序中配置网络的整个过程:
Configure the network? [yes]Enter
Available interfaces are: fxp0.
Which one do you wish to initialize? (or 'done') [fxp0] Enter
Symbolic (host) name for fxp0? [puffy] Enter
The default media for fxp0 is
media: Ethernet autoselect (100baseTX full-duplex)
Do you want to change the default media? [no] Enter
IP address for fxp0? (or 'dhcp') 199.185.137.55
Netmask? [255.255.255.0] Enter
Done - no available interfaces found.
DNS domain name? (e.g. 'bar.com') [my.domain] example.com
DNS nameserver? (IP address or 'none') [none] 199.185.137.1
Use the nameserver now? [yes]Enter
Default route? (IP address, 'dhcp' or 'none') 199.185.137.128
add net default: gateway 199.185.137.128
Edit hosts with ed? [no] Enter
Do you want to do any manual network configuration? [no] Enter

上例中我们使用的是一个静态的IP地址,在那些支持dhcp环境的平台上,你也可以使用"dhcp"来代替之。在DHCP配置中,大部分的信息将从DHCP服务器上得到,在此你也有机会对那些信息进行核实。下面就是安装过程中配置DHCP网络的例子:
Configure the network? [yes]Enter
Available interfaces are: fxp0.
Which one do you wish to initialize? (or 'done') [fxp0]Enter
Symbolic (host) name for fxp0? [puffy]Enter
The default media for fxp0 is
media: Ethernet autoselect (100baseTX full-duplex)
Do you want to change the default media? [no]Enter
IP address for fxp0? (or 'dhcp') dhcp
Issuing hostname-associated DHCP request for fxp0.
Internet Software Consortium DHCP Client 2.0pl5-OpenBSD
Listening on BPF/fxp0/00:08:c7:77:b4:6b
Sending on BPF/fxp0/00:08:c7:77:b4:6b
Sending on Socket/fallback/fallback-net
DHCPDISCOVER on fxp0 to 255.255.255.255 port 67 interval 1
DHCPOFFER from 199.185.137.128
DHCPREQUEST on fxp0 to 255.255.255.255 port 67
DHCPACK from 199.185.137.128
New Network Number: 199.185.137.0
New Broadcast Address: 199.185.137.255
bound to 199.185.137.55 -- renewal in 43200 seconds.
Done - no available interfaces found.
DNS domain name? (e.g. 'bar.com') [example.org]Enter
DNS nameserver? (IP address or 'none') [199.185.137.1]Enter
Use the nameserver now? [yes]Enter
Default route? (IP address, 'dhcp' or 'none') [199.185.137.128]Enter
add net default: gateway 199.185.137.128
Edit hosts with ed? [no]Enter
Do you want to do any manual network configuration? [no]Enter

 注意:在安装时使用DHCP只能配置一个网络界面(interface).如果你想配置多个网络界面使用DHCP,将会出错。你需要在安装后手工配置其他的界面。
 现在,我们设置root用户的密码:
Password for root account? (will not echo) pAssWOrd
Password for root account? (again) pAssWOrd

你应该为root设置一个安全的密码。在系统启动后,你也要创建另外一个用户。从passwd(1)我们知道:
 新密码至少为6个字符长,并且白能全为字母。它的长度也不能大于_PASSWORD_LEN(目前为128字符长)。我们推荐大小写字母和数字以及其他符号混合使用。

4.5.6-选择安装介质
 网络设置完成后,安装脚本会给你一个手工调整配置的机会。然后将会挂载你已经创建的分区并设置好root密码。并准备好磁盘用于安装OpenBSD的。

 下一步,你需要选择安装介质。选项如下:
You will now specify the location and names of the install sets you want to
load. You will be able to repeat this step until all of your sets have been
successfully loaded. If you are not sure what sets to install, refer to the
installation notes for details on the contents of each.
Sets can be located on a (m)ounted filesystem; a (c)drom, (d)isk or (t)ape
device; or a (f)tp, (n)fs or (h)ttp server.
Where are the install sets? c
Available CD-ROMs are: cd0.

 此例中,我们是从CD-ROM进行安装的。这里也会列出在你的计算机上所检测到的所有的CD-ROM。大多数用户只有一个。选择好你要从那个光区进行安装。
 注意:虽然列出了所有的安装源,但这并不意味着所有这些你都可用。(n)fs已列出,但不非所有的体系都支持NFS安装。如果你选择了一个无效的安装源,你会得到错误信息,并且你可以再次选择正确的安装源。
Available CD-ROMs are: cd0.
Which one contains the install media? (or 'done') [cd0] Enter
Pathname to the sets? (or 'done') [3.5/i386] Enter
 在这里会提示你安装文件位于哪个目录,官方CD-ROM为3.5/i386.
4.5.6-选择文件包(filesets)
 现在将要选择你要安装的文件包。你可以在下一节了解那些包的具体信息。安装程序找到的所有文件包都会显示在屏幕上。你只要指定你需要安装的文件包就可以了。默认所有的非X文件包都已选择。但是,有些人想把文件包限制到运行OpenBSD的最低要求,即仅使用base35.tgz, etc35.tgz 和 bsd.另外一些人想安装所有的文件包。下面的例子就是完全安装:
The following sets are available. Enter a filename, 'all' to select
all the sets, or 'done'. You may de-select a set by prepending a '-'
to its name.
    [X] bsd
    [ ] bsd.rd
    [X] base35.tgz
    [X] etc35.tgz
    [X] misc35.tgz
    [X] comp35.tgz
    [X] man35.tgz
    [X] game35.tgz
    [ ] xbase35.tgz
    [ ] xshare35.tgz
    [ ] xfont35.tgz
    [ ] xserv35.tgz
File Name? (or 'done') [bsd.rd] all
The following sets are available. Enter a filename, 'all' to select
all the sets, or 'done'. You may de-select a set by prepending a '-'
to its name.
    [X] bsd
    [X] bsd.rd
    [X] base35.tgz
    [X] etc35.tgz
    [X] misc35.tgz
    [X] comp35.tgz
    [X] man35.tgz
    [X] game35.tgz
    [X] xbase35.tgz
    [X] xshare35.tgz
    [X] xfont35.tgz
    [X] xserv35.tgz
 在这里,还有些小技巧,比如-x*会删除所有的X组件。此例我们将安装所有的文件包。尽管安装最少的包系统也可以运行。我们还是推荐安装默认的或者全部的文件包。详细信息请看这里.
 选择好了需要的安装包之后,会提示你是否解压这些文件包然后安装。会显示一个进度条让你知道安装某包需耗时多少。需要多长时间主要取决于你安装OpenBSD的计算机、安装的包、已经安装介质的速度。这很可能从几分钟到几小时。
File Name? (or 'done') [done] Enter
Ready to install sets? [yes] Enter
Getting bsd ...
100% |**************************************************| 4735 KB 00:03
Getting bsd.rd ...
100% |**************************************************| 4275 KB 00:02
Getting base35.tgz ...
100% |**************************************************| 30267 KB 00:21
Getting etc35.tgz ...
100% |**************************************************| 1545 KB 00:01
Getting misc35.tgz ...
100% |**************************************************| 1909 KB 00:01
Getting comp35.tgz ...
100% |**************************************************| 17074 KB 00:13
Getting man35.tgz ...
100% |**************************************************| 6139 KB 00:04
Getting game35.tgz ...
100% |**************************************************| 2534 KB 00:01
Getting xbase35.tgz ...
100% |**************************************************| 10940 KB 00:06
Getting xshare35.tgz ...
100% |**************************************************| 1656 KB 00:02
Getting xfont35.tgz ...
100% |**************************************************| 31160 KB 00:21
Getting xserv35.tgz ...
100% |**************************************************| 15228 KB 00:11
Sets can be located on a (m)ounted filesystem; a (c)drom, (d)isk or (t)ape
device; or a (f)tp, (n)fs or (h)ttp server.
Where are the install sets? (or 'done')

到此,如果需要的话,你还可以从别的地方安装额外文件(包括自定义的文件包)。否则,如果你已经安装后了需要的文件,"确定"即可。
4.5.7-完成安装 
接下来,将有一些关于系统设置的问题。首先是是否在系统启动时启动sshd。通常,你希望让sshd运行,但有时却不要。如果你的应用程序
无须sshd,理论上来说,不运行sshd会更安全。
Do you wish sshd(8) to be started by default? [yes] y
 现在你会被问是否想要在系统上运行X.如果你回答'Y',将会在/etc/sysctl.conf中加入machdep.allowaperture=1 或者machdep.allowaperture=2,这取决你的系统平台。某些平台根本就不会问这些问题。
Do you expect to run the X Window System? [yes] y
 最后需要设置时区。根据你的机器所处的位置,有不同的回答。本例中我们使用US/Eastern,但也使用EST5EDT或者US/Michigan也可以同样
的结果。在提示符下键入?会给出所有的选项。
Saving configuration files......done.
Generating initial host.random file ......done.
What timezone are you in? ('?' for list) [US/Pacific] ?
Africa/ Chile/ GB-Eire Israel NZ-CHAT Turkey
America/ Cuba GMT Jamaica Navajo UCT
Antarctica/ EET GMT+0 Japan PRC US/
Arctic/ EST GMT-0 Kwajalein PST8PDT UTC
Asia/ EST5EDT GMT0 Libya Pacific/ Universal
Atlantic/ Egypt Greenwich MET Poland W-SU
Australia/ Eire HST MST Portugal WET
Brazil/ Etc/ Hongkong MST7MDT ROC Zulu
CET Europe/ Iceland Mexico/ ROK posix/
CST6CDT Factory Indian/ Mideast/ Singapore posixrules
Canada/ GB Iran NZ SystemV/ right/
What timezone are you in? ('?' for list) [US/Pacific] US
What sub-timezone of 'US' are you in? ('?' for list) ?
Alaska Central Hawaii Mountain Samoa
Aleutian East-Indiana Indiana-Starke Pacific
Arizona Eastern Michigan Pacific-New
Select a sub-timezone of 'US' ('?' for list): Eastern
Setting local timezone to 'US/Eastern'...done.
 如果你关心具体的时间,请看这里.
 最后是让系统创建/dev目录(某些系统可能需要花点时间,特别是当内存很小的),并安装启动块。
Making all device nodes...done.
Installing boot block...
boot: /mnt/boot
proto: /usr/mdec/biosboot
device: /dev/rwd0c
/usr/mdec/biosboot: entry point 0
proto bootblock size 512
room for 12 filesystem blocks at 0x16f
Will load 7 blocks of size 8192 each.
Using disk geometry of 63 sectors and 240 heads.
0: 9 @(203 150 55) (3078864-3078872)
1: 63 @(203 151 1) (3078873-3078935)
2: 24 @(203 152 1) (3078936-3078959)
3: 16 @(203 8 47) (3069910-3069925)
/mnt/boot: 4 entries total
using MBR partition 1: type 166 (0xa6) offset 3069360 (0x2ed5b0)
...done.
CONGRATULATIONS! Your OpenBSD install has been successfully completed!
To boot the new system, enter halt at the command prompt. Once the
system has halted, reset the machine and boot from the disk.
# halt
syncing disks... done
The operating system has halted.
Please press any key to reboot.

现在OpenBSD已经安装到你的系统上,并准备首次启动,但在你启动前...

在你重启前
4.6-你需要安装哪些文件包?

4.7-安装OpenBSD需要多大硬盘空间?
4.8-多启动OpenBSD/i386
多启动指在一台计算机上安装多个操作系统,并且有些需要在启动时选择启动那个系统。这并非一件容易是事情!如果你不根本不知道自己在做什么,很可能导致计算机上的所有数据被删除。强烈建议OpenBSD新手使用一个空白的硬盘开始OpenBSD的学习,然后在一台非生产性的系统上练习你想要的配置,最后再去尝试在一台生产性的机器上配置多启动。FAQ14有OpenBSD启动进程的更多信息。
 下面是多启动的一些配置选项:

 设置活动(active)分区

Windows NT/2000/XP NTLDR
多重引导Windows NT/2000/XP,你可以使用启动NT的NTLDR.为了和NT多重引导,你需要一份OpenBSD分区引导记录(PBR)。运行完installboot后,可以使用dd(1)将其复制到某文件:
# dd if=/dev/rsd0a of=openbsd.pbr bs=512 count=1
 现在启动NT并将openbsd.pbr放到C盘。在C:\BOOT.INI文件末尾加入如下行:
c:\openbsd.pbr="OpenBSD"
重启后你就可以在NT启动菜单里选择OpenBSD了。NTLDR Hacking Guide有关于NTLDR的更多信息。

 在Windows XP下,你也可以在GUI下对启动信息进行修改,看XP Boot.ini HOWTO.
有一些工具可以帮你完成大部分这些工作。比如BootPart。此程序可以在Windows NT/2000/XP下运行,抓取OpenBSD PBR然后放到Windows NT/2000/XP分区中,并将其添加到C:\BOOT.INI中。
 OpenBSD的安装和升级程序会重装OpenBSD的boot loader。因为boot loader的位置代码在PBR,所以如果你重装或者升级安装OpenBSD。你需要重复以上的操作来得到OpenBSD PBR的新拷贝。
注意:Windows NT/2000/XP的boot loader只能从主硬盘上启动操作系统。使用它不能从你计算机的别的硬盘上启动OpenBSD!

其他的boot loader
OpenBSD用户成功使用的其他的bootloader包括GAG,OS-BS,The Ranish Partition Manager and GRUB.

OpenBSD和Linux(i386)
请参考INSTALL.linux,此文件详细的说明了如何让OpenBSD和Linux一起工作。

4.9-安装完成后将你的dmesg发送给dmesg@openbsd.org
需要提醒人们的是,对OpenBSD开发者来说,了解那些硬件能工作哪些不能是很重要的!
引用/usr/src/etc/root/root.mail
If you wish to ensure that OpenBSD runs better on your machines, please do us
a favor (after you have your mail system configured!) and type something like:
# dmesg | mail -s "Sony VAIO 505R laptop, apm works OK" dmesg@openbsd.org
so that we can see what kinds of configurations people are running. As shown,
including a bit of information about your machine in the subject or the body
can help us even further. We will use this information to improve device driver
support in future releases. (Please do this using the supplied GENERIC kernel,
not for a custom compiled kernel, unless you're unable to boot the GENERIC
kernel). The device driver information we get from this helps us fix existing
drivers. Thank you!

Make sure you send email from an account that is able to also receive email so developers can contact you if they have something they want you to test or change
in order to get your setup working. It's not important at all to send the email from the same machine that is running OpenBSD, so if that machine is unable to
receive email, just
$ dmesg | mail your-account@yourmail.dom

and then forward that message to
dmesg@openbsd.org
where your-account@yourmail.dom is your regular email account. (or transfer the dmesg output using ftp/scp/floppydisk/carrier-pigeon/...)
注意: - Please send only GENERIC kernel dmesgs. Custom kernels that have device drivers removed are not helpful.
4.10-安装完成后如何添加文件
4.11-bsd.rd是什么?
4.12-常见的安装问题
4.13-自定义安装程序
4.14-如何安装多个类似的系统?
这里有一些工具可以用来配置使用多个类似的OpenBSD系统。
siteXX.tgz和install/upgrade.site文件。
看上面的介绍。
4.15-如何dmesg来报告安装问题?
4.16-用bsd.rd-a.out重新安装/升级OpenBSD

上一页
获取OpenBSD
目录
下一页
建立你自己的内核