任红伟 <renhw895@sohu.com>

OpenBSD, NetBSD, FreeBSD是同门三兄弟!OpenBSD以安全著称, 支持的平台很多!现在主要有三个分支:stable, release, current. 每六个月出一个release! 主要版本号是:3.1stable, 3.3release, 3.4 current. 3.4release 11月1日发行!

stable是非常稳定的版本, release是发行版, 还有一些错误, 慢慢会发展成stable版, current是新功能版, 属最新技术的版本! 一般主要使用的是release, stable, current不支持使用, 它的错误较多, 一般用户使用不方便!具体信息可查看OpenBSD主站上的介绍!
主要安装方式:CD-ROM, FTP, LocalFilesystem等!


一、 下载所需要的文件:floppy33.fs, 这可从一般的OpenBSD FTP站点上下载!

国内的OpenBSD很少, 我一个都没找到! 在安装时从国外的站点上下载文件很慢, 我上次晚上安装时到了那里就不管理它了, 到第二天早上才去继续安装!
下面说说启动盘的镜像文件:floppy33.fs, floppyB33.fs, floppyC33.fs
floppy33.fs 桌面PC版本, 它支持一般的PCI, ISA NICs, IDE, SCSI接口, 还有一些PCMCIA接口。
floppyB33.fs 服务器版本, 支持很多的RAID, 和一些SCSI。但一些基本的SCSI, ISA NICs, EISA都删除了!
floppyC33.fs 笔记本电脑版本, 支持Cardbus, PCMCIA.
我想, 一般都是桌面PC, 我自己的就是, 下载floppy33.fs.
下面是安装所需要的一些基本文件, 我把它下载下来放到内部网的FTP上了, 这样安装起来快一些:
bsd, bsd.rd, base33.tgz, etc33.tgz, comp33.tgz, man33.tgz, misc33.tgz, game33.tgz, xbase33.tgz,xfont33.tgz, xserv33.tgz, xshare33.tgz.
我还下载了ports.tar.gz, src.tar.gz, sys.tar.gz, 系统安装后这些ports tree, 内核源码都没安装, 要自己手动安装的。


现在我们已下载了软盘镜像, 开始制作启动盘
1. Unix 下:
我是在slackware上制作的, 我在windows 下用rawrite2.exe没作成功!
# fdformat /dev/fd0
# dd if=floppy33.fs of=/dev/fd0 bs=32k
2. windows下(请参考OpenBSD主站上的安装指南)
主要工具都放在FTP站点上的TOOLS目录里, 主要有: rawrite, fdimage, ntrw, rawrite不能在windows NT, windows 2000 or XP下使用!
相关操作可自己找资料, 都很简单, 在DOS下操作!

现在我们要收集自己计算机上的信息:什么平台, 硬盘上的资料要不要备份?, 网卡信息(IP,subnet masks, gateway, DNS) 一些isa卡可以安装时以dmesg查看!

已下载了安装所需要的文件!现在我们进行的是FTP安装, 我将下载的文件放在FTP上, 目录是openbsd/OpenBSD下!这样安装快很多!


erase ^?, werase ^W, kill ^U, intr ^C, status ^T
(I)nstall, (U)pgrade or (S)hell? I

选择I, 安装新系统, 如果是从原来的系统上升级则选择U, 或者你可以选择S, 在SHELL下操作, 其实当你在安装过程序中自己有某些设置错误Ctrl + c中止后, 也是回到这个SHEEL下操作的!在SHEEL下执行install就是安装系统。

Welcome to the OpenBSD/i386 3.3 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] y

选择键盘类型, 一些都是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

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

是否整个硬盘都安装OpenBSD, 是.
Do you want to use *all* of wd0 for OpenBSD? [no] yes

Treating sectors 63-6303024 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.
我分了五个区, a 根分区 200M, b 交换分区 300M , d 100M /tmp, e 100M /var , f 最后的全给 /usr,
使用 d删除分区,a 创建分区,p 查看分区情况,q 退出!
d a 删除a分区
a a 创建a分区
p g 查看分区, 大小以G显示
p m 查看分区, 大小以M显示


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
200MB in 20 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/rwd0b: 245952 sectors in 244 cylinders of 16 tracks, 63 sectors
300MB in 16 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/rwd0d: 164304 sectors in 163 cylinders of 16 tracks, 63 sectors
100MB in 11 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/rwd0e: 4194288 sectors in 4161 cylinders of 16 tracks, 63 sectors
100MB in 261 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)
/dev/rwd0f: 8388576 sectors in 8322 cylinders of 16 tracks, 63 sectors
2300MB 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)
Enter system hostname (short form, e.g. 'foo'): OpenBSD
Configure the network? [y] Enter
Available interfaces are: ne3.
Which one do you wish to initialize? (or 'done') [ne3] 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? [n] Enter
IP address for fxp0? (or 'dhcp')
Netmask? []
Done - no available interfaces found.
DNS domain name? (e.g. 'bar.com') [my.domain] OpenBSD.localhost
DNS nameserver? (IP address or 'none') [none]
Use the nameserver now? [y] Enter
Default route? (IP address, 'dhcp' or 'none')
add net default: gateway
Edit hosts with ed? [n] Enter
Do you want to do any manual network configuration? [n] Enter
设置root密码, 不会显示出来的!
Password for root account? (will not echo)
Password for root account? (again)
现在我们选择安装方式, 我是FTP安装!硬盘安装就设置相应的东西就行了!
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? f

下面我们设置FTP服务器的地址! 是否要设置代理? FTP, HTTP安装都一样, 如果需要设置一下!
HTTP/FTP proxy URL? ( e.g. ‘http://proxy.8080’, or ‘none’ ) [ none ] Entry
Do you want to see a list of potential ftp servers? [ y ] n
Server IP address, or hostname ? 我的FTP地址
Does the server support passive mode ftp? [ y ]
设置放置安装文件的目录, 根据自己的设置写目录
Server directory? [ pub/OpenBSD/3.3/i386 ] openbsd/OpenBSD
是否匿名登陆, 不是, 则输入用户名, 密码!
Login? [ anonymous ] usernme
Password? [ will no echo ] password
下面是选择要安装的软件包:我试过, 如果你的FTP上有几个包它会显示几个包, 但有几个包是一定要的:bsd, base33.tgz, etc33.tgz, comp33.tgz, man33.tgz. 打入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
[ ] bsd.rd
[X] base33.tgz
[X] etc33.tgz
[X] misc33.tgz
[X] comp33.tgz
[X] man33.tgz
[X] game33.tgz
[ ] xbase33.tgz
[ ] xshare33.tgz
[ ] xfont33.tgz
[ ] xserv33.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] base33.tgz
[X] etc33.tgz
[X] misc33.tgz
[X] comp33.tgz
[X] man33.tgz
[X] game33.tgz
[X] xbase33.tgz
[X] xshare33.tgz
[X] xfont33.tgz
[X] xserv33.tgz
File Name? (or 'done') [done] doen

选择好包后, 开始下载安装:
Ready to install sets? [y] Enter

Getting bsd ...
100% |**************************************************| 4472 KB 00:03
Getting bsd.rd ...
100% |**************************************************| 4190 KB 00:02
Getting base33.tgz ...
100% |**************************************************| 30255 KB 00:21
Getting etc33.tgz ...
100% |**************************************************| 1469 KB 00:01
Getting misc33.tgz ...
100% |**************************************************| 1828 KB 00:01
Getting comp33.tgz ...
100% |**************************************************| 16207 KB 00:13
Getting man33.tgz ...
100% |**************************************************| 5921 KB 00:04
Getting game33.tgz ...
100% |**************************************************| 2545 KB 00:01
Getting xbase33.tgz ...
100% |**************************************************| 9073 KB 00:06
Getting xshare33.tgz ...
100% |**************************************************| 1574 KB 00:02
Getting xfont33.tgz ...
100% |**************************************************| 30666 KB 00:21
Getting xserv33.tgz ...
100% |**************************************************| 14948 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')done

现在基本包安装完成!设置一下时区, 还有你以后要不要运行X:

Extract more sets? [n] Enter
Do you expect to run the X Window System? [y] y
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] Asia


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)

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.
# reboot

现在重启, 系统已安装完成!


我们安装了基本的系统,但只有最基本的东西, 像内核源代码, ports tree都没安装!

在安装时我们安装了X, 现在我们配置X-windows, 运行xf86cfg设置!OpenBSD的默认桌面是fvwm。

现在我们给系统添加新用户adduser, 在第一次使用时会有一些基本的设置, 如密码使用什么加密, 有好几种, 我选择了最常用的md5。

首先, 我们开始安装内核源代码, 为以后编译内核作准备!
如果你有CD,则只需要从CD中取出src.tar.gz,cd /usr/src 然后tar xvzf src.tar.gz, 上篇, 我们是从FTP安装的, 因此, 我们要下载两个包:src.tar.gz, sys.tar.gz.
安装ports tree, 下载ports.tar.gz, 然后copy /usr/ , tar xzvf ports.tar.gz .
下载cvsup-16.1f.tar.gz, 如果没安装X则下载 cvsup-16.1f-no_X.tar.gz
#pkg_add cvsup-16.1f.tar.gz
编辑cvsup-supfile, OpenBSD里的编辑器是mg, 类似于emacs。
#Defaults that apply to all the collections
*default release=cvs
*default delete use-rel-suffix
*default umask=002
*default host=cvsup.uk.openbsd.org
*default base=/cvsup
*default prefix=/cvsup

#If your network link is T1 or faster, comment out the following line.
*default compress

# mg cvsup-supfile
# cd /
# mkdir cvsup
# cd
# cvusp –g –L 2 cvsup-supfile
就可升级ports tree等了!
安装软件同FreeBSD下一样, 以后再说说编译内核吧!

OpenBSD-src - The src repository
OpenBSD-ports - The ports repository
OpenBSD-www - The www repository
OpenBSD-x11 - The XFree86-3 repository
OpenBSD-xf4 - The XFree86-4 repository
OpenBSD-all - All OpenBSD repositories

因为与FreeBSD等配置有点出入, 所以我在这里指出来!
我自己是使用局域网, 所以只介绍这个方面的, 如果有人使用的是PPP方式, 可自行查看官方站点上的FAQ。
可能很多使用OpenBSD的人是从FreeBSD下转过来的, 但OpenBSD的网络设置与FreeBSD有所不同, 它的网络配置没有写进rc.conf, 而是作为单独的文件存放的。
网卡IP存放在/etc/hostname.网卡型号名, 网关存放在/etc/mygate
主机名存放在/etc/myname, 名字服务器地址没变, 存放在/etc/resolv.conf
我们使用ifconfig –a 查看网卡型号:(这个是我已配置好的)
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33224
inet netmask 0xff000000
lo1: flags=8008<LOOPBACK,MULTICAST> mtu 33224
address: 00:e0:4c:e0:45:0c
media: Ethernet autoselect (10baseT)
inet ***.***.***.*** netmask 0xfffffe00 broadcast ***.***.***.***
pflog0: flags=0<> mtu 33224
pfsync0: flags=0<> mtu 2020
我的网卡是ne0, 但不知怎么的, 系统安装好后, 在/etc/中建立的文件却是hostname.ne3, 我只好自己手动改成 hostname.ne0,
inet netmask NONE
inet 指定ip地址, netmask指定网络掩码。
inet NONE media 100baseTX mediaopt full-duplex
现在指定网关, 修改/etc/mygate, 写入网关IP就行了。
主机名, 写入/etc/myname.
/etc/resolv.conf, 与别的系统一样的, 这个就不用说了!

到这里我们的OpenBSD系统已安装完成, 以后的操作我会再写出来,还过几天3.4release就要出来了, 到时我升级到3.4再写出来。

有问题可到linuxeden.com的FreeBSD版,我会与你一起讨论。我常混在www.linuxsir.com ( bsd 版), www.chinaunix.net (bsd版), www.freebsdchina.org, www.linuxfans.org, www.cnfug.org 等。

注:本文参考了OpnBSD.org的在线文档, 各位如有不明白的地方可到Openbsd.org主站上观看它的FAQ。

:任何转载或摘抄请保留作者信息和注明文章出处(中文FreeBSD用户组 http://www.cnfug.org)