本篇纪录实作安装过程与所需的设定, 详细内容可以参考
http://www.openbsd.org/faq/faq4.html
本篇假设至少已有 OpenBSD 的开机媒介
实做平台 :
OpenBSD 4.2 - i386
系统安装 :
注 : 强烈建议使用单颗硬盘单独安装, 不要使用多重开机, 以免因意外造成重要数据损毁!
1.开始安装 :
这里我们使用光盘开机
下面可以看到开机光盘开机的画面, 开完之后会停在 CLI 模式, 这里我们输入 I 来安装新的系统
rootdev=0x1100 rrootdev=0x2f00 rawdev=0x2f02
erase ^?, werase ^W, kill ^U, intr ^C, status ^T
(I)nstall, (U)pgrade or (S)hell?
I
随后设定终端机型态与键盘类型, 这里我们按 ENTER 使用默认
Welcome to the OpenBSD/i386 3.6 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? [no]
us
系统提示如果硬盘上有数据尚未备份, 请输入 no 结束安装前导程序,
以免因操作失误导致数据损毁, 或输入 yes 继续安装
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? [no]
y
2.建立磁盘安装空间 (partition & slice)
选择要使用的硬盘, 并使用全部的磁盘空间来安装
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
Do you want to use *all* of wd0 for OpenBSD? [no]
y
建立分割区 (slice)
先列出目前的切割状况(p)并以megabytes为单位(m) , 可以输入 ? 取得更多指令说明
注 : 系统显示出来的硬盘转速 (rpm) 可能会跟实际上的数值不相同, 但是可以不用理会
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.
# using MBR partition 3: type A6 off 63 (0x3f) size 12578832 (0xbff010)
Treating sectors 63-12578895 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)
> p m
device: /dev/rwd0c
type: ESDI
disk: ESDI/IDE disk
label: ST320011A
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 12483
total sectors: 12582912
free sectors: 12578832
rpm: 3600
16 partitions:
# size offset fstype [fsize bsize cpg]
a: 6142.0M 0.0M unused 0 0
c: 6144.0M 0.0M unused 0 0
>
删除(d)原有的 'a' 切割区
> d a
接着开始分割 slice, 这里我们将切出 / , swap , /tmp , /var , /home , /usr 等 slice
其代号分别为 a, b, d, e, f, g
注 : 至少必须切出 'a' 和 'b' 两个 slice, 其中 'a' 是 root 根目录 'b' 是 swap
注 : 实际需要的 slice 与 容量大小请依需求自行调整
注 : 最后一个 slice (/usr) 在 size 的部分我们按 Enter 表示使用剩余的所有空间
注 : 'c' slice 代表实体硬盘,
使用 a 来新增我们需要的 slice, 后面接着 slice 的代号
> a a
offset: [63] Enter
size: [12578832] 256M
Rounding to nearest cylinder: 524097
FS type: [4.2BSD] Enter
mount point: [none] /
> a b
offset: [524160] Enter
size: [12054735] 512M
Rounding to nearest cylinder: 1048320
FS type: [swap] Enter
> a d
offset: [1572480] Enter
size: [11006415] 256M
Rounding to nearest cylinder: 524160
FS type: [4.2BSD] Enter
mount point: [none] /tmp
> a e
offset: [2096640] Enter
size: [10482255] 256M
Rounding to nearest cylinder: 524160
FS type: [4.2BSD] Enter
mount point: [none] /var
> a f
offset: [2620800] Enter
size: [9958095] 2g
Rounding to nearest cylinder: 4194288
FS type: [4.2BSD] Enter
mount point: [none] /home
> a g
offset: [6815088] Enter
size: [5763807] Enter
FS type: [4.2BSD] Enter
mount point: [none] /usr
>
再确认一次刚刚所切割的状况, 正确无误后我们按 q 离开并按 Enter 存档
> p m
device: /dev/rwd0c
type: ESDI
disk: ESDI/IDE disk
label: ST320011A
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 12483
total sectors: 12582912
free sectors: 0
rpm: 3600
16 partitions:
# size offset fstype [fsize bsize cpg]
a: 255.9M 0.0M 4.2BSD 2048 16384 16 # /
b: 511.9M 255.9M swap
c: 6144.0M 0.0M unused 0 0
d: 255.9M 767.8M 4.2BSD 2048 16384 16 # /tmp
e: 255.9M 1023.8M 4.2BSD 2048 16384 16 # /var
f: 2048.0M 1279.7M 4.2BSD 2048 16384 16 # /home
g: 2814.4M 3327.7M 4.2BSD 2048 16384 16 # /usr
> q
Write new label?: [y]
Enter
接着确认挂载点, 如果确认先前的操作无误, 可以直接按 Enter 直到重复的 slice 出现为止
并按 y 开始格式化档案系统
Mount point for wd0d (size=262080k)? (or 'none' or 'done') [/tmp] Enter
Mount point for wd0e (size=262080k)? (or 'none' or 'done') [/var] Enter
Mount point for wd0g (size=2097144k)? (or 'none' or 'done') [/home] Enter
Mount point for wd0h (size=2881903k)? (or 'none' or 'done') [/usr] Enter
Mount point for wd0d (size=262080k)? (or 'none' or 'done') [/tmp] done
No more disks to initialize.
OpenBSD filesystems:
wd0a /
wd0d /tmp
wd0e /var
wd0f /home
wd0g /usr
The next step *DESTROYS* all existing data on these partitions!
Are you really sure that you're ready to proceed? [no] y
/dev/rwd0a: 524096 sectors in 520 cylinders of 16 tracks, 63 sectors
255.9MB in 2 cyl groups (328 c/g, 161.44MB/g, 20608 i/g)
/dev/rwd0d: 524160 sectors in 520 cylinders of 16 tracks, 63 sectors
255.9MB in 2 cyl groups (328 c/g, 161.44MB/g, 20608 i/g)
/dev/rwd0e: 524160 sectors in 520 cylinders of 16 tracks, 63 sectors
255.9MB in 2 cyl groups (328 c/g, 161.44MB/g, 20608 i/g)
/dev/rwd0f: 4194288 sectors in 4161 cylinders of 16 tracks, 63 sectors
2048.0MB in 13 cyl groups (328 c/g, 161.44MB/g, 20608 i/g)
/dev/rwd0g: 5763804 sectors in 5719 cylinders of 16 tracks, 63 sectors
2814.4MB in 18 cyl groups (328 c/g, 161.44MB/g, 20608 i/g)
/dev/wd0a on /mnt type ffs (rw, asynchronous, local, ctime=Wed Nov 10 02:03:49 2004)
/dev/wd0f on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid, ctime=Wed Nov 10 02:03:49 2004)
/dev/wd0d on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid, ctime=Wed Nov 10 02:03:49 2004)
/dev/wd0g on /mnt/usr type ffs (rw, asynchronous, local, nodev, ctime=Wed Nov 10 02:03:49 2004)
/dev/wd0e on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid, ctime=Wed Nov 10 02:03:49 2004)
3.设定主机名称
设定主机名称 (如果有合法的主机名称请在这里作设定!)
System hostname? (short form, e.g. 'foo') saxo
4.设定网络环境
请先确认您的 IP 相关信息以确保可以联机到因特网, 后续将会透过因特网来安装系统
这里我们以手动设定为例而非 DHCP (自动取得),
若您的网络环境为 DHCP 请在第五行的地方 (或相似之处) 输入 'dhcp', 并依系统提示操作.
注 : 安装过程中请 不要 使用 DHCP 来设定第二张以上的网卡, 否则将会发生错误.
以下为范例说明 :
ip = 192.168.0.106
子网掩码 = 255.255.255.0 (因为跟系统预设的内容一样, 所以我们直接按 Enter 即可)
域 名= eeto.net (这里要输入的为 '域名' 而非 FQDN, 意即不包含主机名称)
名称解析服务器 = 168.95.1.1 (此为 hinet DNS, 请输入距离较近的名称解析服务器位置来代替)
预设网关器 = 192.168.0.6
Configure the network? [yes] Enter
Available interfaces are: le1.
Which one do you wish to initialize? (or 'done') [le1] Enter
Symbolic (host) name for le1? [saxo] Enter
IPv4 address for le1? (or 'none' or 'dhcp') 192.168.0.106
Netmask? [255.255.255.0] Enter
No more interfaces to initialize.
DNS domain name? (e.g. 'bar.com') [my.domain] eeto.net
DNS nameserver? (IP address or 'none') [none] 168.95.1.1
Use the nameserver now? [yes] Enter
Default IPv4 route? (IPv4 address, 'dhcp' or 'none') 192.168.0.6
add net default: gateway 192.168.0.6
Edit hosts with ed? [no] Enter
Do you want to do any manual network configuration? [no] Enter
设定管理者(root)密码, 请注意当输入的时候并不会出现星号(*), 下面只是假设密码为 pAssWOrd
Password for root account? (will not echo) pAssWOrd
Password for root account? (again) pAssWOrd
5.选择安装途径
接着我们输入 f 表示透过 FTP 来安装我们的系统
注 : 在状况许可下, 建议以赞助的方式购买系统光盘 :P
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? (or 'done')enter
6.选择安装组件
接着系统会列出所有的组件, [X] 表示要安装.
这里我们按 Enter 表示要新增 bsd.mp 套件 (支持多颗 CPU)
注 : 请依个人习惯与需要选择套件, 或参考官方网站说明
注 : 最后五个名称以 x 开头的表示 Xwindow 的套件, 所以这里我们并不安装
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
[ ] bsd.mp
[X] base36.tgz
[X] etc36.tgz
[X] misc36.tgz
[X] comp36.tgz
[X] man36.tgz
[X] game36.tgz
[ ] xbase36.tgz
[ ] xetc36.tgz
[ ] xshare36.tgz
[ ] xfont36.tgz
[ ] xserv36.tgz
File Name? (or 'done') [bsd.mp] Enter
接着输入 -game36.tgz 来取消 game36.tgz 的选取
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] bsd.mp
[X] base36.tgz
[X] etc36.tgz
[X] misc36.tgz
[X] comp36.tgz
[X] man36.tgz
[X] game36.tgz
[ ] xbase36.tgz
[ ] xetc36.tgz
[ ] xshare36.tgz
[ ] xfont36.tgz
[ ] xserv36.tgz
File Name? (or 'done') [xbase36.tgz] -game36.tgz
确定了安装的组件之后我们输入 done 来继续下一个步骤
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] bsd.mp
[X] base36.tgz
[X] etc36.tgz
[X] misc36.tgz
[X] comp36.tgz
[X] man36.tgz
[ ] game36.tgz
[ ] xbase36.tgz
[ ] xetc36.tgz
[ ] xshare36.tgz
[ ] xfont36.tgz
[ ] xserv36.tgz
File Name? (or 'done') [game36.tgz] done
这里我们按 Enter 来开始下载刚刚所选取的组件
并输入 done 来继续下个步骤
Ready to install sets? [yes] Enter
Getting bsd ...
100% |**************************************************| 5232 KB 01:42
Getting bsd.rd ...
100% |**************************************************| 4614 KB 01:28
Getting bsd.mp ...
100% |**************************************************| 5285 KB 01:42
Getting base36.tgz ...
100% |**************************************************| 31396 KB 10:08
Getting etc36.tgz ...
100% |**************************************************| 1655 KB 00:32
Getting misc36.tgz ...
100% |**************************************************| 2193 KB 00:42
Getting comp36.tgz ...
100% |**************************************************| 18232 KB 05:52
Getting man36.tgz ...
100% |**************************************************| 6792 KB 02:12
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') done
7.系统设定
这里我们按 Enter 来启动 ssh daemon(远程加密联机), 否则请按 n 取消这项功能
Start sshd(8) by default? [yes] Enter
由于先前我们并没有选取 Xwindow 组件, 所以输入 n 表示不使用, 否则请按 Enter 表示预设启用
Do you expect to run the X Window System? [yes] n
如果您是使用标准的输出输入装置, 也就是直接连接在主机上的键盘与屏幕
请直接按 Enter 继续下一步
Change the default console to com0? [no] Enter
接着设定系统时区, 这里我们选亚洲台北 (也可以输入 ? 来显示所有列表)
Saving configuration files......done.
Generating initial host.random file ......done.
What timezone are you in? ('?' for list) [Canada/Mountain] Asia
What sub-timezone of 'Asia' are you in? ('?' for list) Shanghai
Setting local timezone to 'Asia/Taipei'...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
/mnt/boot is 3 blocks x 16384 bytes
fs block shift 2; part offset 63; inode block 120, offset 3624
using MBR partition 3: type 166 (0xa6) offset 63 (0x3f)
done.
到这里就表示已经成功的安装好系统!!
输入 halt 来重开机就可以进入系统了 (记得要将开机光盘取出来喔)
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.